1
0

Compare commits

...

4 Commits

Author SHA1 Message Date
a8f95f1c6d 2.2.2 2023-08-25 16:01:57 +02:00
Tom Lokhorst
b2886c0778 Allow array in Audience 2023-08-25 16:00:30 +02:00
76b7fcef27 2.2.1 2023-02-02 16:13:50 +01:00
3b5d8bcde8 hotfix 2023-02-02 16:13:28 +01:00
3 changed files with 6 additions and 6 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@tsndr/cloudflare-worker-jwt",
"version": "2.2.0",
"version": "2.2.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@tsndr/cloudflare-worker-jwt",
"version": "2.2.0",
"version": "2.2.2",
"license": "MIT",
"devDependencies": {
"@cloudflare/workers-types": "^3.13.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@tsndr/cloudflare-worker-jwt",
"version": "2.2.0",
"version": "2.2.2",
"description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker",
"main": "index.js",
"types": "index.d.ts",

View File

@@ -33,7 +33,7 @@ export interface JwtHeader {
* @typedef JwtPayload
* @prop {string} [iss] Issuer
* @prop {string} [sub] Subject
* @prop {string} [aud] Audience
* @prop {string | string[]} [aud] Audience
* @prop {string} [exp] Expiration Time
* @prop {string} [nbf] Not Before
* @prop {string} [iat] Issued At
@@ -47,7 +47,7 @@ export interface JwtPayload {
sub?: string
/** Audience */
aud?: string
aud?: string | string[]
/** Expiration Time */
exp?: number
@@ -283,7 +283,7 @@ export async function verify(token: string, secret: string | JsonWebKey, options
keyFormat = 'jwk';
keyData = secret;
} else if (typeof secret === 'string' && secret.startsWith('-----BEGIN')) {
keyFormat = 'pkcs8'
keyFormat = 'spki'
keyData = _str2ab(secret.replace(/-----BEGIN.*?-----/g, '').replace(/-----END.*?-----/g, '').replace(/\s/g, ''))
} else
keyData = _utf8ToUint8Array(secret)