Files
pleno-vue/tests/e2e/fixtures/otp.ts
T
Jeppe Bundgaard b39b458f4f Add .prettierrc.json and refactor test files for improved formatting consistency:
- Introduced `.prettierrc.json` to enforce consistent code formatting across the project.
- Updated unit and e2e test files to address formatting issues, improve readability, and ensure alignment with the new Prettier configuration.
2026-04-13 09:13:27 +02:00

20 lines
403 B
TypeScript

import * as OTPAuth from "otpauth";
/**
* Generate a TOTP code from a secret
* @param secret - The base32 encoded secret
* @returns The 6-digit OTP code
*/
export function generateOTP(secret: string): string {
const totp = new OTPAuth.TOTP({
issuer: "Truck Wash",
label: "User",
algorithm: "SHA1",
digits: 6,
period: 30,
secret: secret,
});
return totp.generate();
}