login with exposed api for web page fixed.

This commit is contained in:
Your Name
2025-09-15 14:24:14 -04:00
parent 517974699d
commit 12d4810f4c
3 changed files with 367 additions and 33 deletions

View File

@@ -1254,13 +1254,13 @@ class WindowNostr {
if (event.detail.method === 'extension') {
this.authenticatedExtension = event.detail.extension;
console.log('WindowNostr: Captured authenticated extension:', this.authenticatedExtension?.constructor?.name);
// Re-install our facade to ensure we intercept signEvent calls
// Extensions may overwrite window.nostr after authentication
if (typeof window !== 'undefined') {
console.log('WindowNostr: Re-installing facade after authentication');
window.nostr = this;
}
}
// CRITICAL FIX: Re-install our facade for ALL authentication methods
// Extensions may overwrite window.nostr after ANY authentication, not just extension auth
if (typeof window !== 'undefined') {
console.log('WindowNostr: Re-installing facade after', this.authState?.method, 'authentication');
window.nostr = this;
}
console.log('WindowNostr: Auth state updated:', this.authState?.method);
@@ -1270,6 +1270,12 @@ class WindowNostr {
this.authState = null;
this.authenticatedExtension = null;
console.log('WindowNostr: Auth state cleared');
// Re-install facade after logout to ensure we maintain control
if (typeof window !== 'undefined') {
console.log('WindowNostr: Re-installing facade after logout');
window.nostr = this;
}
});
}
}