Skip to content

Connect Wallet Guide

Enable users to connect their existing HumanWallet using secure passkey authentication

🔐 Passkey Auth⚡ No Extensions🚀 One-Click Connect

This guide demonstrates how to implement wallet connection functionality in your React application using HumanWallet's passkey-based authentication.

Overview

HumanWallet connection allows users to securely access their existing wallets using WebAuthn passkeys. This approach eliminates the need for browser extensions or seed phrases while maintaining the highest security standards.

Drop-in Compatibility with Wagmi

If you're already using Wagmi in your application, HumanWallet integrates perfectly:

  • Same hooks: Use useConnect, useAccount, useBalance exactly as before
  • Same patterns: All your existing Wagmi patterns work unchanged
  • Same TypeScript: Full type safety with your existing setup
  • Same performance: Built on the same Wagmi/Viem foundation you trust

Key Features

  • Passkey Authentication: Uses WebAuthn for secure, passwordless login
  • No Browser Extensions: Works directly in the browser without additional software
  • Automatic Detection: Distinguishes between existing and new wallet scenarios
  • Error Handling: Comprehensive error states and user feedback

Core Hook Usage

Basic Connection Hook

The foundation of wallet connection is the useConnect hook from Wagmi:

hooks/useWalletConnection.ts
import { useConnect } from "wagmi"
import type { Connector } from "wagmi"
 
export function useWalletConnection() {
  const { connectors, connect, isPending, error } = useConnect()
 
  const connectWallet = (connector: Connector) => {
    connect({ connector })
  }
 
  const getHumanWalletConnector = () => {
    return connectors.find((connector) => connector.name === "HumanWallet")
  }
 
  return {
    connectors,
    connectWallet,
    getHumanWalletConnector,
    isPending,
    error,
  }
}

Continue Learning