mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-11-14 23:01:40 +08: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:
parent
80dd925231
commit
da649d75c0
@ -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(','));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user