diff --git a/src/App.tsx b/src/App.tsx index 7ee8d64c..67920d68 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -311,7 +311,10 @@ function App() { // Debug: log publish/subscription calls made by signer (decrypt/sign requests) const originalPublish = (recreatedSigner as any).publishMethod ;(recreatedSigner as any).publishMethod = (relays: string[], event: any) => { - try { console.log('[bunker] publish via signer:', { relays, kind: event?.kind, tags: event?.tags?.length }) } catch {} + try { + const pTag = Array.isArray(event?.tags) ? event.tags.find((t: any) => t?.[0] === 'p')?.[1] : undefined + console.log('[bunker] publish via signer:', { relays, kind: event?.kind, tags: event?.tags, pTag, remote: nostrConnectAccount.signer.remote, userPubkey: nostrConnectAccount.pubkey }) + } catch {} return originalPublish(relays, event) } const originalSubscribe = (recreatedSigner as any).subscriptionMethod diff --git a/src/components/LoginOptions.tsx b/src/components/LoginOptions.tsx index bb18501b..4e846a45 100644 --- a/src/components/LoginOptions.tsx +++ b/src/components/LoginOptions.tsx @@ -48,6 +48,13 @@ const LoginOptions: React.FC = () => { // Get pubkey from signer const pubkey = await signer.getPublicKey() + // Validate: remote (Amber) pubkey must not equal user pubkey + if ((signer as any).remote === pubkey) { + console.error('[bunker] Invalid bunker URI: remote pubkey equals user pubkey') + setError('Invalid bunker URI (remote equals your pubkey). Generate a fresh Connect link in Amber and try again.') + return + } + // Create account from signer const account = new Accounts.NostrConnectAccount(pubkey, signer)