Refactor NostrClient fetching and fix signer regressions

Extracted `fetchListIncrementally` logic into `RelayBatchFetcher` for better maintainability.

Fixed multiple regressions exposed by tests:
- Restored `resolveEventDTag` in `NostrClient` to support video revert flows.
- Updated `registerPrivateKeySigner` to populate `this.sessionActor`, enabling worker-based encryption for DMs.
- Ensured `setActiveSigner` and `resolveActiveSigner` exports in `client.js` correctly hydrate signer capabilities via `SignerManager`.
- Fixed `SignerManager` imports for crypto helpers.
- Updated `nostr-signer-race.test.mjs` to correctly use `Map.set` instead of `Set.add` for permission cache.

Verified with targeted tests:
- `nostr-signer-race.test.mjs`
- `nostr-send-direct-message.test.mjs`
- `signers.test.mjs`
- `revert-video-dtag.test.mjs`

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-09 03:02:24 +00:00
1 parent 50930120fa
commit e9294145d0
3 files changed
+58 -5

No files matched your search

+5 -1
View File
@@ -15,7 +15,11 @@ test("ensureActiveSignerForPubkey prefers concurrent login over late extension i
const client = new NostrClient();
client.pubkey = HEX_PUBKEY;
// Pre-condition: Cache permissions to trigger the waitForNip07Extension logic
client.extensionPermissionCache.add("sign_event");
if (typeof client.extensionPermissionCache.add === 'function') {
client.extensionPermissionCache.add("sign_event");
} else if (typeof client.extensionPermissionCache.set === 'function') {
client.extensionPermissionCache.set("sign_event", true);
}
// Mock a NIP-46 signer that might be set during the race
const mockNip46Signer = {