- | output |
---|---|
bun | |
deno | |
node |
Last active
December 21, 2023 07:15
-
-
Save JLarky/0d61cf5c4e787a2849db7fb4726b4716 to your computer and use it in GitHub Desktop.
This code doesn't work in Deno and Bun ;(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { V3 } from "paseto"; // or "npm:paseto"; | |
const key = await V3.generateKey("local", { format: "paserk" }); | |
console.assert(key.length === 52); | |
console.log(key); | |
const obj = await V3.encrypt({ sub: "johndoe" }, key); | |
console.log(obj); | |
const payload = await V3.decrypt(obj, key); | |
console.assert(payload.sub === "johndoe"); | |
console.log(payload); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment