How can a Chrome extension authenticate with ICP?

I’m working on a Chrome extension in which the user will need to authenticate on ICP. I’m using Identitykit, which does not seem to work. It seems like chrome-extension:// protocol is not allowed on ICP. I would appreciate some help here.

With which particular signers does it not seems to work?

Signers supported by IdentityKit:

  • Internet Identity
  • NFID
  • Plug
  • OISY
  • PrimeVault
1 Like

Internet Identity, NFID, and Plug wallet

Not sure if the URL would be consistent across different browsers, so keep in mind this might not work reliably for ICRC-34 RP Delegations for users across different browsers.

If you intend to use it solely for wallet approval interactions e.g. transfer ICP, it might work. This does mean that Internet Identity is likely not going to work reliably.

As for NFID and Plug, these should work assuming that the respective wallet implementations allow URLs with the chrome extension protocol.

I can’t find anything in IdentityKit/SignerJS that would prevent these URLs with extension wallets like Plug.

As for web wallets like NFID, there current seems to be a restriction in SignerJS to https or localhost URLs: signer-js/packages/signer-web/src/utils.ts at main · slide-computer/signer-js · GitHub

A PR to extend this check to allow for extension URLs for various browsers would be welcome.

1 Like

Thanks, @sea-snake , I’m going to change my approach for now. And maybe look into signer.js

Another approach would be to host your extension frontend on a canister so it has an https URL.

To clarify, IdentityKit uses SignerJS under the hood, so support should be similar if not the same.