Files
klz-cables.com/.pnpm-store/v10/files/1c/5b11090f84f3c52aabefd02da4f8172fa8ac4e575db44aef7e95841395b74024dbbc7f3b2ab98739701c30f8745cc90e5e28821406398ec1e6d99aa2157907
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

21 lines
906 B
Plaintext

import crypto from 'crypto';
const algorithm = 'aes-256-ctr';
export function encrypt(text) {
const iv = crypto.randomBytes(16);
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
const secret = this.secret;
const cipher = crypto.createCipheriv(algorithm, secret, iv);
const encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex');
const ivString = iv.toString('hex');
return `${ivString}${encrypted}`;
}
export function decrypt(hash) {
const iv = hash.slice(0, 32);
const content = hash.slice(32);
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
const secret = this.secret;
const decipher = crypto.createDecipheriv(algorithm, secret, Buffer.from(iv, 'hex'));
return decipher.update(content, 'hex', 'utf8') + decipher.final('utf8');
}
//# sourceMappingURL=crypto.js.map