mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-30 01:12:39 +00:00
Merge pull request #700 from PR0M3TH3AN/codex/add-nip44.encrypt-and-nip44.decrypt-permissions
Request nip44 permissions during NIP-07 login
This commit is contained in:
2 files changed
+12
-2
No files matched your search
+4
-2
@@ -166,14 +166,16 @@ const WATCH_HISTORY_REPUBLISH_JITTER = 0.25;
|
||||
const NIP07_PERMISSIONS_STORAGE_KEY = "bitvid:nip07:permissions";
|
||||
|
||||
export const DEFAULT_NIP07_PERMISSION_METHODS = Object.freeze([
|
||||
// Core auth + relay metadata
|
||||
"get_public_key",
|
||||
"sign_event",
|
||||
"read_relays",
|
||||
"write_relays",
|
||||
// Encryption helpers — request both legacy NIP-04 and modern NIP-44 upfront
|
||||
"nip04.encrypt",
|
||||
"nip04.decrypt",
|
||||
"nip44.encrypt",
|
||||
"nip44.decrypt",
|
||||
"read_relays",
|
||||
"write_relays",
|
||||
]);
|
||||
|
||||
const viewEventPublishMemory = new Map();
|
||||
|
||||
@@ -200,6 +200,10 @@ test("NIP-07 decrypt reuses cached extension permissions", async () => {
|
||||
storedSet.has("nip04.decrypt"),
|
||||
"stored permissions should include nip04.decrypt",
|
||||
);
|
||||
assert.ok(
|
||||
storedSet.has("nip44.encrypt"),
|
||||
"stored permissions should include nip44.encrypt",
|
||||
);
|
||||
assert.ok(
|
||||
storedSet.has("nip44.decrypt"),
|
||||
"stored permissions should include nip44.decrypt",
|
||||
@@ -213,6 +217,10 @@ test("NIP-07 decrypt reuses cached extension permissions", async () => {
|
||||
freshClient.extensionPermissionCache.has("nip04.decrypt"),
|
||||
"fresh client should hydrate nip04.decrypt from storage",
|
||||
);
|
||||
assert.ok(
|
||||
freshClient.extensionPermissionCache.has("nip44.encrypt"),
|
||||
"fresh client should hydrate nip44.encrypt from storage",
|
||||
);
|
||||
assert.ok(
|
||||
freshClient.extensionPermissionCache.has("nip44.decrypt"),
|
||||
"fresh client should hydrate nip44.decrypt from storage",
|
||||
|
||||
Reference in new issue
Block a user