fix map
This commit is contained in:
parent
24e0c67775
commit
c068b698fe
1 changed files with 7 additions and 3 deletions
|
|
@ -247,9 +247,13 @@ export default class {
|
||||||
async GetNPubLinkingState(app_id: string, req: Types.GetNPubLinking): Promise<Types.NPubLinking> {
|
async GetNPubLinkingState(app_id: string, req: Types.GetNPubLinking): Promise<Types.NPubLinking> {
|
||||||
const app = await this.storage.applicationStorage.GetApplication(app_id);
|
const app = await this.storage.applicationStorage.GetApplication(app_id);
|
||||||
const user = await this.storage.applicationStorage.GetApplicationUser(app, req.user_identifier);
|
const user = await this.storage.applicationStorage.GetApplicationUser(app, req.user_identifier);
|
||||||
const linking = Object.entries(this.nPubLinkingTokens).find(([_, data]) => data.serialId === user.serial_id)
|
const iter = this.nPubLinkingTokens.keys()
|
||||||
if (linking) {
|
let result = iter.next()
|
||||||
return { state: { type: Types.NPubLinking_state_type.LINKING_TOKEN, linking_token: linking[0] } }
|
while (!result.done) {
|
||||||
|
if (this.nPubLinkingTokens.get(result.value)?.serialId === user.serial_id) {
|
||||||
|
return { state: { type: Types.NPubLinking_state_type.LINKING_TOKEN, linking_token: result.value } }
|
||||||
|
}
|
||||||
|
result = iter.next()
|
||||||
}
|
}
|
||||||
if (user.nostr_public_key) {
|
if (user.nostr_public_key) {
|
||||||
return { state: { type: Types.NPubLinking_state_type.LINKED_NPUB, linked_npub: user.nostr_public_key } }
|
return { state: { type: Types.NPubLinking_state_type.LINKED_NPUB, linked_npub: user.nostr_public_key } }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue