{"id":"metrik-tech/jwt","name":"jwt","scope":"metrik-tech","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.2.1","latest":"0.2.1","versions":["0.1.0","0.1.1","0.2.0","0.2.1"],"license":"GPL-3.0","licenseRating":"unsafe","licenseCaveats":["Strong copyleft: shipping this in your game plausibly requires releasing your game's entire source under GPL-3.0. Not recommended for closed-source projects."],"licenseVerified":false,"dependencies":{},"integrity":"0bb6537af3b8d2e69edaeeb788fee18366f9db8165fcde0c3caecd8916480857","likes":0,"downloads":0,"install":"forest install metrik-tech/jwt","url":"https://forest.dev/p/roblox/metrik-tech/jwt","files":"https://api.forest.dev/ai/package/roblox/metrik-tech/jwt/files","readme":"# `jwt-luau`\n\nLuaU/`roblox-ts` fork of [x25/luajwt](https://github.com/x25/luajwt) that works with Roblox. Currently only supports symmetric HS(256/384/512).\n\nWrote this to verify Metrik tokens in our SDK. This is not a full implementation of the JWT spec, but it should be enough for most use cases.\n\n## Installation\n\n### via `roblox-ts`\n```bash\nnpm install @rbxts/jwt\n```\n### via Wally\n```\njwt = \"metrik-tech/jwt@0.2.1\"\n```\n### via `rbxm`/`rbxmx`\nDownload from Releases page. Latest release can be found [here](\n    https://github.com/metrik-tech/jwt-luau/releases/latest\n)\n\n## Usage\n\n### TypeScript\n```ts\nimport { decode, verify, sign } from \"@rbxts/jwt\";\n\n// sign jwt\nconst jwt = sign({ foo: \"bar\", exp: 1893481200 }, \"secret\");\n\n// sign jwt with algorithm\nconst hs483jwt = sign({ foo: \"bar\", exp: 1893481200 }, \"secret\", \"HS384\");\n\n// verify jwt\nconst isValid = verify(jwt, \"secret\");\n\n// verify jwt and throw\nconst throwIfInvalid = verify(jwt, \"secret\", true);\n\n// decode jwt\nconst decoded = decode(jwt);\n\n// decode jwt with verification (throws)\nconst validDecoded = decode(jwt, \"secret\", true)\n```\n\n### Lua\n```lua\nlocal Jwt = require(path.to.jwt)\n\n-- sign jwt\nlocal jwt = Jwt.sign({ foo = \"bar\", exp = 1893481200 }, \"secret\")\n\n-- sign jwt with algorithm\nlocal hs384jwt = Jwt.sign({ foo = \"bar\", exp = 1893481200 }, \"secret\", \"HS384\")\n\n-- verify jwt\nlocal isValid = Jwt.verify(jwt, \"secret\")\n\n-- verify jwt and throw\nlocal throwIfInvalid = Jwt.verify(jwt, \"secret\", true)\n\n-- decode jwt\nlocal decoded = Jwt.decode(jwt)\n\n-- decode jwt with verification (throws)\nlocal validDecoded = decode(jwt, \"secret\", true)\n```\n\n\n\n\n","readmeTruncated":false}