π Bug: ndkSignerFromPayload restores correctly but sign() hangs
NDK Version: @nostr-dev-kit/ndk@2.14.29
Context: I'm using NDKNip46Signer with persistence via toPayload() and restore via ndkSignerFromPayload(...).
β
Login Phase
const localSigner = NDKPrivateKeySigner.generate();
const signer = NDKNip46Signer.bunker(ndk, bunkerUri, localSigner.privateKey);
signer.on("authUrl", (url) => {
window.open(url, "auth", "width=400,height=700");
});
await signer.blockUntilReady();
ndk.signer = signer;
const payloadString = signer.toPayload();
localStorage.setItem("currentUserSigner", payloadString);
β
Restore Phase
const storedPayload = localStorage.getItem("currentUserSigner");
if (storedPayload) {
try {
const restoredSigner = await ndkSignerFromPayload(storedPayload, ndk);
ndk.signer = restoredSigner;
console.log("Signer restored successfully!");
const user = await restoredSigner.user();
console.log("Restored user pubkey:", user.pubkey);
} catch (error) {
console.error("Error during signer deserialization:", error);
}
}
β Problem
After restoring:
restoredSigner.user() works fine
- but
await event.sign() hangs forever (no result, no error)
restoredSigner.rpc is undefined
- so no signing request is actually sent via NIP-46
π Hypothesis
The payload generated via toPayload() looks complete (type: "nip46", relayUrls, etc.), but upon deserialization, the internal NIP-46 connection (rpc) is not being properly initialized or persisted.
β
Possible Fix
ndkSignerFromPayload(...) (or NDKNip46Signer.fromPayload(...)) may not reliably initialize rpc or call connect() internally.
π Request
Please verify that:
rpc is initialized during payload restore
connect() is called internally or exposed for manual reconnection if needed
Thanks for the amazing work on NDK π
π Bug:
ndkSignerFromPayloadrestores correctly butsign()hangsNDK Version:
@nostr-dev-kit/ndk@2.14.29Context: I'm using
NDKNip46Signerwith persistence viatoPayload()and restore viandkSignerFromPayload(...).β Login Phase
β Restore Phase
β Problem
After restoring:
restoredSigner.user()works fineawait event.sign()hangs forever (no result, no error)restoredSigner.rpcisundefinedπ Hypothesis
The payload generated via
toPayload()looks complete (type: "nip46",relayUrls, etc.), but upon deserialization, the internal NIP-46 connection (rpc) is not being properly initialized or persisted.β Possible Fix
ndkSignerFromPayload(...)(orNDKNip46Signer.fromPayload(...)) may not reliably initializerpcor callconnect()internally.π Request
Please verify that:
rpcis initialized during payload restoreconnect()is called internally or exposed for manual reconnection if neededThanks for the amazing work on NDK π