1
0

Compare commits

..

2 Commits

Author SHA1 Message Date
0a3a9b58d1 Updated readme 2021-02-04 12:42:47 +01:00
959a7c9490 Updated readme 2021-02-04 12:42:33 +01:00
2 changed files with 19 additions and 4 deletions

View File

@@ -29,33 +29,48 @@ const payload = jwt.decode(token)
Signs a payload and returns the token. Signs a payload and returns the token.
`payload` `payload`
Can be an object, buffer or a string.
The payload object.
`secret` `secret`
A string which is used to sign the payload. A string which is used to sign the payload.
`algorithm` (optional, default: `HS256`) `algorithm` (optional, default: `HS256`)
The algorithm used to sign the payload, possible values: `HS256`(default) or `HS512`
The algorithm used to sign the payload, possible values: `HS256` or `HS512`
### `jwt.verify(token, secret, [algorithm])` ### `jwt.verify(token, secret, [algorithm])`
Verifies the integrity of the token and returns a boolean value. Verifies the integrity of the token and returns a boolean value.
`token` `token`
The token string generated by `jwt.sign()`. The token string generated by `jwt.sign()`.
`secret` `secret`
A string which is used to sign the payload. A string which is used to sign the payload.
`algorithm` (optional, default: `HS256`) `algorithm` (optional, default: `HS256`)
The algorithm used to sign the payload, possible values: `HS256`(default) or `HS512`
The algorithm used to sign the payload, possible values: `HS256` or `HS512`
### `jwt.decode(token)` ### `jwt.decode(token)`
Returns the payload without verifying the integrity of the token. Returns the payload without verifying the integrity of the token.
`token` `token`
The token string generated by `jwt.sign()`. The token string generated by `jwt.sign()`.

View File

@@ -1,6 +1,6 @@
{ {
"name": "@tsndr/cloudflare-worker-jwt", "name": "@tsndr/cloudflare-worker-jwt",
"version": "1.0.1", "version": "1.0.2",
"description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker", "description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {