From c068b698fe9cc254c3dc82a976d1ad59b5defb21 Mon Sep 17 00:00:00 2001 From: boufni95 Date: Wed, 16 Oct 2024 17:17:02 +0000 Subject: [PATCH] fix map --- src/services/main/applicationManager.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/services/main/applicationManager.ts b/src/services/main/applicationManager.ts index 651a428b..d2c0979a 100644 --- a/src/services/main/applicationManager.ts +++ b/src/services/main/applicationManager.ts @@ -247,9 +247,13 @@ export default class { async GetNPubLinkingState(app_id: string, req: Types.GetNPubLinking): Promise { 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 } }