Skip to content

Commit

Permalink
fix: pubkey prompt triggering even if reasonable permissions set (#3240)
Browse files Browse the repository at this point in the history
* fix: pubkey prompt triggering even if reasonable permissions set

* fix: remove await
  • Loading branch information
pavanjoshi914 authored Sep 6, 2024
1 parent e1d6836 commit df27db0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/extension/background-script/actions/nostr/enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit df27db0

Please sign in to comment.