Passkey Wallet Implementation

The following is a demo to show how to use Openfort EIP-7702 with ERC-4337. It uses the 7702 Account from Openfort with Viem. This demo includes: WebAuthn, sponsored transactions, batch transactions, and session keys.

Initialize an account

Firstly, we will initialize an Account (EOA). You can either click on "Register" to create a new Account, or "Sign In" to sign into an existing one that you have created previously.

Your wallet

By clicking the "Register" button above, behind the scenes it will:

  1. Generate an Account (EOA) with a random private key.
  2. Prompt the end-user to create a WebAuthn key (e.g. Passkey).
  3. Sign an EIP-7702 Authorization to designate the Delegation contract onto the Account.
  4. Send an EIP-7702 Transaction with the Authorization from Step 3, and authorize the WebAuthn public key on the Account.
  5. Store the account address we are using in local storage.

Execute a sponsored transaction

Next, let's demonstrate executing a contract call using our Account (EOA) that is controlled by our WebAuthn key.

Mint tokens

The mint transaction is coordinating with the paymaster to sponsor the transaction.

  • Prompting the end-user to sign over the call with their WebAuthn key (e.g. Passkey)
  • Invoking the mint function on the Account (which uses a paymaster) with the calldata and the WebAuthn signature. The Delegation contract uses the RIP-7212 P256 Precompile to verify the WebAuthn signature.
  • Upon invoking the mint function, we are broadcasting a userop to the bundler.

Using a session key

Now, let's demonstrate how to use a session key to perform the same action. A session key is a temporary key that can be used to sign transactions on behalf of the user without requiring them to sign each transaction individually.

This time, we generate a temporary key (a non-extractable P256 key) and use it as an account session key. The session key is then stored in IndexedDB (as an example implementation) and authorized along with the WebAuthn P256 key.

The session key is used to sign the transaction, and it is limited to a certain number of actions (e.g. 10 actions for this demo).

Create a session key

Mint with session key

Session keys are solving user experience issues with prompt fatigue and reviewing signature requests. With this example, once you create a session key, you are free to perform actions without getting prompted for signatures.

This allows you to perform multiple actions (batch transaction) with the session key without needing to sign each transaction.

Mint and transfer with session key

Frequently asked questions

What is a passkey wallet?

A passkey wallet lets you log in and use your wallet without passwords or seed phrases. It uses your device's built-in security (like Face ID, Touch ID, or a hardware key) to keep your assets safe and easy to access.

How is this different from a regular crypto wallet?

Traditional wallets often ask you to store seed phrases or private keys, which can be confusing and risky. Passkey wallets remove that hassle while keeping the same security, sometimes even stronger.

Can I still use my wallet across multiple devices?

Yes. With passkeys, you can connect your wallet to different devices as long as you use the same account (like Apple, Google, or another identity provider). It's secure and syncs easily.

Is a passkey wallet safe for developers to integrate?

Absolutely. Passkey wallets follow industry security standards and reduce the risk of user mistakes (like losing a seed phrase). platforms like Openfort make it even easier for developers to add passkey-based wallets directly into apps and games.

Do I need to download an app to use it?

Not always. Many passkey wallets work directly in your browser or inside the app you're using. With Openfort, for example, users don't need a separate app, wallets are embedded right into the experience.

Can I use a passkey wallet for stablecoins and payments?

Yes. You can hold, send, and receive stablecoins just like with any other wallet. This makes passkey wallets great for simple payments and everyday transactions.