UNPKG

@mybucks.online/core

Version:

Core library for Mybucks.online — a seedless wallet and gifting wallet: disposable gift wallets, fund and share via secure 1-click URL. Browser-only (no servers, database, or install). Cryptography and wallet primitives for airdrops, giveaways, campaigns,

28 lines 1.78 kB
export type ParsedToken = { passphrase: string; pin: string; network: string; legacy: boolean; }; /** * Generates a gifting-link token by encoding passphrase, pin and network, with random padding. * The gifting-link lets users send full ownership of a wallet account (e.g. gifting or airdrops). * Passphrase and PIN are validated by length (see PASSPHRASE_MIN/MAX_LENGTH, PIN_MIN/MAX_LENGTH) and zxcvbn; invalid or weak values return null. * When legacy is false, payload is compact length-prefixed (version 0x02) to avoid concatenation ambiguity and keep the URL fragment short; when true, uses LEGACY_URL_DELIMITER concatenation. * * @param passphrase - Length in [PASSPHRASE_MIN_LENGTH, PASSPHRASE_MAX_LENGTH], zxcvbn score >= 3 * @param pin - Length in [PIN_MIN_LENGTH, PIN_MAX_LENGTH], zxcvbn score >= 1 * @param network - ethereum | polygon | arbitrum | optimism | bsc | avalanche | base | tron * @param legacy - When true, LEGACY_URL_DELIMITER concatenation; when false, compact length-prefixed encoding * @returns Token string suitable to append to `https://app.mybucks.online#wallet=`, or null if invalid/weak */ export declare function generateToken(passphrase: string, pin: string, network: string, legacy?: boolean): string | null; /** * Parses a gifting-link token produced by {@link generateToken}. * Tokens whose payload starts with 0x02 are decoded as compact length-prefixed; otherwise payload is treated as legacy (UTF-8 + LEGACY_URL_DELIMITER). * * @param token - Token string returned by generateToken() * @returns `{ passphrase, pin, network, legacy }` — legacy is true if token used legacy format, false if compact-encoded */ export declare function parseToken(token: string): ParsedToken; //# sourceMappingURL=token.d.ts.map