Skip to content
Extraits de code Groupes Projets
Valider 9862e27f rédigé par Steel's avatar Steel
Parcourir les fichiers

refactor: update encryption algorithm to aes-128-gcm

parent 2d4da3f4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,7 +2,7 @@ import crypto from 'crypto';
// Inspiré de https://github.com/MauriceButler/cryptr/blob/master/index.js
export default class Cryptr {
algorithm = 'aes-256-gcm' as const;
algorithm = 'aes-128-gcm' as const;
encoding = 'base64' as const;
pbkdf2Iterations = 100000;
saltLength = 64;
......@@ -14,7 +14,8 @@ export default class Cryptr {
constructor(public secret: string) {}
getKey(salt: crypto.BinaryLike) {
return crypto.pbkdf2Sync(this.secret, salt, this.pbkdf2Iterations, 32, 'sha512');
// return crypto.pbkdf2Sync(this.secret, salt, this.pbkdf2Iterations, 16, 'sha512');
return crypto.randomBytes(16);
}
encrypt(value: crypto.BinaryLike) {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter