diff --git a/src/lib/amber.ts b/src/lib/amber.ts index 68b7898..1c61c96 100644 --- a/src/lib/amber.ts +++ b/src/lib/amber.ts @@ -300,22 +300,15 @@ function buildCallbackUrl(): string { /** * Navigate to an Amber nostrsigner: URL. * - * Amber has two code paths depending on how it receives the intent: + * Per NIP-55, web clients must navigate directly to the nostrsigner: URI + * using window.location.href. This fires an Android intent that Amber + * intercepts via its registered nostrsigner: scheme handler. * - * 1. NATIVE path (no Browser.EXTRA_APPLICATION_ID): reads type from - * intent EXTRAS — not set when coming from a WebView URL navigation. - * - * 2. WEB/BROWSER path (Browser.EXTRA_APPLICATION_ID present): reads type - * from URL query params — set when a browser/WebView opens a URL. - * - * We need the WEB path. window.open('url', '_blank') causes the WebView - * to open the URL as a browser navigation, which sets - * Browser.EXTRA_APPLICATION_ID and routes Amber to parse our URL params. + * DO NOT use window.open(..., '_blank') — that opens a new tab/window + * instead of firing the intent, which is what caused "malformed request". */ function openAmberUrl(url: string): void { - // _blank triggers the browser intent path in Android WebView, - // which sets Browser.EXTRA_APPLICATION_ID so Amber reads URL query params. - window.open(url, '_blank'); + window.location.href = url; } /**