@web3-onboard/passport
Wallet module for connecting Passport Wallets to web3-onboard
Passport is an MPC-based programmable, distributed, and non-custodial key management system, that allows users to generate wallets, scoped to their application, either via user Passkeys, our signer allows you to sign messages and transactions with a Passport Network account.
To learn more, check out the Passpor Developer Docs
Install
pnpm install @web3-onboard/passport @0xpass/webauthn-signer
yarn add @web3-onboard/passport @0xpass/webauthn-signer
npm install @web3-onboard/passport @0xpass/webauthn-signer
Setup
To use Passport with web3-onboard, you'll first need to make sure you have configured a scope for your application. For this you can follow the guides below:
- Refer to the Passport documentation for instructions on setting up your application with Passport.
- For a primer on setting up your scope you can check here.
type PassportOptions = {
iconPath: string
scopeId: string
signer: SignerWithOptionalCreator
fallbackProvider: string
chain?: Chain
network?: Network
encryptionSecret?: string
}
Usage
import Onboard from '@web3-onboard/core'
import passportModule, { Network } from '@web3-onboard/passport'
import { WebauthnSigner } from '@0xpass/webauthn-signer'
const webauthnSigner = new WebauthnSigner({
rpId: 'localhost',
rpName: '0xPass'
})
const passport = passportModule({
network: Network.TESTNET,
scopeId: 'd8ae4424-c1f6-42b0-ab5e-2688bdaa0ff2',
signer: webauthnSigner,
fallbackProvider: 'https://eth-mainnet.g.alchemy.com/v2/xxx'
})
const onboard = Onboard({
wallets: [
passport
]
})
const connectedWallets = await onboard.connectWallet()
console.log(connectedWallets)