mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
Merge pull request #2068 from PR0M3TH3AN/fix-nip07-priority-contention-7510868666497074829
Fix NIP-07 Priority Inversion
This commit is contained in:
2 files changed
+10
-6
No files matched your search
@@ -1,7 +1,7 @@
|
||||
// js/nostr/adapters/nip07Adapter.js
|
||||
|
||||
import { normalizeActorKey } from "../watchHistory.js";
|
||||
import { runNip07WithRetry } from "../nip07Permissions.js";
|
||||
import { runNip07WithRetry, NIP07_PRIORITY } from "../nip07Permissions.js";
|
||||
|
||||
async function retryNip07Call(operation, label, priority) {
|
||||
let lastError = null;
|
||||
@@ -196,7 +196,11 @@ export async function createNip07Adapter(initialExtension, { preloadedPubkey } =
|
||||
if (typeof ext?.signEvent !== "function") {
|
||||
throw new Error("NIP-07 extension missing signEvent.");
|
||||
}
|
||||
return retryNip07Call(() => ext.signEvent(event), "extension.signEvent");
|
||||
return retryNip07Call(
|
||||
() => ext.signEvent(event),
|
||||
"extension.signEvent",
|
||||
NIP07_PRIORITY.HIGH,
|
||||
);
|
||||
},
|
||||
requestPermissions,
|
||||
destroy: async () => {},
|
||||
|
||||
+4
-4
@@ -1041,7 +1041,7 @@ class UserBlockListManager {
|
||||
"nip44",
|
||||
(payload) =>
|
||||
signer.nip44Decrypt(normalized, payload, {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.LOW,
|
||||
}),
|
||||
"active-signer",
|
||||
);
|
||||
@@ -1049,7 +1049,7 @@ class UserBlockListManager {
|
||||
"nip44_v2",
|
||||
(payload) =>
|
||||
signer.nip44Decrypt(normalized, payload, {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.LOW,
|
||||
}),
|
||||
"active-signer",
|
||||
);
|
||||
@@ -1060,7 +1060,7 @@ class UserBlockListManager {
|
||||
"nip04",
|
||||
(payload) =>
|
||||
signer.nip04Decrypt(normalized, payload, {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.LOW,
|
||||
}),
|
||||
"active-signer",
|
||||
);
|
||||
@@ -1068,7 +1068,7 @@ class UserBlockListManager {
|
||||
|
||||
const nostrApi = typeof window !== "undefined" ? window?.nostr : null;
|
||||
const decrypterOptions = {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.LOW,
|
||||
timeoutMs: nip07DecryptTimeoutMs,
|
||||
retryMultiplier: 1,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user