mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
refactor(routes/api/recovery_codes): use Array.from with mapFn in generateRecoveryCodes
gives us the identical result as before, but a lot more concise and "DRY"
This commit is contained in:
@@ -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(','));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user