Skip to content

Commit

Permalink
Automatically try to trigger the ESR link
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Feb 20, 2024
1 parent 57278dc commit f53ea4f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'}),
Expand Down

0 comments on commit f53ea4f

Please sign in to comment.