diff --git a/src/lib/crypto.ts b/src/lib/crypto.ts index 537200c2df1b0723df22a99326ecaa047493dab1..46c60716941a3e59b7435010bf9460ab4536d748 100644 --- a/src/lib/crypto.ts +++ b/src/lib/crypto.ts @@ -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) {