Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c247675832 | |||
| 0d3c7d621a | |||
| 62479197f5 | |||
| 0a3a9b58d1 | |||
| 959a7c9490 | |||
| e7be1ed840 | |||
| f2adb27218 |
30
.github/workflows/npm-publish.yml
vendored
Normal file
30
.github/workflows/npm-publish.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: Publish NPM Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-npm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm publish --access public
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||||
|
|
||||||
|
publish-gpr:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://npm.pkg.github.com/
|
||||||
|
- run: npm publish --access public
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
22
README.md
22
README.md
@@ -29,34 +29,48 @@ const payload = jwt.decode(token)
|
|||||||
|
|
||||||
Signs a payload and returns the token.
|
Signs a payload and returns the token.
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
`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()`.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tsndr/cloudflare-worker-jwt",
|
"name": "@tsndr/cloudflare-worker-jwt",
|
||||||
"version": "1.0.0",
|
"version": "1.0.4",
|
||||||
"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": {
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"cloudflare-worker"
|
"cloudflare-worker"
|
||||||
],
|
],
|
||||||
"author": "Tobias Schneider",
|
"author": "Tobias Schneider",
|
||||||
"license": "ISC",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/tsndr/cloudflare-worker-jwt/issues"
|
"url": "https://github.com/tsndr/cloudflare-worker-jwt/issues"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user