Skip to content
    hazBasehazBaseDocs
    IMPLEMENTATION GUIDE

    Authentication & wallets

    Sign-in, wallet ownership verification and operation approval serve different purposes. Treat the application session and operation authorization as distinct steps.

    Authentication and authorization flow

    01Email OTP

    Application sign-in

    02Passkey

    Device and high-trust authentication

    03Account

    Account lookup / bootstrap

    04Authorization

    Purpose-bound operation approval

    Email OTP creates an application session. It does not by itself prove wallet ownership or authorize a transfer.

    Start an application session

    sign-in.ts
    import { requestEmailOtp, verifyEmailOtp } from "@hazbase/auth";
    
    export async function requestCode(email: string) {
      return requestEmailOtp({ email, purpose: "smart_wallet_sign_in" });
    }
    
    export async function verifyCode(email: string, code: string) {
      return verifyEmailOtp({ email, code, purpose: "smart_wallet_sign_in" });
    }

    Pass email and code from user input. Configure session storage and refresh, allowed origins and passkey behavior for your application.

    Before write operations

    • emailSession is the application session sent in the Bearer header.
    • Obtain deviceBindingId and highTrustToken through the user authentication flow; fixed sample values are not substitutes.
    • High-trust tokens are purpose-bound and expire. Reauthenticate for the intended operation when necessary.
    • Complete server verification of the signed wallet-link proof. A received address alone is not identity evidence.