diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-24 19:02:51 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-27 03:40:42 +0200 |
commit | 15a9a8f7a0707cbbe5a01b64c9ee50604fe8e6b3 (patch) | |
tree | 949a355df37834cba81192f470070abbb6826721 | |
parent | Add missing SKU (diff) | |
download | server-15a9a8f7a0707cbbe5a01b64c9ee50604fe8e6b3.tar.xz |
Configurable backup code length
-rw-r--r-- | src/util/config/types/SecurityConfiguration.ts | 1 | ||||
-rw-r--r-- | src/util/util/MFA.ts | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/util/config/types/SecurityConfiguration.ts b/src/util/config/types/SecurityConfiguration.ts index 868f5f0a..a2cebbd3 100644 --- a/src/util/config/types/SecurityConfiguration.ts +++ b/src/util/config/types/SecurityConfiguration.ts @@ -15,4 +15,5 @@ export class SecurityConfiguration { forwadedFor: string | null = null; ipdataApiKey: string | null = "eca677b284b3bac29eb72f5e496aa9047f26543605efe99ff2ce35c9"; mfaBackupCodeCount: number = 10; + mfaBackupCodeBytes: number = 4; } diff --git a/src/util/util/MFA.ts b/src/util/util/MFA.ts index d0a5722a..b9af6d23 100644 --- a/src/util/util/MFA.ts +++ b/src/util/util/MFA.ts @@ -7,7 +7,7 @@ export function generateMfaBackupCodes(user_id: string) { 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 + code: crypto.randomBytes(Config.get().security.mfaBackupCodeBytes).toString("hex"), // 8 characters consumed: false, expired: false }); |