mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
14 lines
316 B
TypeScript
14 lines
316 B
TypeScript
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);
|