Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e0219ff21f | |||
|
|
bc7fa845ed | ||
|
|
5ee043e597 | ||
|
|
9c52217ca2 | ||
|
|
5160cfa416 |
19
.github/workflows/lint.yml
vendored
19
.github/workflows/lint.yml
vendored
@@ -1,19 +0,0 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 15.x
|
||||
- run: npm ci
|
||||
- run: npm run lint --if-present
|
||||
@@ -120,3 +120,6 @@ Returns payload `object`.
|
||||
- HS256
|
||||
- HS384
|
||||
- HS512
|
||||
- RS256
|
||||
- RS384
|
||||
- RS512
|
||||
2
index.d.ts
vendored
2
index.d.ts
vendored
@@ -37,7 +37,7 @@ declare class JWT {
|
||||
}
|
||||
declare const _exports: JWT
|
||||
|
||||
type JWTAlgorithm = 'ES256' | 'ES384' | 'ES512' | 'HS256' | 'HS384' | 'HS512'
|
||||
type JWTAlgorithm = 'ES256' | 'ES384' | 'ES512' | 'HS256' | 'HS384' | 'HS512' | 'RS256' | 'RS384' | 'RS512'
|
||||
|
||||
type JWTSignOptions = {
|
||||
algorithm?: JWTAlgorithm,
|
||||
|
||||
7
index.js
7
index.js
@@ -9,7 +9,7 @@ class Base64URL {
|
||||
|
||||
class JWT {
|
||||
constructor() {
|
||||
if (!crypto || !crypto.subtle)
|
||||
if (typeof crypto === 'undefined' || !crypto.subtle)
|
||||
throw new Error('Crypto not supported!')
|
||||
this.algorithms = {
|
||||
ES256: { name: 'ECDSA', namedCurve: 'P-256', hash: { name: 'SHA-256' } },
|
||||
@@ -17,7 +17,10 @@ class JWT {
|
||||
ES512: { name: 'ECDSA', namedCurve: 'P-512', hash: { name: 'SHA-512' } },
|
||||
HS256: { name: 'HMAC', hash: { name: 'SHA-256' } },
|
||||
HS384: { name: 'HMAC', hash: { name: 'SHA-384' } },
|
||||
HS512: { name: 'HMAC', hash: { name: 'SHA-512' } }
|
||||
HS512: { name: 'HMAC', hash: { name: 'SHA-512' } },
|
||||
RS256: { name: 'RSASSA-PKCS1-v1_5', hash: { name: 'SHA-256' } },
|
||||
RS384: { name: 'RSASSA-PKCS1-v1_5', hash: { name: 'SHA-384' } },
|
||||
RS512: { name: 'RSASSA-PKCS1-v1_5', hash: { name: 'SHA-512' } },
|
||||
}
|
||||
}
|
||||
_utf8ToUint8Array(str) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tsndr/cloudflare-worker-jwt",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.6",
|
||||
"description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user