Created
December 21, 2023 07:10
-
-
Save JLarky/70ff6a86ae20c7dc4541572919963121 to your computer and use it in GitHub Desktop.
This code doesn't work in Deno and
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.log(payload); | |
console.assert(payload.sub === "johndoe"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment