Skip to content
/ passkey Public

A package that exports a Nexus SDK compatible Passkey Validator module.

License

Notifications You must be signed in to change notification settings

bcnmy/passkey

Repository files navigation

Biconomy License MIT codecov

@biconomy/passkey 🚀

A WebAuthn-based passkey validator module for Biconomy's SDK (@biconomy/sdk). Enable secure transaction signing using device biometrics in your Web3 Client applications (e.g. Next.js, React, etc.).

Key Features

  • 🔐 WebAuthn-based transaction signing
  • 📜 ERC-7579 compliant module implementation
  • 🤝 Seamless integration with Biconomy's Nexus smart accounts
  • 🔄 Support for both registration and login flows
  • 👆 Native device biometrics support

Installation

Choose your preferred package manager:

# npm
npm i @biconomy/sdk @biconomy/passkey

# yarn
yarn add @biconomy/sdk @biconomy/passkey

# pnpm
pnpm i @biconomy/sdk @biconomy/passkey

# bun
bun i @biconomy/sdk @biconomy/passkey

Quick Start Guide

Here's a complete example showing how to set up and use the passkey validator:

import { toWebAuthnKey, WebAuthnMode, toPasskeyValidator } from "@biconomy/passkey"
import { createNexusClient, moduleActivator } from "@biconomy/sdk"
import { http } from "viem"
import { baseSepolia } from "viem/chains"

// 1. Initial Setup
const account = privateKeyToAccount('0x...')
const chain = baseSepolia
const bundlerUrl = 'https://bundler.biconomy.io/api/v3/84532/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44'

// 2. Create Nexus Client
const nexusClient = await createNexusClient({
  signer: account,
  chain,
  transport: http(),
  bundlerTransport: http(bundlerUrl)
})

// 3. Setup WebAuthn Credentials
const webAuthnKey = await toWebAuthnKey({
  mode: WebAuthnMode.Register    // Use .Login for existing passkeys
})

// 4. Initialize Passkey Validator
const passkeyValidator = await toPasskeyValidator({
  webAuthnKey,
  account: nexusClient.account,
})

// 5. Install Validator Module
const opHash = await nexusClient.installModule({ module: passkeyValidator })
await nexusClient.waitForUserOperationReceipt({ hash: opHash })

// 6. Activate the Validator
nexusClient.extend(moduleActivator(passkeyValidator))

// 7. Send a Transaction
const tx = await nexusClient.sendTransaction({
  to: "0x...",
  value: 1
})

About

A package that exports a Nexus SDK compatible Passkey Validator module.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published