UNPKG

svelte-kit-cookie-session-patch

Version:

⚒️ Encrypted 'stateless' cookie sessions for SvelteKit

10 lines (9 loc) 465 B
import { makeStringDecrypterSync, makeStringEncrypterSync, } from "./make-crypter.js"; const encryptString = makeStringEncrypterSync({ algorithm: "aes-256-gcm" }); const decryptString = makeStringDecrypterSync({ algorithm: "aes-256-gcm" }); export function encrypt(encryptionKey) { return (text) => encryptString(text, encryptionKey); } export function decrypt(encryptionKey) { return (encrypted_string) => decryptString(encrypted_string, encryptionKey); }