From 08e837bf5559e9680fc8cb99bd05b93f8eb2cac5 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 12 Aug 2021 20:09:35 +0200 Subject: :sparkles: api --- api/src/test/jwt2.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 api/src/test/jwt2.ts (limited to 'api/src/test/jwt2.ts') diff --git a/api/src/test/jwt2.ts b/api/src/test/jwt2.ts new file mode 100644 index 00000000..e231233d --- /dev/null +++ b/api/src/test/jwt2.ts @@ -0,0 +1,13 @@ +import jwt from "jsonwebtoken"; + +const algorithm = "HS256"; +const iat = Math.floor(Date.now() / 1000); + +// @ts-ignore +const token = jwt.sign({ id: "311129357362135041" }, "secret", { + algorithm, +}); +console.log(token); + +const decoded = jwt.verify(token, "secret", { algorithms: [algorithm] }); +console.log(decoded); -- cgit 1.5.1