UNPKG

@bsv/wallet-toolbox

Version:

BRC100 conforming wallet, wallet storage and wallet signer components

114 lines 4.25 kB
/** * WABClient * * Provides high-level methods to: * - Retrieve server info (supported auth methods, faucet info) * - Generate a random presentation key * - Start/Complete authentication with a chosen AuthMethodInteractor * - Link/unlink methods * - Request faucet * - Delete user */ import { AuthMethodInteractor } from './auth-method-interactors/AuthMethodInteractor'; export declare class WABClient { private serverUrl; constructor(serverUrl: string); /** * Return the WAB server info */ getInfo(): Promise<any>; /** * Generate a random 256-bit presentation key as a hex string (client side). */ generateRandomPresentationKey(): string; /** * Start an Auth Method flow */ startAuthMethod(authMethod: AuthMethodInteractor, presentationKey: string, payload: any): Promise<import("./auth-method-interactors/AuthMethodInteractor").StartAuthResponse>; /** * Complete an Auth Method flow */ completeAuthMethod(authMethod: AuthMethodInteractor, presentationKey: string, payload: any): Promise<import("./auth-method-interactors/AuthMethodInteractor").CompleteAuthResponse>; /** * List user-linked methods */ listLinkedMethods(presentationKey: string): Promise<any>; /** * Unlink a given Auth Method by ID */ unlinkMethod(presentationKey: string, authMethodId: number): Promise<any>; /** * Request faucet */ requestFaucet(presentationKey: string): Promise<any>; /** * Delete user */ deleteUser(presentationKey: string): Promise<any>; /** * Start OTP verification for share operations * This initiates the auth flow (e.g., sends SMS code via Twilio) * * @param methodType The auth method type (e.g., "TwilioPhone", "DevConsole") * @param userIdHash SHA256 hash of the user's identity key * @param payload Auth method specific data (e.g., { phoneNumber: "+1..." }) */ startShareAuth(methodType: string, userIdHash: string, payload: any): Promise<{ success: boolean; message: string; }>; /** * Store a Shamir share (Share B) on the server * Requires prior OTP verification via startShareAuth * * @param methodType The auth method type used for verification * @param payload Contains the OTP code and auth method specific data * @param shareB The Shamir share to store (format: x.y.threshold.integrity) * @param userIdHash SHA256 hash of the user's identity key */ storeShare(methodType: string, payload: any, shareB: string, userIdHash: string): Promise<{ success: boolean; message: string; userId?: number; }>; /** * Retrieve a Shamir share (Share B) from the server * Requires OTP verification * * @param methodType The auth method type used for verification * @param payload Contains the OTP code and auth method specific data * @param userIdHash SHA256 hash of the user's identity key */ retrieveShare(methodType: string, payload: any, userIdHash: string): Promise<{ success: boolean; shareB?: string; message: string; }>; /** * Update a Shamir share (for key rotation) * Requires OTP verification * * @param methodType The auth method type used for verification * @param payload Contains the OTP code and auth method specific data * @param userIdHash SHA256 hash of the user's identity key * @param newShareB The new Shamir share to store */ updateShare(methodType: string, payload: any, userIdHash: string, newShareB: string): Promise<{ success: boolean; message: string; shareVersion?: number; }>; /** * Delete a Shamir user's account and stored share * Requires OTP verification * * @param methodType The auth method type used for verification * @param payload Contains the OTP code and auth method specific data * @param userIdHash SHA256 hash of the user's identity key */ deleteShamirUser(methodType: string, payload: any, userIdHash: string): Promise<{ success: boolean; message: string; }>; } //# sourceMappingURL=WABClient.d.ts.map