diff --git a/src/extension/background-script/actions/nostr/enable.ts b/src/extension/background-script/actions/nostr/enable.ts index 65ca3dfab9..7f543c0df0 100644 --- a/src/extension/background-script/actions/nostr/enable.ts +++ b/src/extension/background-script/actions/nostr/enable.ts @@ -130,14 +130,16 @@ const enable = async (message: MessageAllowanceEnable, sender: Sender) => { EventKind.UploadChunk, EventKind.RemoteSign, ]; - - reasonableEventKindIds.forEach(async (kindId) => { - await addPermissionFor( - PermissionMethodNostr.NOSTR_SIGNMESSAGE + "/" + kindId, - host, - false - ); - }); + // when addding multiple permissions at once, the flow shall wait until all asynchronous addPermissionFor calls are completed. + await Promise.all( + reasonableEventKindIds.map((kindId) => { + addPermissionFor( + PermissionMethodNostr.NOSTR_SIGNMESSAGE + "/" + kindId, + host, + false + ); + }) + ); } else if (response.data.preset === NostrPermissionPreset.TRUST_FULLY) { Object.values(PermissionMethodNostr).forEach(async (permission) => { await addPermissionFor(permission, host, false);