Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
fe1baf46b4
|
|||
|
81f9eafd86
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@tsndr/cloudflare-worker-jwt",
|
"name": "@tsndr/cloudflare-worker-jwt",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@tsndr/cloudflare-worker-jwt",
|
"name": "@tsndr/cloudflare-worker-jwt",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cloudflare/workers-types": "^3.13.0",
|
"@cloudflare/workers-types": "^3.13.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tsndr/cloudflare-worker-jwt",
|
"name": "@tsndr/cloudflare-worker-jwt",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"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",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
|
|||||||
16
src/index.ts
16
src/index.ts
@@ -5,12 +5,12 @@ if (typeof crypto === 'undefined' || !crypto.subtle)
|
|||||||
* @typedef JwtAlgorithm
|
* @typedef JwtAlgorithm
|
||||||
* @type {'ES256'|'ES384'|'ES512'|'HS256'|'HS384'|'HS512'|'RS256'|'RS384'|'RS512'}
|
* @type {'ES256'|'ES384'|'ES512'|'HS256'|'HS384'|'HS512'|'RS256'|'RS384'|'RS512'}
|
||||||
*/
|
*/
|
||||||
type JwtAlgorithm = 'ES256'|'ES384'|'ES512'|'HS256'|'HS384'|'HS512'|'RS256'|'RS384'|'RS512'
|
export type JwtAlgorithm = 'ES256'|'ES384'|'ES512'|'HS256'|'HS384'|'HS512'|'RS256'|'RS384'|'RS512'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef JwtAlgorithms
|
* @typedef JwtAlgorithms
|
||||||
*/
|
*/
|
||||||
interface JwtAlgorithms {
|
export interface JwtAlgorithms {
|
||||||
[key: string]: SubtleCryptoImportKeyAlgorithm
|
[key: string]: SubtleCryptoImportKeyAlgorithm
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ interface JwtAlgorithms {
|
|||||||
* @typedef JwtHeader
|
* @typedef JwtHeader
|
||||||
* @prop {string} [typ] Type
|
* @prop {string} [typ] Type
|
||||||
*/
|
*/
|
||||||
interface JwtHeader {
|
export interface JwtHeader {
|
||||||
/**
|
/**
|
||||||
* Type (default: `"JWT"`)
|
* Type (default: `"JWT"`)
|
||||||
*
|
*
|
||||||
@@ -39,7 +39,7 @@ interface JwtHeader {
|
|||||||
* @prop {string} [iat] Issued At
|
* @prop {string} [iat] Issued At
|
||||||
* @prop {string} [jti] JWT ID
|
* @prop {string} [jti] JWT ID
|
||||||
*/
|
*/
|
||||||
interface JwtPayload {
|
export interface JwtPayload {
|
||||||
/** Issuer */
|
/** Issuer */
|
||||||
iss?: string
|
iss?: string
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ interface JwtPayload {
|
|||||||
* @typedef JwtOptions
|
* @typedef JwtOptions
|
||||||
* @prop {JwtAlgorithm | string} algorithm
|
* @prop {JwtAlgorithm | string} algorithm
|
||||||
*/
|
*/
|
||||||
interface JwtOptions {
|
export interface JwtOptions {
|
||||||
algorithm?: JwtAlgorithm | string
|
algorithm?: JwtAlgorithm | string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ interface JwtOptions {
|
|||||||
* @extends JwtOptions
|
* @extends JwtOptions
|
||||||
* @prop {JwtHeader} [header]
|
* @prop {JwtHeader} [header]
|
||||||
*/
|
*/
|
||||||
interface JwtSignOptions extends JwtOptions {
|
export interface JwtSignOptions extends JwtOptions {
|
||||||
header?: JwtHeader
|
header?: JwtHeader
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ interface JwtSignOptions extends JwtOptions {
|
|||||||
* @extends JwtOptions
|
* @extends JwtOptions
|
||||||
* @prop {boolean} [throwError=false] If `true` throw error if checks fail. (default: `false`)
|
* @prop {boolean} [throwError=false] If `true` throw error if checks fail. (default: `false`)
|
||||||
*/
|
*/
|
||||||
interface JwtVerifyOptions extends JwtOptions {
|
export interface JwtVerifyOptions extends JwtOptions {
|
||||||
/**
|
/**
|
||||||
* If `true` throw error if checks fail. (default: `false`)
|
* If `true` throw error if checks fail. (default: `false`)
|
||||||
*
|
*
|
||||||
@@ -100,7 +100,7 @@ interface JwtVerifyOptions extends JwtOptions {
|
|||||||
* @prop {JwtHeader} header
|
* @prop {JwtHeader} header
|
||||||
* @prop {JwtPayload} payload
|
* @prop {JwtPayload} payload
|
||||||
*/
|
*/
|
||||||
interface JwtData {
|
export interface JwtData {
|
||||||
header: JwtHeader
|
header: JwtHeader
|
||||||
payload: JwtPayload
|
payload: JwtPayload
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user