@upbond/sdk - v0.0.3
    Preparing search index...

    Interface UpbondClient

    The browser client returned by createUpbond — the entire supported @upbond/sdk runtime surface. It combines the OIDC auth leg (login, session, claims) with the wallet leg (connect, unlock, sign, recovery) in either redirect or embedded mode. Read UpbondClient.state synchronously or observe it via UpbondClient.subscribe.

    interface UpbondClient {
        state: UpbondState;
        closeWallet(): void;
        connect(): Promise<string[]>;
        connectWallet(): Promise<
            { status: WalletStatus; walletAddress: string
            | null },
        >;
        getAccessToken(): string | null;
        getEthereumProvider(): Promise<WidgetProvider>;
        getIdToken(): string | null;
        getRecoveryStatus(): Promise<RecoveryStatus>;
        getUser(): IdTokenClaims | null;
        init(): Promise<void>;
        login(hints?: AuthorizationHints): Promise<void>;
        logout(options?: { postLogoutRedirectUri?: string }): Promise<void>;
        openWallet(view?: WalletView): Promise<void>;
        recoverWallet(): Promise<string>;
        rotateRecoveryFactor(): Promise<void>;
        setupWallet(): Promise<string>;
        signMessage(message: Uint8Array): Promise<`0x${string}`>;
        signTransaction(request: SignRequest): Promise<`0x${string}`>;
        subscribe(listener: (state: UpbondState) => void): () => void;
        unlockWallet(): Promise<string>;
        updateRecoveryContact(opts?: { channel?: "email" | "sms" }): Promise<void>;
    }
    Index

    The current client state (auth + wallet status, claims, address, phase). Always up to date.

    • Hide the wallet overlay.

      Returns void

    • Connect the embedded wallet. MUST be called synchronously from a user gesture (it opens the wallet-origin popup for OIDC login + passkey onboarding). Returns the connected accounts.

      Returns Promise<string[]>

    • Layer 1 wallet session; also resolves needs-setup vs needs-recovery for new devices.

      Returns Promise<{ status: WalletStatus; walletAddress: string | null }>

    • The OAuth access token for the issuer's userinfo/management APIs, or null when unavailable.

      Returns string | null

    • EIP-1193 provider over the widget (ethers/viem plug in directly). Mounts the widget on first call.

      Returns Promise<WidgetProvider>

    • The raw id_token for downstream verification, or null when there is no valid session.

      Returns string | null

    • Recovery status (enrollment + masked OTP contact). Layer 1 — works right after connectWallet, no unlock.

      Returns Promise<RecoveryStatus>

    • The signed-in user's id_token claims, or null when signed out or the token has expired.

      Returns IdTokenClaims | null

    • Call once on page load: consumes the redirect callback (and cleans the URL) or restores a persisted session.

      Returns Promise<void>

    • Persists PKCE state, then navigates to the issuer. Optional hints (connection, loginHint) skip the issuer's provider chooser. Does not resolve into app code.

      Parameters

      Returns Promise<void>

    • Wallet session first, then RP-initiated issuer logout redirect. Clears storage; keeps the device factor (B1).

      Parameters

      • Optionaloptions: { postLogoutRedirectUri?: string }

      Returns Promise<void>

    • Open the wallet overlay on a view (RP-initiated, e.g. a "wallet" button).

      Parameters

      Returns Promise<void>

    • New-device recovery: synced-passkey restore first, recoverian ceremony fallback.

      Returns Promise<string>

    • Rotate the recovery factor (Layer 2 required).

      Returns Promise<void>

    • First-time onboarding — the first unlock creates the wallet.

      Returns Promise<string>

    • EIP-191 personal message signature. Same ceremony semantics as signTransaction.

      Parameters

      • message: Uint8Array

      Returns Promise<`0x${string}`>

    • Signs with the session ceremony; every signature re-gates with a fresh biometric. Call from a user gesture.

      Parameters

      Returns Promise<`0x${string}`>

    • Observe state changes; returns an unsubscribe function.

      Parameters

      Returns () => void

    • Establishes the session's Layer 2 ceremony (device factor + passkey biometric) and returns the wallet address. Call from a user gesture. One ceremony per session (A2): signatures reuse it, each behind a fresh biometric; logout disposes it.

      Returns Promise<string>

    • Re-register the recovery contact from the current session's claims (recovery change → Layer 2). Requires an unlocked wallet (wallet_locked otherwise); rebinding an already-bound contact runs an OTP ceremony against the OLD contact via wallet.recovery.promptOtp.

      Parameters

      • Optionalopts: { channel?: "email" | "sms" }

      Returns Promise<void>