Skip to content

Commit c2f6b5b

Browse files
author
nullagent
committed
short code lookup working, dead code rm
1 parent 997ffaa commit c2f6b5b

1 file changed

Lines changed: 17 additions & 28 deletions

File tree

src/party/peer/match-maker-client.js

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ class MatchMakerClient extends EventEmitter {
9393
config: this.restParty.config
9494
})
9595

96-
//if(this.identity){ await this.wsParty.setIdentity(this.identity) }
97-
9896
await this.wsParty.start()
9997

10098
debug('starting wsParty')
@@ -164,29 +162,6 @@ class MatchMakerClient extends EventEmitter {
164162
}
165163

166164

167-
/*
168-
169-
annoucement: {
170-
created: {
171-
type: Number,
172-
required: true
173-
},
174-
expiry: {
175-
type: Number,
176-
index: true,
177-
required: true
178-
},
179-
sessionKey: PublicKeySchema(true),
180-
actorKey: PublicKeySchema(false)
181-
},
182-
trust: {
183-
actorSig: {required: true, type: String}, //! base64 of BSON signature
184-
sessionSig: {required: true, type: String} //! base64 of BSON signature
185-
}
186-
}
187-
188-
*/
189-
190165

191166
async announcePublicKeys(){
192167
const announceData = {
@@ -269,7 +244,6 @@ annoucement: {
269244
let toIdentity = null
270245
if(typeof toHashOrIdentity == 'string'){
271246
toIdentity = await this.lookupPublicKey(toHashOrIdentity)
272-
//this.otherIdentity = toIdentity
273247
} else {
274248
toIdentity = toHashOrIdentity
275249
}
@@ -393,7 +367,6 @@ annoucement: {
393367

394368
const inviteState = {
395369
invite: invite.inviteDoc.$meta.id,
396-
//actor,
397370
state: newState
398371
}
399372

@@ -436,7 +409,23 @@ annoucement: {
436409
}
437410

438411
async lookupPublicKeyByShortCode( code ){
439-
//
412+
debug('lookupPublicKeyByShortCode')
413+
414+
const request = { code }
415+
416+
const result = await this.restParty.comms.call('short-code/lookup', request, {
417+
expectClearTextReply: false,
418+
sendClearTextRequest: false,
419+
useSessions: true
420+
})
421+
422+
console.log('lookupPublicKeyByShortCode result', result)
423+
424+
if(!result.done){
425+
return null
426+
}
427+
428+
return result.short_code
440429
}
441430
}
442431

0 commit comments

Comments
 (0)