chore(bunker): warn if remote pubkey equals user pubkey (invalid state)

- Add sanity check and toast guidance to reconnect via Amber
- Helps catch misconfigured bunker URIs that would never respond to requests
This commit is contained in:
Gigi
2025-10-17 00:26:54 +02:00
parent 4b1ae838e5
commit bd29dfd65f

View File

@@ -259,6 +259,11 @@ function App() {
if (account && account.type === 'nostr-connect') {
const nostrConnectAccount = account as Accounts.NostrConnectAccount<unknown>
// Sanity check: remote (bunker) pubkey must not equal our pubkey
if (nostrConnectAccount.signer.remote === nostrConnectAccount.pubkey) {
console.warn('[bunker] ❌ Invalid bunker state: remote pubkey equals user pubkey. Please reconnect using a fresh bunker URI from Amber.')
try { showToast?.('Reconnect bunker from Amber: invalid remote pubkey detected') } catch {}
}
// Skip if we've already reconnected this account
if (reconnectedAccounts.has(account.id)) {