We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ccf33b commit 56ed985Copy full SHA for 56ed985
src/otp.ts
@@ -39,17 +39,17 @@ export async function generateHOTP(
39
40
export async function generateTOTP(
41
secret: string,
42
- {
43
- period = defaultPeriod,
44
- digits = defaultDigits,
45
- }: {
+ options?: {
46
period?: number;
47
digits?: number;
48
- },
+ hash?: SHAFamily;
+ }
49
) {
+ const digits = options?.digits ?? defaultDigits;
+ const period = options?.period ?? defaultPeriod;
50
const milliseconds = period * 1000;
51
const counter = Math.floor(Date.now() / milliseconds);
52
- return await generateHOTP(secret, { counter, digits });
+ return await generateHOTP(secret, { counter, digits, hash: options?.hash });
53
}
54
55
0 commit comments