BigBlocks

Unlock Wallet

Passphrase and biometric unlock screen with Touch ID support on macOS, passphrase fallback, and failed attempt tracking

Passphrase

Installation

bunx shadcn@latest add https://registry.bigblocks.dev/r/unlock-wallet.json

Usage

UnlockWallet presents a biometric or passphrase unlock screen depending on the platform. The onUnlock callback receives an optional passphrase (undefined for biometric) and should return { success, error? }.

import { UnlockWallet } from "@/components/blocks/unlock-wallet"
 
export function LockScreen() {
  return (
    <UnlockWallet
      platform="macos"
      appName="My Wallet"
      onUnlock={async (passphrase) => {
        if (passphrase) {
          return verifyPassphrase(passphrase)
        }
        return attemptBiometric()
      }}
      onSuccess={() => console.log("Unlocked")}
      onError={(err) => console.error(err)}
    />
  )
}

Props

UnlockWallet

PropTypeDefaultDescription
platform"macos" | "other""other"Platform determines which unlock methods are available
appNamestring"Wallet"Application name displayed in the unlock UI
onUnlock(passphrase?: string) => Promise<UnlockWalletResult>--Callback to execute the unlock attempt
onSuccess() => void--Called on successful unlock
onError(error: Error) => void--Called on error
classNamestring--Additional CSS classes

UnlockWalletResult

interface UnlockWalletResult {
  success: boolean
  error?: string
}