ref: e2e tests

This commit is contained in:
montaghanmy
2023-04-07 11:16:04 +01:00
parent af980a139b
commit c97ec52a11
3 changed files with 798 additions and 3 deletions
+4 -3
View File
@@ -25,9 +25,10 @@ function decrypt(data: string, encryptionKey: string): CryptoResult {
const salt = encryptedArray[1]
? Buffer.from(encryptedArray[1], "utf-8")
: Buffer.from("", "utf-8");
const iv = encryptedArray.length >= 3
? Buffer.from(encryptedArray[2], "base64")
: Buffer.from("twake_constantiv", "utf-8");
const iv =
encryptedArray.length >= 3
? Buffer.from(encryptedArray[2], "base64")
: Buffer.from("twake_constantiv", "utf-8");
const password = Buffer.concat([Buffer.from(encryptionKey, "hex"), salt], 32);
const decipher = createDecipheriv("AES-256-CBC", password, iv);