mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-27 12:23:57 +00:00
Configurable backup code length
This commit is contained in:
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;
|
||||
}
|
||||
@@ -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
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user