diff --git a/src/routes/api/recovery_codes.ts b/src/routes/api/recovery_codes.ts index 78be09966..3c3c13542 100644 --- a/src/routes/api/recovery_codes.ts +++ b/src/routes/api/recovery_codes.ts @@ -20,16 +20,7 @@ function checkForRecoveryKeys() { } function generateRecoveryCodes() { - const recoveryKeys = [ - randomBytes(16).toString('base64'), - randomBytes(16).toString('base64'), - randomBytes(16).toString('base64'), - randomBytes(16).toString('base64'), - randomBytes(16).toString('base64'), - randomBytes(16).toString('base64'), - randomBytes(16).toString('base64'), - randomBytes(16).toString('base64') - ]; + const recoveryKeys = Array.from({ length: 8 }, () => randomBytes(16).toString('base64')); recovery_codes.setRecoveryCodes(recoveryKeys.join(','));