Skip to content

Commit

Permalink
Merge pull request #770 from shocknet/fix-map
Browse files Browse the repository at this point in the history
fix map
  • Loading branch information
shocknet-justin authored Oct 16, 2024
2 parents 30d7942 + c068b69 commit 3cd3a21
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/services/main/applicationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,13 @@ export default class {
async GetNPubLinkingState(app_id: string, req: Types.GetNPubLinking): Promise<Types.NPubLinking> {
const app = await this.storage.applicationStorage.GetApplication(app_id);
const user = await this.storage.applicationStorage.GetApplicationUser(app, req.user_identifier);
const linking = Object.entries(this.nPubLinkingTokens).find(([_, data]) => data.serialId === user.serial_id)
if (linking) {
return { state: { type: Types.NPubLinking_state_type.LINKING_TOKEN, linking_token: linking[0] } }
const iter = this.nPubLinkingTokens.keys()
let result = iter.next()
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) {
return { state: { type: Types.NPubLinking_state_type.LINKED_NPUB, linked_npub: user.nostr_public_key } }
Expand Down

0 comments on commit 3cd3a21

Please sign in to comment.