Phase1
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 21s
CI / Go — edge-gateway build (push) Successful in 13s

This commit is contained in:
smueller
2026-06-26 11:31:54 +02:00
parent 4fe25e6ec3
commit 58961000eb
123 changed files with 4231 additions and 136 deletions

21
packages/auth/src/totp.ts Normal file
View File

@@ -0,0 +1,21 @@
import { authenticator } from 'otplib';
export function generateTotpSecret(): string {
return authenticator.generateSecret();
}
export function verifyTotpCode(secret: string, code: string): boolean {
try {
return authenticator.verify({ token: code.replace(/\s+/gu, ''), secret });
} catch {
return false;
}
}
export function buildOtpAuthUrl(
issuer: string,
accountName: string,
secret: string,
): string {
return authenticator.keyuri(accountName, issuer, secret);
}