Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tsndr/cloudflare-worker-jwt

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsndr/cloudflare-worker-jwt - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

.github/workflows/lint.yml

9

package.json
{
"name": "@tsndr/cloudflare-worker-jwt",
"version": "1.0.7",
"version": "1.0.8",
"description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "tslint index.js"
},

@@ -25,3 +25,6 @@ "repository": {

},
"homepage": "https://github.com/tsndr/cloudflare-worker-jwt#readme"
"homepage": "https://github.com/tsndr/cloudflare-worker-jwt#readme",
"devDependencies": {
"tslint": "^6.1.3"
}
}

@@ -7,5 +7,11 @@ # Cloudflare Worker JWT

- [Install](#install)
- [Usage](#usage)
- [Install](#install)
## Install
```
npm i @tsndr/cloudflare-worker-jwt
```
## Usage

@@ -29,2 +35,4 @@

<hr>
### `jwt.sign(payload, secret, [algorithm])`

@@ -34,18 +42,15 @@

#### Arguments
`payload`
Argument | Type | Satus | Default | Description
----------- | -------- | -------- | ------- | -----------
`payload` | `object` | required | - | The payload object
`secret` | `string` | required | - | A string which is used to sign the payload.
`algorithm` | `string` | optional | `HS256` | The algorithm used to sign the payload, possible values: `HS256` or `HS512`
The payload object.
#### `return`
returns token as a `string`
<hr>
`secret`
A string which is used to sign the payload.
`algorithm` (optional, default: `HS256`)
The algorithm used to sign the payload, possible values: `HS256` or `HS512`
### `jwt.verify(token, secret, [algorithm])`

@@ -55,17 +60,13 @@

Argument | Type | Satus | Default | Description
----------- | -------- | -------- | ------- | -----------
`token` | `string` | required | - | The token string generated by `jwt.sign()`.
`secret` | `string` | required | - | The string which was used to sign the payload.
`algorithm` | `string` | optional | `HS256` | The algorithm used to sign the payload, possible values: `HS256` or `HS512`
`token`
#### `return`
returns `boolean`
The token string generated by `jwt.sign()`.
<hr>
`secret`
A string which is used to sign the payload.
`algorithm` (optional, default: `HS256`)
The algorithm used to sign the payload, possible values: `HS256` or `HS512`
### `jwt.decode(token)`

@@ -75,12 +76,7 @@

Argument | Type | Satus | Default | Description
----------- | -------- | -------- | ------- | -----------
`token` | `string` | required | - | The token string generated by `jwt.sign()`.
`token`
The token string generated by `jwt.sign()`.
## Install
```
npm i @tsndr/cloudflare-worker-jwt
```
#### `return`
returns payload `object`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc