@@ -75,6 +75,8 @@ class MatchMakerClient extends EventEmitter {
7575 party :this . restParty ,
7676 config : this . restParty . config
7777 } )
78+
79+ this . restParty . comms . sessionId = this . sessionKey . key . hash
7880 }
7981
8082 await this . announcePublicKeys ( )
@@ -86,7 +88,7 @@ class MatchMakerClient extends EventEmitter {
8688 uri : this . wsUrl ,
8789 discoverRemoteIdentity : false ,
8890 remoteIdentity : await this . restParty . comms . getServiceIdentity ( ) ,
89- session : Math . random ( ) . toString ( 36 ) . slice ( 2 )
91+ session : this . sessionKey . key . hash
9092 } ) ,
9193 config : this . restParty . config
9294 } )
@@ -208,9 +210,13 @@ annoucement: {
208210 }
209211 }
210212
213+
211214 const actorSigMsg = await this . identity . sign ( announceData . annoucement , true )
212215 const sessionSigMsg = await this . sessionKey . sign ( announceData . annoucement , true )
213216
217+ debug ( 'actorSigMsg' , actorSigMsg )
218+ debug ( 'sessionSigMsg' , sessionSigMsg )
219+
214220 announceData . trust . actorSig = dataparty_crypto . Routines . Utils . base64 . encode ( actorSigMsg . sig )
215221 announceData . trust . sessionSig = dataparty_crypto . Routines . Utils . base64 . encode ( sessionSigMsg . sig )
216222
@@ -240,7 +246,7 @@ annoucement: {
240246 const lookupResult = await this . restParty . comms . call ( 'key/lookup' , lookupData , {
241247 expectClearTextReply : false ,
242248 sendClearTextRequest : false ,
243- useSessions : false
249+ useSessions : true
244250 } )
245251
246252 if ( ! lookupResult . done ) {
@@ -297,7 +303,7 @@ annoucement: {
297303 const inviteResult = await this . restParty . comms . call ( 'invite/create' , invitePostData , {
298304 expectClearTextReply : false ,
299305 sendClearTextRequest : false ,
300- useSessions : false
306+ useSessions : true
301307 } )
302308
303309 const inviteDoc = inviteResult . invite
@@ -328,7 +334,7 @@ annoucement: {
328334 const lookupResult = await this . restParty . comms . call ( 'invite/lookup' , lookup , {
329335 expectClearTextReply : false ,
330336 sendClearTextRequest : false ,
331- useSessions : false
337+ useSessions : true
332338 } )
333339
334340 if ( ! lookupResult . done ) {
@@ -387,14 +393,14 @@ annoucement: {
387393
388394 const inviteState = {
389395 invite : invite . inviteDoc . $meta . id ,
390- actor,
396+ // actor,
391397 state : newState
392398 }
393399
394400 const inviteStateResult = await this . restParty . comms . call ( 'invite/set-state' , inviteState , {
395401 expectClearTextReply : false ,
396402 sendClearTextRequest : false ,
397- useSessions : false
403+ useSessions : true
398404 } )
399405
400406 console . log ( 'setInviteState result' , inviteStateResult )
@@ -405,6 +411,35 @@ annoucement: {
405411
406412 return inviteStateResult . invite
407413 }
414+
415+ async createShortCode ( uses = 3 , expiry ) {
416+ debug ( 'setInviteState' )
417+ let actor = this . identity . key . hash
418+
419+ const request = {
420+ invite : invite . inviteDoc . $meta . id ,
421+ actor,
422+ state : newState
423+ }
424+
425+ const result = await this . restParty . comms . call ( 'short-code/create' , request , {
426+ expectClearTextReply : false ,
427+ sendClearTextRequest : false ,
428+ useSessions : true
429+ } )
430+
431+ console . log ( 'setInviteState result' , result )
432+
433+ if ( ! result . done ) {
434+ return null
435+ }
436+
437+ return result . invite
438+ }
439+
440+ async lookupPublicKeyByShortCode ( code ) {
441+ //
442+ }
408443}
409444
410445module . exports = MatchMakerClient
0 commit comments