UNPKG

@yutons/notp

Version:

one-time password generator for javascript

25 lines (24 loc) 715 B
/** * Base32 编码、解码、生成随机密钥 */ export declare class Base32 { static readonly BASE32_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; /** * 生成Base32随机密钥 * @param length 密钥长度(字节),默认为20字节 * @returns Base32编码的密钥字符串 */ static generate(length?: number): string; /** * Base32编码 * @param bytes 需要编码的字节数组 * @return Base32编码的字符串 */ static encode(bytes: Uint8Array<any>): string; /** * Base32解码 * @param secret Base32编码的字符串 * @returns 解码后的字节数组 */ static decode(secret: string): Uint8Array<any>; }