diff options
-rw-r--r-- | src/util/config/types/SecurityConfiguration.ts | 1 | ||||
-rw-r--r-- | src/util/util/MFA.ts | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/util/config/types/SecurityConfiguration.ts b/src/util/config/types/SecurityConfiguration.ts index 98c04c99..868f5f0a 100644 --- a/src/util/config/types/SecurityConfiguration.ts +++ b/src/util/config/types/SecurityConfiguration.ts @@ -14,4 +14,5 @@ export class SecurityConfiguration { // CF-Connecting-IP for cloudflare forwadedFor: string | null = null; ipdataApiKey: string | null = "eca677b284b3bac29eb72f5e496aa9047f26543605efe99ff2ce35c9"; + mfaBackupCodeCount: number = 10; } diff --git a/src/util/util/MFA.ts b/src/util/util/MFA.ts index a2afcad6..d0a5722a 100644 --- a/src/util/util/MFA.ts +++ b/src/util/util/MFA.ts @@ -1,9 +1,10 @@ import crypto from "crypto"; +import { Config } from "."; import { BackupCode } from "../entities/BackupCodes"; export function generateMfaBackupCodes(user_id: string) { let backup_codes: BackupCode[] = []; - for (let i = 0; i < 10; i++) { + for (let i = 0; i < Config.get().security.mfaBackupCodeCount; i++) { const code = BackupCode.create({ user: { id: user_id }, code: crypto.randomBytes(4).toString("hex"), // 8 characters |