← Back to Home

Example 01: Passkey Login with Smart Wallet

Learn how to create a Solana smart wallet using passkey authentication (Face ID / Touch ID) with Lazorkit.

What You’ll Learn

  • Passkey-based authentication using WebAuthn
  • Automatic smart wallet creation on Solana
  • Connect and disconnect wallet sessions
  • No browser extensions or seed phrases

How It Works

1. Passkey Authentication

Instead of seed phrases, Lazorkit uses WebAuthn passkeys (Face ID / Touch ID) to securely authenticate users.

2. Smart Wallet Creation

After authentication, Lazorkit generates a smart wallet address on Solana that can hold tokens and interact with programs.

3. Session Management

The wallet session is managed in the app, allowing users to disconnect without interacting with the portal.

Code Example

Minimal Lazorkit passkey login example. One hook is enough to access the full smart wallet functionality.

import { useWallet } from "@lazorkit/wallet";

export function ConnectButton() {
  const {
    connect,
    disconnect,
    isConnected,
    isConnecting,
    smartWalletPubkey,
  } = useWallet();

  if (isConnected && smartWalletPubkey) {
    return (
      <button onClick={disconnect}>
        Disconnect ({smartWalletPubkey.toBase58().slice(0, 6)}...)
      </button>
    );
  }

  return (
    <button onClick={() => connect()} disabled={isConnecting}>
      {isConnecting ? "Connecting..." : "Connect with Passkey"}
    </button>
  );
}