Fix: Cancel NIP-46 handshake on login modal cancellation

Implemented a mechanism to cancel the pending NIP-46 handshake when the user clicks 'Cancel' in the login modal.
- Added `pendingHandshakeCancel` callback to `NostrClient` to reject the handshake promise.
- Updated `LoginModalController` to invoke `disconnectRemoteSigner` on cancellation.
- Prevented `onLoginError` callback from triggering when the error code is `login-cancelled`.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-28 00:38:26 +00:00
1 parent 63e5c9f415
commit 13ab4e790d
2 files changed
+31

No files matched your search

+8
View File
@@ -1487,6 +1487,7 @@ export default class LoginModalController {
this.rejectPendingTask(this.createCancellationError(), {
type: "add-profile",
});
this.handleProviderDisconnect("nip46");
cleanup();
} else {
finish(null, { keepMounted: false });
@@ -2392,6 +2393,13 @@ export default class LoginModalController {
return;
}
if (
rejectionError.code === "login-cancelled" ||
rejectionError.code === "user-cancelled"
) {
return;
}
await safeInvokeAsync(this.callbacks.onLoginError, {
provider: entry.provider.source || entry.provider,
error: rejectionError,