Files
pleno-vue/tests/e2e/fixtures/otp.ts
T
Jeppe Bundgaard 60742bf947 Refactor and migrate Playwright E2E tests:
- Remove `playwright.config.js` to clean up configuration.
- Add new E2E test suites (`admin-pos-orders`, `admin-module-goals`, `admin-module-pos-mobile-order-flow`) to structure Admin module tests.
- Introduce reusable authentication and data seeding utilities in `fixtures` for streamlined test flows and maintainability.
2026-03-19 12:46:47 +01: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();
}