Configurable backup code length

This commit is contained in:
TheArcaneBrony committed 2022-08-27 03:40:42 +02:00
1 parent 2a553e2ef9
commit 15a9a8f7a0
2 files changed
+2 -1

No files matched your search

@@ -15,4 +15,5 @@ export class SecurityConfiguration {
forwadedFor: string | null = null;
ipdataApiKey: string | null = "eca677b284b3bac29eb72f5e496aa9047f26543605efe99ff2ce35c9";
mfaBackupCodeCount: number = 10;
mfaBackupCodeBytes: number = 4;
}
+1 -1
View File
@@ -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
});