Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vasilevvitalii/vv-jwt
https://github.com/vasilevvitalii/vv-jwt
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/vasilevvitalii/vv-jwt
- Owner: VasilevVitalii
- License: mit
- Created: 2021-11-25T13:19:18.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-01T10:21:33.000Z (over 1 year ago)
- Last Synced: 2024-11-07T09:53:29.255Z (about 2 months ago)
- Language: TypeScript
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vv-jwt, simple creator and checker jwt
## License
*MIT*
## Install
```
npm i vv-jwt
```
## Example
```typescript
import { Create as CreateJwtManager } from 'vv-jwt'
const jwtManager = CreateJwtManager({
secret: 'my secret',
issDefault: 'my application',
expDelta: 1000 * 60 * 60 *24, //create tokens with one day life
})
// create token
const j = jwtManager.create()
if (j.error) {
console.error(j.error)
} else {
console.log(`token - ${j.jwtString}`)
}// check token
const c = jwtManager.check(j.jwtString)
if (c.deny) {
console.log(`NO SUCCESS CHECK TOKEN: ${c.deny.code} - ${c.deny.message}`)
} else {
console.log(c.jwt)
}
```