Passport Protocol uses an EIP 1193 compatible interface for signing messages, transaction and typed data. With this we've created a wallet client, which acts as a JSON-RPC account which allows you to leverage all of Viem's features.
1. Install the packages
npm install viem @0xpass/passport-viem
pnpm install viem @0xpass/passport-viem
yarn add viem @0xpass/passport-viem
2. Choose your auth method
Passkeys
npm install @0xpass/webauthn-signer
pnpm install @0xpass/webauthn-signer
yarn add @0xpass/webauthn-signer
import { WebauthnSigner } from "@0xpass/webauthn-signer";
const signer = new WebauthnSigner({
rpId: window.location.hostname,
rpName: "rpName",
});
DOA
npm install @0xpass/key-signer
pnpm install @0xpass/key-signer
yarn add @0xpass/key-signer
import { KeySigner } from "@0xpass/key-signer";
const signer = new KeySigner(process.env.PRIVATE_KEY!, true);
To create a wallet client, you'll need to have a registered and authenticated account, to setup a WalletClient with each signer you can follow the examples below.