@yutons/notp
Version:
one-time password generator for javascript
34 lines (33 loc) • 899 B
TypeScript
/**
* HMAC 算法类型枚举
*/
export declare const AlgorithmValues: {
readonly SHA1: "sha1";
readonly SHA256: "sha256";
readonly SHA512: "sha512";
readonly SM3: "sm3";
};
export type Algorithm = typeof AlgorithmValues[keyof typeof AlgorithmValues];
export declare const Algorithm: {
readonly SHA1: "sha1";
readonly SHA256: "sha256";
readonly SHA512: "sha512";
readonly SM3: "sm3";
};
/**
* 默认配置
*/
export declare class Default {
static readonly ALGORITHM: Algorithm;
static readonly PERIOD = 30;
static readonly DIGITS = 6;
static readonly WINDOW = 0;
/**
* 运行时支持的算法列表(自动从 enum 生成)
*/
static SUPPORTED_ALGORITHMS: readonly Algorithm[];
/**
* 类型守卫:检查字符串是否为支持的算法
*/
static isSupportedAlgorithm(value: string): value is Algorithm;
}