chore(lint): fix minor lint issues in recovery_codes

/home/pano/Programming/0_repos/TriliumNextNotes/src/services/encryption/recovery_codes.ts
   2:1  error  Imports should be sorted alphabetically                            sort-imports
   3:1  error  Imports should be sorted alphabetically                            sort-imports
  13:9  error  'encryptedRecoveryCodes' is never reassigned. Use 'const' instead  prefer-const
  57:5  error  Unexpected var, use let or const instead                           no-var
This commit is contained in:
Panagiotis Papadopoulos 2025-04-09 08:19:20 +02:00
parent 43c2818299
commit 80dd925231

View File

@ -1,6 +1,6 @@
import sql from '../sql.js';
import optionService from '../options.js';
import crypto from 'crypto';
import optionService from '../options.js';
import sql from '../sql.js';
function isRecoveryCodeSet() {
return optionService.getOptionBool('encryptedRecoveryCodes');
@ -10,7 +10,7 @@ function setRecoveryCodes(recoveryCodes: string) {
const iv = crypto.randomBytes(16);
const securityKey = crypto.randomBytes(32);
const cipher = crypto.createCipheriv('aes-256-cbc', securityKey, iv);
let encryptedRecoveryCodes = cipher.update(recoveryCodes, 'utf-8', 'hex');
const encryptedRecoveryCodes = cipher.update(recoveryCodes, 'utf-8', 'hex');
sql.transactional(() => {
optionService.setOption('recoveryCodeInitialVector', iv.toString('hex'));
@ -54,7 +54,7 @@ function verifyRecoveryCode(recoveryCodeGuess: string) {
}
const recoveryCodes = getRecoveryCodes();
var loginSuccess = false;
let loginSuccess = false;
recoveryCodes.forEach((recoveryCode: string) => {
if (recoveryCodeGuess === recoveryCode) {
removeRecoveryCode(recoveryCode);