mirror of
https://github.com/fosrl/pangolin.git
synced 2025-05-12 21:30:35 +01:00
12 lines
410 B
TypeScript
12 lines
410 B
TypeScript
import CryptoJS from "crypto-js";
|
|
|
|
export function encrypt(value: string, key: string): string {
|
|
const ciphertext = CryptoJS.AES.encrypt(value, key).toString();
|
|
return ciphertext;
|
|
}
|
|
|
|
export function decrypt(encryptedValue: string, key: string): string {
|
|
const bytes = CryptoJS.AES.decrypt(encryptedValue, key);
|
|
const originalText = bytes.toString(CryptoJS.enc.Utf8);
|
|
return originalText;
|
|
}
|