@mark01/express-utils
Version:
npm package that contains utilities for express.js
24 lines (23 loc) • 990 B
TypeScript
export type OTPParams = {
issuer: string;
label: string;
algorithm: 'SHA1' | 'SHA256' | 'SHA512';
digits: number;
period: number;
secret: string;
};
export declare const generateDefaultTOTP: (issuer: string, label: string, secret: string) => {
token: string;
uri: string;
};
export declare const generateTOTP: ({ issuer, label, algorithm, digits, period, secret, }: OTPParams) => {
token: string;
uri: string;
};
export declare const validateDefaultTOTP: (issuer: string, token: string, secret: string) => boolean;
export declare const validateTOTP: (token: string, { issuer, label, algorithm, digits, period, secret }: OTPParams) => boolean;
export declare const generateOwnOTP: (counter: number, { issuer, label, algorithm, digits, period, secret }: OTPParams) => {
token: string;
uri: string;
};
export declare const verifyOwnTOTP: (otp: string, window: number, { issuer, label, algorithm, digits, period, secret }: OTPParams) => boolean;