From f53ea4fd9f4d7d63ffe48fa8bcc8949be1bbf863 Mon Sep 17 00:00:00 2001 From: Aaron Cox Date: Mon, 19 Feb 2024 18:57:53 -0800 Subject: [PATCH] Automatically try to trigger the ESR link --- src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index.ts b/src/index.ts index d8e038d..845925e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -118,6 +118,14 @@ export class WalletPluginAnchor extends AbstractWalletPlugin { // Create the identity request to be presented to the user const {callback, request, sameDeviceRequest, requestKey, privateKey} = await createIdentityRequest(context, this.buoyUrl) + + // Attempt to trigger the same device request immediately + try { + window.location.href = sameDeviceRequest.encode(true, false, 'esr:') + } catch (e) { + console.log('No default handler for the esr protocol was triggered automatically.') + } + // Tell Wharf we need to prompt the user with a QR code and a button const promptResponse = context.ui?.prompt({ title: t('login.title', {default: 'Connect with Anchor'}),