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,

37 lines 2.03 kB
export declare const PASSPHRASE_MIN_ZXCVBN_SCORE = 3; export declare const PIN_MIN_ZXCVBN_SCORE = 1; export declare const PASSPHRASE_MIN_LENGTH = 12; export declare const PASSPHRASE_MAX_LENGTH = 128; export declare const PIN_MIN_LENGTH = 6; export declare const PIN_MAX_LENGTH = 16; export type ScryptProgressCallback = (progress: number) => void; /** * Computes the scrypt hash from passphrase and pin. * Passphrase and pin are validated by length (see PASSPHRASE_MIN/MAX_LENGTH, PIN_MIN/MAX_LENGTH) and zxcvbn; invalid or weak values are rejected (returns ""). * * @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 cb - Callback receiving progress updates during the scrypt hashing process * @param legacy - When true, uses HASH_OPTIONS_LEGACY and the original salt (last 4 characters of passphrase plus full pin). When false, uses HASH_OPTIONS and a keccak256-based salt from ABI-encoding the domain separator, passphrase, and pin * @returns Hash as hex string, or "" if passphrase/pin missing or too weak */ export declare function generateHash(passphrase: string, pin: string, cb?: ScryptProgressCallback, legacy?: boolean): Promise<string>; /** * Derives the EVM private key from a scrypt hash result. * @param hash - Scrypt hash result (hex string) * @returns Private key as hex string */ export declare function getEvmPrivateKey(hash: string): string; /** * Returns the EVM wallet address derived from a scrypt hash result. * @param hash - Scrypt hash result * @returns EVM address (checksummed) */ export declare function getEvmWalletAddress(hash: string): string; /** * Returns the TRON wallet address derived from a scrypt hash result. * @param hash - Scrypt hash result * @returns TRON base58 address, or false if TronWeb rejects the derived key */ export declare function getTronWalletAddress(hash: string): string | false; //# sourceMappingURL=credentials.d.ts.map