mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-11-15 23:41:52 +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() {
|
function generateRecoveryCodes() {
|
||||||
const recoveryKeys = [
|
const recoveryKeys = Array.from({ length: 8 }, () => 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'),
|
|
||||||
randomBytes(16).toString('base64')
|
|
||||||
];
|
|
||||||
|
|
||||||
recovery_codes.setRecoveryCodes(recoveryKeys.join(','));
|
recovery_codes.setRecoveryCodes(recoveryKeys.join(','));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user