Chore extend svelte element on components and use clsx on class names #63
1 changed files with 0 additions and 3 deletions
|
|
@ -21,7 +21,6 @@ export function encrypt(value: string): string {
|
||||||
const key = scryptSync(password, salt, 32);
|
const key = scryptSync(password, salt, 32);
|
||||||
const iv = randomBytes(8);
|
const iv = randomBytes(8);
|
||||||
|
|
||||||
// @ts-expect-error Bun typing mismatch, but it still works!
|
|
||||||
const cipher = createCipheriv(algorithm, key, iv);
|
const cipher = createCipheriv(algorithm, key, iv);
|
||||||
const encrypted = cipher.update(value, 'utf-8', 'hex') + cipher.final('hex');
|
const encrypted = cipher.update(value, 'utf-8', 'hex') + cipher.final('hex');
|
||||||
const authTag = cipher.getAuthTag();
|
const authTag = cipher.getAuthTag();
|
||||||
|
|
@ -33,9 +32,7 @@ export function decrypt(value: string): string {
|
||||||
const key = scryptSync(password, salt, 32);
|
const key = scryptSync(password, salt, 32);
|
||||||
const [iv, text, authTag] = deconstruct(value, iv_position);
|
const [iv, text, authTag] = deconstruct(value, iv_position);
|
||||||
|
|
||||||
// @ts-expect-error Bun typing mismatch, but it still works!
|
|
||||||
const decipher = createDecipheriv(algorithm, key, iv);
|
const decipher = createDecipheriv(algorithm, key, iv);
|
||||||
// @ts-expect-error Bun typing mismatch, but it still works!
|
|
||||||
decipher.setAuthTag(authTag);
|
decipher.setAuthTag(authTag);
|
||||||
|
|
||||||
return decipher.update(text, 'hex', 'utf-8') + decipher.final('utf-8');
|
return decipher.update(text, 'hex', 'utf-8') + decipher.final('utf-8');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue