https://github.com/sugamkuber/jwt-lite
A lightweight npm library to handle json web tokens
https://github.com/sugamkuber/jwt-lite
auth javascript json-web-token jwt jwt-authentication jwt-token next type-safe typescript
Last synced: 3 months ago
JSON representation
A lightweight npm library to handle json web tokens
- Host: GitHub
- URL: https://github.com/sugamkuber/jwt-lite
- Owner: SugamKuber
- License: mit
- Created: 2024-07-23T14:58:19.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-07-25T08:13:41.000Z (11 months ago)
- Last Synced: 2025-03-20T20:14:01.724Z (4 months ago)
- Topics: auth, javascript, json-web-token, jwt, jwt-authentication, jwt-token, next, type-safe, typescript
- Language: TypeScript
- Homepage: https://jwt-lite.vercel.app/
- Size: 118 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# jwt-lite
```
npm i jwt-lite-2024
```
jwt-lite is a lightweight npm library for handling JWT tokens in JavaScript and TypeScript applications. It provides simple methods for encoding, decoding, and validating JWT tokens with a focus on ease of use.---
### [NPM LINK](https://www.npmjs.com/package/jwt-lite-2024)
- The above source code is in "main" branch
### [DEMO LINK](https://jwt-lite.vercel.app/)
- The above source code is in "demo" branch## Functions
1. *encode()*: Creates a new JWT token by combining a unique identifier, custom payload, and optional parameters, returning a signed string token.
```
encode(id, payload, options):string
```
2. *decode()*: Parses a JWT token string, verifies its signature, and returns the decoded payload along with expiration information, throwing an error if the token is invalid or expired.
```
decode(token):DecodedJwt
```
3. *validate()*: Checks the validity of a JWT token, including its signature and expiration time, returning a boolean indicating whether the token is currently valid and usable.
```
validate(token):boolean
```---
Made with ♥ by [Sugam Kuber](https://www.linkedin.com/in/sugamkuber/)