Comparing version 5.10.0 to 6.0.0
@@ -31,4 +31,4 @@ export { compactDecrypt } from './jwe/compact/decrypt'; | ||
export { createLocalJWKSet } from './jwks/local'; | ||
export { createRemoteJWKSet, jwksCache, experimental_jwksCache } from './jwks/remote'; | ||
export type { RemoteJWKSetOptions, JWKSCacheInput, ExportedJWKSCache } from './jwks/remote'; | ||
export { createRemoteJWKSet, jwksCache } from './jwks/remote'; | ||
export type { RemoteJWKSetOptions, JWKSCacheInput, ExportedJWKSCache, customFetch, FetchImplementation, } from './jwks/remote'; | ||
export { UnsecuredJWT } from './jwt/unsecured'; | ||
@@ -38,3 +38,3 @@ export type { UnsecuredResult } from './jwt/unsecured'; | ||
export { importSPKI, importPKCS8, importX509, importJWK } from './key/import'; | ||
export type { PEMImportOptions } from './key/import'; | ||
export type { KeyImportOptions } from './key/import'; | ||
export { decodeProtectedHeader } from './util/decode_protected_header'; | ||
@@ -49,3 +49,3 @@ export { decodeJwt } from './util/decode_jwt'; | ||
export * as base64url from './util/base64url'; | ||
export type { KeyLike, JWK, JWKParameters, JWK_OKP_Public, JWK_OKP_Private, JWK_EC_Public, JWK_EC_Private, JWK_RSA_Public, JWK_RSA_Private, JWK_oct, FlattenedJWSInput, GeneralJWSInput, FlattenedJWS, GeneralJWS, JoseHeaderParameters, JWSHeaderParameters, JWEKeyManagementHeaderParameters, FlattenedJWE, GeneralJWE, JWEHeaderParameters, CritOption, DecryptOptions, EncryptOptions, JWTClaimVerificationOptions, VerifyOptions, SignOptions, JWTPayload, FlattenedDecryptResult, GeneralDecryptResult, CompactDecryptResult, FlattenedVerifyResult, GeneralVerifyResult, CompactVerifyResult, JWTVerifyResult, JWTDecryptResult, ResolvedKey, CompactJWEHeaderParameters, CompactJWSHeaderParameters, JWTHeaderParameters, JSONWebKeySet, CryptoRuntime, GetKeyFunction, } from './types'; | ||
export { default as cryptoRuntime } from './util/runtime'; | ||
export type { CompactDecryptResult, CompactJWEHeaderParameters, CompactJWSHeaderParameters, CompactVerifyResult, CritOption, CryptoKey, DecryptOptions, EncryptOptions, FlattenedDecryptResult, FlattenedJWE, FlattenedJWS, FlattenedJWSInput, FlattenedVerifyResult, GeneralDecryptResult, GeneralJWE, GeneralJWS, GeneralJWSInput, GeneralVerifyResult, GetKeyFunction, JoseHeaderParameters, JSONWebKeySet, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWK_EC_Private, JWK_EC_Public, JWK_oct, JWK_OKP_Private, JWK_OKP_Public, JWK_RSA_Private, JWK_RSA_Public, JWK, JWKParameters, JWSHeaderParameters, JWTClaimVerificationOptions, JWTDecryptResult, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject, ResolvedKey, SignOptions, VerifyOptions, } from './types'; | ||
export declare const cryptoRuntime = "WebCryptoAPI"; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, DecryptOptions, CompactJWEHeaderParameters, GetKeyFunction, FlattenedJWE, CompactDecryptResult, ResolvedKey } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -6,3 +6,3 @@ * Interface for Compact JWE Decryption dynamic key resolution. No token components have been | ||
*/ | ||
export interface CompactDecryptGetKey extends GetKeyFunction<CompactJWEHeaderParameters, FlattenedJWE> { | ||
export interface CompactDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> { | ||
} | ||
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
export declare function compactDecrypt(jwe: string | Uint8Array, key: KeyLike | Uint8Array, options?: DecryptOptions): Promise<CompactDecryptResult>; | ||
export declare function compactDecrypt(jwe: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.DecryptOptions): Promise<types.CompactDecryptResult>; | ||
/** | ||
@@ -28,2 +28,2 @@ * @param jwe Compact JWE. | ||
*/ | ||
export declare function compactDecrypt<KeyLikeType extends KeyLike = KeyLike>(jwe: string | Uint8Array, getKey: CompactDecryptGetKey, options?: DecryptOptions): Promise<CompactDecryptResult & ResolvedKey<KeyLikeType>>; | ||
export declare function compactDecrypt(jwe: string | Uint8Array, getKey: CompactDecryptGetKey, options?: types.DecryptOptions): Promise<types.CompactDecryptResult & types.ResolvedKey>; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, JWEKeyManagementHeaderParameters, CompactJWEHeaderParameters, EncryptOptions } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -38,3 +38,3 @@ * The CompactEncrypt class is used to build and encrypt Compact JWE strings. | ||
*/ | ||
setProtectedHeader(protectedHeader: CompactJWEHeaderParameters): this; | ||
setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this; | ||
/** | ||
@@ -47,3 +47,3 @@ * Sets the JWE Key Management parameters to be used when encrypting the Content Encryption Key. | ||
*/ | ||
setKeyManagementParameters(parameters: JWEKeyManagementHeaderParameters): this; | ||
setKeyManagementParameters(parameters: types.JWEKeyManagementHeaderParameters): this; | ||
/** | ||
@@ -56,3 +56,3 @@ * Encrypts and resolves the value of the Compact JWE string. | ||
*/ | ||
encrypt(key: KeyLike | Uint8Array, options?: EncryptOptions): Promise<string>; | ||
encrypt(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.EncryptOptions): Promise<string>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { FlattenedDecryptResult, KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, GetKeyFunction, ResolvedKey } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -6,3 +6,3 @@ * Interface for Flattened JWE Decryption dynamic key resolution. No token components have been | ||
*/ | ||
export interface FlattenedDecryptGetKey extends GetKeyFunction<JWEHeaderParameters | undefined, FlattenedJWE> { | ||
export interface FlattenedDecryptGetKey extends types.GetKeyFunction<types.JWEHeaderParameters | undefined, types.FlattenedJWE> { | ||
} | ||
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
export declare function flattenedDecrypt(jwe: FlattenedJWE, key: KeyLike | Uint8Array, options?: DecryptOptions): Promise<FlattenedDecryptResult>; | ||
export declare function flattenedDecrypt(jwe: types.FlattenedJWE, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.DecryptOptions): Promise<types.FlattenedDecryptResult>; | ||
/** | ||
@@ -28,2 +28,2 @@ * @param jwe Flattened JWE. | ||
*/ | ||
export declare function flattenedDecrypt<KeyLikeType extends KeyLike = KeyLike>(jwe: FlattenedJWE, getKey: FlattenedDecryptGetKey, options?: DecryptOptions): Promise<FlattenedDecryptResult & ResolvedKey<KeyLikeType>>; | ||
export declare function flattenedDecrypt(jwe: types.FlattenedJWE, getKey: FlattenedDecryptGetKey, options?: types.DecryptOptions): Promise<types.FlattenedDecryptResult & types.ResolvedKey>; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, FlattenedJWE, JWEHeaderParameters, JWEKeyManagementHeaderParameters, EncryptOptions } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -28,3 +28,3 @@ * The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects. | ||
*/ | ||
setKeyManagementParameters(parameters: JWEKeyManagementHeaderParameters): this; | ||
setKeyManagementParameters(parameters: types.JWEKeyManagementHeaderParameters): this; | ||
/** | ||
@@ -35,3 +35,3 @@ * Sets the JWE Protected Header on the FlattenedEncrypt object. | ||
*/ | ||
setProtectedHeader(protectedHeader: JWEHeaderParameters): this; | ||
setProtectedHeader(protectedHeader: types.JWEHeaderParameters): this; | ||
/** | ||
@@ -42,3 +42,3 @@ * Sets the JWE Shared Unprotected Header on the FlattenedEncrypt object. | ||
*/ | ||
setSharedUnprotectedHeader(sharedUnprotectedHeader: JWEHeaderParameters): this; | ||
setSharedUnprotectedHeader(sharedUnprotectedHeader: types.JWEHeaderParameters): this; | ||
/** | ||
@@ -49,3 +49,3 @@ * Sets the JWE Per-Recipient Unprotected Header on the FlattenedEncrypt object. | ||
*/ | ||
setUnprotectedHeader(unprotectedHeader: JWEHeaderParameters): this; | ||
setUnprotectedHeader(unprotectedHeader: types.JWEHeaderParameters): this; | ||
/** | ||
@@ -84,3 +84,3 @@ * Sets the Additional Authenticated Data on the FlattenedEncrypt object. | ||
*/ | ||
encrypt(key: KeyLike | Uint8Array, options?: EncryptOptions): Promise<FlattenedJWE>; | ||
encrypt(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.EncryptOptions): Promise<types.FlattenedJWE>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, GeneralJWE, GeneralDecryptResult, ResolvedKey } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -6,3 +6,3 @@ * Interface for General JWE Decryption dynamic key resolution. No token components have been | ||
*/ | ||
export interface GeneralDecryptGetKey extends GetKeyFunction<JWEHeaderParameters, FlattenedJWE> { | ||
export interface GeneralDecryptGetKey extends types.GetKeyFunction<types.JWEHeaderParameters, types.FlattenedJWE> { | ||
} | ||
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
export declare function generalDecrypt(jwe: GeneralJWE, key: KeyLike | Uint8Array, options?: DecryptOptions): Promise<GeneralDecryptResult>; | ||
export declare function generalDecrypt(jwe: types.GeneralJWE, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.DecryptOptions): Promise<types.GeneralDecryptResult>; | ||
/** | ||
@@ -28,2 +28,2 @@ * @param jwe General JWE. | ||
*/ | ||
export declare function generalDecrypt<KeyLikeType extends KeyLike = KeyLike>(jwe: GeneralJWE, getKey: GeneralDecryptGetKey, options?: DecryptOptions): Promise<GeneralDecryptResult & ResolvedKey<KeyLikeType>>; | ||
export declare function generalDecrypt(jwe: types.GeneralJWE, getKey: GeneralDecryptGetKey, options?: types.DecryptOptions): Promise<types.GeneralDecryptResult & types.ResolvedKey>; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, GeneralJWE, JWEHeaderParameters, CritOption } from '../../types'; | ||
import type * as types from '../../types'; | ||
export interface Recipient { | ||
@@ -8,7 +8,7 @@ /** | ||
*/ | ||
setUnprotectedHeader(unprotectedHeader: JWEHeaderParameters): Recipient; | ||
setUnprotectedHeader(unprotectedHeader: types.JWEHeaderParameters): Recipient; | ||
/** A shorthand for calling addRecipient() on the enclosing GeneralEncrypt instance */ | ||
addRecipient(...args: Parameters<GeneralEncrypt['addRecipient']>): Recipient; | ||
/** A shorthand for calling encrypt() on the enclosing GeneralEncrypt instance */ | ||
encrypt(...args: Parameters<GeneralEncrypt['encrypt']>): Promise<GeneralJWE>; | ||
encrypt(...args: Parameters<GeneralEncrypt['encrypt']>): Promise<types.GeneralJWE>; | ||
/** Returns the enclosing GeneralEncrypt */ | ||
@@ -39,3 +39,3 @@ done(): GeneralEncrypt; | ||
*/ | ||
addRecipient(key: KeyLike | Uint8Array, options?: CritOption): Recipient; | ||
addRecipient(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.CritOption): Recipient; | ||
/** | ||
@@ -46,3 +46,3 @@ * Sets the JWE Protected Header on the GeneralEncrypt object. | ||
*/ | ||
setProtectedHeader(protectedHeader: JWEHeaderParameters): this; | ||
setProtectedHeader(protectedHeader: types.JWEHeaderParameters): this; | ||
/** | ||
@@ -53,3 +53,3 @@ * Sets the JWE Shared Unprotected Header on the GeneralEncrypt object. | ||
*/ | ||
setSharedUnprotectedHeader(sharedUnprotectedHeader: JWEHeaderParameters): this; | ||
setSharedUnprotectedHeader(sharedUnprotectedHeader: types.JWEHeaderParameters): this; | ||
/** | ||
@@ -62,3 +62,3 @@ * Sets the Additional Authenticated Data on the GeneralEncrypt object. | ||
/** Encrypts and resolves the value of the General JWE object. */ | ||
encrypt(): Promise<GeneralJWE>; | ||
encrypt(): Promise<types.GeneralJWE>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, FlattenedJWSInput, JWSHeaderParameters } from '../types'; | ||
import type * as types from '../types'; | ||
/** | ||
@@ -12,2 +12,2 @@ * EmbeddedJWK is an implementation of a GetKeyFunction intended to be used with the JWS/JWT verify | ||
*/ | ||
export declare function EmbeddedJWK<KeyLikeType extends KeyLike = KeyLike>(protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput): Promise<KeyLikeType>; | ||
export declare function EmbeddedJWK(protectedHeader?: types.JWSHeaderParameters, token?: types.FlattenedJWSInput): Promise<types.CryptoKey>; |
@@ -1,2 +0,2 @@ | ||
import type { JWK } from '../types'; | ||
import type * as types from '../types'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Calculates a base64url-encoded JSON Web Key (JWK) Thumbprint | ||
* | ||
* @param jwk JSON Web Key. | ||
* @param key Key to calculate the thumbprint for. | ||
* @param digestAlgorithm Digest Algorithm to use for calculating the thumbprint. Default is | ||
@@ -15,3 +15,3 @@ * "sha256". | ||
*/ | ||
export declare function calculateJwkThumbprint(jwk: JWK, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>; | ||
export declare function calculateJwkThumbprint(key: types.JWK | types.CryptoKey | types.KeyObject, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>; | ||
/** | ||
@@ -23,3 +23,3 @@ * Calculates a JSON Web Key (JWK) Thumbprint URI | ||
* | ||
* @param jwk JSON Web Key. | ||
* @param key Key to calculate the thumbprint for. | ||
* @param digestAlgorithm Digest Algorithm to use for calculating the thumbprint. Default is | ||
@@ -30,2 +30,2 @@ * "sha256". | ||
*/ | ||
export declare function calculateJwkThumbprintUri(jwk: JWK, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>; | ||
export declare function calculateJwkThumbprintUri(key: types.CryptoKey | types.KeyObject | types.JWK, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, JWSHeaderParameters, JSONWebKeySet, FlattenedJWSInput } from '../types'; | ||
import type * as types from '../types'; | ||
/** | ||
@@ -23,2 +23,2 @@ * Returns a function that resolves a JWS JOSE Header to a public key object from a locally stored, | ||
*/ | ||
export declare function createLocalJWKSet<KeyLikeType extends KeyLike = KeyLike>(jwks: JSONWebKeySet): (protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput) => Promise<KeyLikeType>; | ||
export declare function createLocalJWKSet(jwks: types.JSONWebKeySet): (protectedHeader?: types.JWSHeaderParameters, token?: types.FlattenedJWSInput) => Promise<types.CryptoKey>; |
@@ -1,3 +0,99 @@ | ||
import type { KeyLike, JWSHeaderParameters, FlattenedJWSInput, JSONWebKeySet } from '../types'; | ||
import type * as types from '../types'; | ||
/** | ||
* When passed to {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} this allows the resolver | ||
* to make use of advanced fetch configurations, HTTP Proxies, retry on network errors, etc. | ||
* | ||
* import ky from 'ky' | ||
* | ||
* let logRequest!: (request: Request) => void | ||
* let logResponse!: (request: Request, response: Response) => void | ||
* let logRetry!: (request: Request, error: Error, retryCount: number) => void | ||
* | ||
* const JWKS = jose.createRemoteJWKSet(url, { | ||
* [jose.customFetch]: (...args) => | ||
* ky(args[0], { | ||
* ...args[1], | ||
* hooks: { | ||
* beforeRequest: [ | ||
* (request) => { | ||
* logRequest(request) | ||
* }, | ||
* ], | ||
* beforeRetry: [ | ||
* ({ request, error, retryCount }) => { | ||
* logRetry(request, error, retryCount) | ||
* }, | ||
* ], | ||
* afterResponse: [ | ||
* (request, _, response) => { | ||
* logResponse(request, response) | ||
* }, | ||
* ], | ||
* }, | ||
* }), | ||
* }) | ||
* ``` | ||
* | ||
* import * as undici from 'undici' | ||
* | ||
* // see https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent | ||
* let envHttpProxyAgent = new undici.EnvHttpProxyAgent() | ||
* | ||
* // @ts-ignore | ||
* const JWKS = jose.createRemoteJWKSet(url, { | ||
* [jose.customFetch]: (...args) => { | ||
* // @ts-ignore | ||
* return undici.fetch(args[0], { ...args[1], dispatcher: envHttpProxyAgent }) // prettier-ignore | ||
* }, | ||
* }) | ||
* ``` | ||
* | ||
* import * as undici from 'undici' | ||
* | ||
* // see https://undici.nodejs.org/#/docs/api/RetryAgent | ||
* let retryAgent = new undici.RetryAgent(new undici.Agent(), { | ||
* statusCodes: [], | ||
* errorCodes: [ | ||
* 'ECONNRESET', | ||
* 'ECONNREFUSED', | ||
* 'ENOTFOUND', | ||
* 'ENETDOWN', | ||
* 'ENETUNREACH', | ||
* 'EHOSTDOWN', | ||
* 'UND_ERR_SOCKET', | ||
* ], | ||
* }) | ||
* | ||
* // @ts-ignore | ||
* const JWKS = jose.createRemoteJWKSet(url, { | ||
* [jose.customFetch]: (...args) => { | ||
* // @ts-ignore | ||
* return undici.fetch(args[0], { ...args[1], dispatcher: retryAgent }) // prettier-ignore | ||
* }, | ||
* }) | ||
* ``` | ||
* | ||
* import * as undici from 'undici' | ||
* | ||
* // see https://undici.nodejs.org/#/docs/api/MockAgent | ||
* let mockAgent = new undici.MockAgent() | ||
* mockAgent.disableNetConnect() | ||
* | ||
* // @ts-ignore | ||
* const JWKS = jose.createRemoteJWKSet(url, { | ||
* [jose.customFetch]: (...args) => { | ||
* // @ts-ignore | ||
* return undici.fetch(args[0], { ...args[1], dispatcher: mockAgent }) // prettier-ignore | ||
* }, | ||
* }) | ||
* ``` | ||
*/ | ||
export declare const customFetch: unique symbol; | ||
export type FetchImplementation = (url: string, options: { | ||
headers: Headers; | ||
method: 'GET'; | ||
redirect: 'manual'; | ||
signal: AbortSignal; | ||
}) => Promise<Response>; | ||
/** | ||
* DANGER ZONE - This option has security implications that must be understood, assessed for | ||
@@ -70,22 +166,11 @@ * applicability, and accepted before use. It is critical that the JSON Web Key Set cache only be | ||
cacheMaxAge?: number | typeof Infinity; | ||
/** | ||
* An instance of {@link https://nodejs.org/api/http.html#class-httpagent http.Agent} or | ||
* {@link https://nodejs.org/api/https.html#class-httpsagent https.Agent} to pass to the | ||
* {@link https://nodejs.org/api/http.html#httpgetoptions-callback http.get} or | ||
* {@link https://nodejs.org/api/https.html#httpsgetoptions-callback https.get} method's options. | ||
* Use when behind an http(s) proxy. This is a Node.js runtime specific option, it is ignored when | ||
* used outside of Node.js runtime. | ||
*/ | ||
agent?: any; | ||
/** | ||
* Headers to be sent with the HTTP request. Default is that `User-Agent: jose/v${version}` header | ||
* is added unless the runtime is a browser in which adding an explicit headers fetch | ||
* configuration would cause an unnecessary CORS preflight request. | ||
*/ | ||
/** Headers to be sent with the HTTP request. */ | ||
headers?: Record<string, string>; | ||
/** See {@link jwksCache}. */ | ||
[jwksCache]?: JWKSCacheInput; | ||
/** See {@link customFetch}. */ | ||
[customFetch]?: FetchImplementation; | ||
} | ||
export interface ExportedJWKSCache { | ||
jwks: JSONWebKeySet; | ||
jwks: types.JSONWebKeySet; | ||
uat: number; | ||
@@ -118,4 +203,4 @@ } | ||
*/ | ||
export declare function createRemoteJWKSet<KeyLikeType extends KeyLike = KeyLike>(url: URL, options?: RemoteJWKSetOptions): { | ||
(protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput): Promise<KeyLikeType>; | ||
export declare function createRemoteJWKSet(url: URL, options?: RemoteJWKSetOptions): { | ||
(protectedHeader?: types.JWSHeaderParameters, token?: types.FlattenedJWSInput): Promise<types.CryptoKey>; | ||
/** @ignore */ | ||
@@ -130,9 +215,3 @@ coolingDown: boolean; | ||
/** @ignore */ | ||
jwks: () => JSONWebKeySet | undefined; | ||
jwks: () => types.JSONWebKeySet | undefined; | ||
}; | ||
/** | ||
* @ignore | ||
* | ||
* @deprecated Use {@link jwksCache}. | ||
*/ | ||
export declare const experimental_jwksCache: symbol; |
@@ -1,2 +0,2 @@ | ||
import type { JWK, CompactJWSHeaderParameters, KeyLike, SignOptions } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -14,7 +14,7 @@ * The CompactSign class is used to build and sign Compact JWS strings. | ||
/** | ||
* Sets the JWS Protected Header on the Sign object. | ||
* Sets the JWS Protected Header on the CompactSign object. | ||
* | ||
* @param protectedHeader JWS Protected Header. | ||
*/ | ||
setProtectedHeader(protectedHeader: CompactJWSHeaderParameters): this; | ||
setProtectedHeader(protectedHeader: types.CompactJWSHeaderParameters): this; | ||
/** | ||
@@ -27,3 +27,3 @@ * Signs and resolves the value of the Compact JWS string. | ||
*/ | ||
sign(key: KeyLike | Uint8Array | JWK, options?: SignOptions): Promise<string>; | ||
sign(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Promise<string>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { JWK, CompactVerifyResult, FlattenedJWSInput, GenericGetKeyFunction, CompactJWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Interface for Compact JWS Verification dynamic key resolution. No token components have been | ||
*/ | ||
export interface CompactVerifyGetKey extends GenericGetKeyFunction<CompactJWSHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> { | ||
export interface CompactVerifyGetKey extends types.GenericGetKeyFunction<types.CompactJWSHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> { | ||
} | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
export declare function compactVerify(jws: string | Uint8Array, key: KeyLike | Uint8Array | JWK, options?: VerifyOptions): Promise<CompactVerifyResult>; | ||
export declare function compactVerify(jws: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.VerifyOptions): Promise<types.CompactVerifyResult>; | ||
/** | ||
@@ -30,2 +30,2 @@ * @param jws Compact JWS. | ||
*/ | ||
export declare function compactVerify<KeyLikeType extends KeyLike = KeyLike>(jws: string | Uint8Array, getKey: CompactVerifyGetKey, options?: VerifyOptions): Promise<CompactVerifyResult & ResolvedKey<KeyLikeType>>; | ||
export declare function compactVerify(jws: string | Uint8Array, getKey: CompactVerifyGetKey, options?: types.VerifyOptions): Promise<types.CompactVerifyResult & types.ResolvedKey>; |
@@ -1,2 +0,2 @@ | ||
import type { JWK, KeyLike, FlattenedJWS, JWSHeaderParameters, SignOptions } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -20,3 +20,3 @@ * The FlattenedSign class is used to build and sign Flattened JWS objects. | ||
*/ | ||
setProtectedHeader(protectedHeader: JWSHeaderParameters): this; | ||
setProtectedHeader(protectedHeader: types.JWSHeaderParameters): this; | ||
/** | ||
@@ -27,3 +27,3 @@ * Sets the JWS Unprotected Header on the FlattenedSign object. | ||
*/ | ||
setUnprotectedHeader(unprotectedHeader: JWSHeaderParameters): this; | ||
setUnprotectedHeader(unprotectedHeader: types.JWSHeaderParameters): this; | ||
/** | ||
@@ -36,3 +36,3 @@ * Signs and resolves the value of the Flattened JWS object. | ||
*/ | ||
sign(key: KeyLike | Uint8Array | JWK, options?: SignOptions): Promise<FlattenedJWS>; | ||
sign(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Promise<types.FlattenedJWS>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { JWK, FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GenericGetKeyFunction, ResolvedKey } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Interface for Flattened JWS Verification dynamic key resolution. No token components have been | ||
*/ | ||
export interface FlattenedVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters | undefined, FlattenedJWSInput, KeyLike | JWK | Uint8Array> { | ||
export interface FlattenedVerifyGetKey extends types.GenericGetKeyFunction<types.JWSHeaderParameters | undefined, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> { | ||
} | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
export declare function flattenedVerify(jws: FlattenedJWSInput, key: KeyLike | Uint8Array | JWK, options?: VerifyOptions): Promise<FlattenedVerifyResult>; | ||
export declare function flattenedVerify(jws: types.FlattenedJWSInput, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult>; | ||
/** | ||
@@ -30,2 +30,2 @@ * @param jws Flattened JWS. | ||
*/ | ||
export declare function flattenedVerify<KeyLikeType extends KeyLike = KeyLike>(jws: FlattenedJWSInput, getKey: FlattenedVerifyGetKey, options?: VerifyOptions): Promise<FlattenedVerifyResult & ResolvedKey<KeyLikeType>>; | ||
export declare function flattenedVerify(jws: types.FlattenedJWSInput, getKey: FlattenedVerifyGetKey, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult & types.ResolvedKey>; |
@@ -1,2 +0,2 @@ | ||
import type { JWK, KeyLike, GeneralJWS, JWSHeaderParameters, SignOptions } from '../../types'; | ||
import type * as types from '../../types'; | ||
export interface Signature { | ||
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
setProtectedHeader(protectedHeader: JWSHeaderParameters): Signature; | ||
setProtectedHeader(protectedHeader: types.JWSHeaderParameters): Signature; | ||
/** | ||
@@ -15,7 +15,7 @@ * Sets the JWS Unprotected Header on the Signature object. | ||
*/ | ||
setUnprotectedHeader(unprotectedHeader: JWSHeaderParameters): Signature; | ||
setUnprotectedHeader(unprotectedHeader: types.JWSHeaderParameters): Signature; | ||
/** A shorthand for calling addSignature() on the enclosing GeneralSign instance */ | ||
addSignature(...args: Parameters<GeneralSign['addSignature']>): Signature; | ||
/** A shorthand for calling encrypt() on the enclosing GeneralSign instance */ | ||
sign(...args: Parameters<GeneralSign['sign']>): Promise<GeneralJWS>; | ||
sign(...args: Parameters<GeneralSign['sign']>): Promise<types.GeneralJWS>; | ||
/** Returns the enclosing GeneralSign */ | ||
@@ -43,5 +43,5 @@ done(): GeneralSign; | ||
*/ | ||
addSignature(key: KeyLike | Uint8Array | JWK, options?: SignOptions): Signature; | ||
addSignature(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Signature; | ||
/** Signs and resolves the value of the General JWS object. */ | ||
sign(): Promise<GeneralJWS>; | ||
sign(): Promise<types.GeneralJWS>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { JWK, GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GenericGetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types'; | ||
import type * as types from '../../types'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Interface for General JWS Verification dynamic key resolution. No token components have been | ||
*/ | ||
export interface GeneralVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> { | ||
export interface GeneralVerifyGetKey extends types.GenericGetKeyFunction<types.JWSHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> { | ||
} | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
export declare function generalVerify(jws: GeneralJWSInput, key: KeyLike | Uint8Array | JWK, options?: VerifyOptions): Promise<GeneralVerifyResult>; | ||
export declare function generalVerify(jws: types.GeneralJWSInput, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult>; | ||
/** | ||
@@ -30,2 +30,2 @@ * @param jws General JWS. | ||
*/ | ||
export declare function generalVerify<KeyLikeType extends KeyLike = KeyLike>(jws: GeneralJWSInput, getKey: GeneralVerifyGetKey, options?: VerifyOptions): Promise<GeneralVerifyResult & ResolvedKey<KeyLikeType>>; | ||
export declare function generalVerify(jws: types.GeneralJWSInput, getKey: GeneralVerifyGetKey, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult & types.ResolvedKey>; |
@@ -1,4 +0,4 @@ | ||
import type { JWTPayload, KeyLike, DecryptOptions, JWTClaimVerificationOptions, GetKeyFunction, CompactJWEHeaderParameters, FlattenedJWE, JWTDecryptResult, ResolvedKey } from '../types'; | ||
import type * as types from '../types'; | ||
/** Combination of JWE Decryption options and JWT Claims Set verification options. */ | ||
export interface JWTDecryptOptions extends DecryptOptions, JWTClaimVerificationOptions { | ||
export interface JWTDecryptOptions extends types.DecryptOptions, types.JWTClaimVerificationOptions { | ||
} | ||
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export interface JWTDecryptGetKey extends GetKeyFunction<CompactJWEHeaderParameters, FlattenedJWE> { | ||
export interface JWTDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> { | ||
} | ||
@@ -24,3 +24,3 @@ /** | ||
*/ | ||
export declare function jwtDecrypt<PayloadType = JWTPayload>(jwt: string | Uint8Array, key: KeyLike | Uint8Array, options?: JWTDecryptOptions): Promise<JWTDecryptResult<PayloadType>>; | ||
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType>>; | ||
/** | ||
@@ -32,2 +32,2 @@ * @param jwt JSON Web Token value (encoded as JWE). | ||
*/ | ||
export declare function jwtDecrypt<PayloadType = JWTPayload, KeyLikeType extends KeyLike = KeyLike>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<JWTDecryptResult<PayloadType> & ResolvedKey<KeyLikeType>>; | ||
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType> & types.ResolvedKey>; |
@@ -1,2 +0,2 @@ | ||
import type { EncryptOptions, CompactJWEHeaderParameters, JWEKeyManagementHeaderParameters, KeyLike } from '../types'; | ||
import type * as types from '../types'; | ||
import { ProduceJWT } from './produce'; | ||
@@ -24,3 +24,3 @@ /** | ||
*/ | ||
setProtectedHeader(protectedHeader: CompactJWEHeaderParameters): this; | ||
setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this; | ||
/** | ||
@@ -34,3 +34,3 @@ * Sets the JWE Key Management parameters to be used when encrypting. Use of this is method is | ||
*/ | ||
setKeyManagementParameters(parameters: JWEKeyManagementHeaderParameters): this; | ||
setKeyManagementParameters(parameters: types.JWEKeyManagementHeaderParameters): this; | ||
/** | ||
@@ -81,3 +81,3 @@ * Sets a content encryption key to use, by default a random suitable one is generated for the JWE | ||
*/ | ||
encrypt(key: KeyLike | Uint8Array, options?: EncryptOptions): Promise<string>; | ||
encrypt(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.EncryptOptions): Promise<string>; | ||
} |
@@ -1,7 +0,7 @@ | ||
import type { JWTPayload } from '../types'; | ||
import type * as types from '../types'; | ||
/** Generic class for JWT producing. */ | ||
export declare class ProduceJWT { | ||
protected _payload: JWTPayload; | ||
protected _payload: types.JWTPayload; | ||
/** @param payload The JWT Claims Set object. Defaults to an empty object. */ | ||
constructor(payload?: JWTPayload); | ||
constructor(payload?: types.JWTPayload); | ||
/** | ||
@@ -8,0 +8,0 @@ * Set the "iss" (Issuer) Claim. |
@@ -1,2 +0,2 @@ | ||
import type { JWK, JWTHeaderParameters, KeyLike, SignOptions } from '../types'; | ||
import type * as types from '../types'; | ||
import { ProduceJWT } from './produce'; | ||
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
setProtectedHeader(protectedHeader: JWTHeaderParameters): this; | ||
setProtectedHeader(protectedHeader: types.JWTHeaderParameters): this; | ||
/** | ||
@@ -26,3 +26,3 @@ * Signs and returns the JWT. | ||
*/ | ||
sign(key: KeyLike | Uint8Array | JWK, options?: SignOptions): Promise<string>; | ||
sign(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Promise<string>; | ||
} |
@@ -1,6 +0,6 @@ | ||
import type { JWSHeaderParameters, JWTClaimVerificationOptions, JWTPayload } from '../types'; | ||
import type * as types from '../types'; | ||
import { ProduceJWT } from './produce'; | ||
export interface UnsecuredResult<PayloadType = JWTPayload> { | ||
payload: PayloadType & JWTPayload; | ||
header: JWSHeaderParameters; | ||
export interface UnsecuredResult<PayloadType = types.JWTPayload> { | ||
payload: PayloadType & types.JWTPayload; | ||
header: types.JWSHeaderParameters; | ||
} | ||
@@ -23,3 +23,3 @@ /** | ||
*/ | ||
static decode<PayloadType = JWTPayload>(jwt: string, options?: JWTClaimVerificationOptions): UnsecuredResult<PayloadType>; | ||
static decode<PayloadType = types.JWTPayload>(jwt: string, options?: types.JWTClaimVerificationOptions): UnsecuredResult<PayloadType>; | ||
} |
@@ -1,4 +0,4 @@ | ||
import type { JWK, JWTPayload, KeyLike, VerifyOptions, JWTClaimVerificationOptions, JWTHeaderParameters, GenericGetKeyFunction, FlattenedJWSInput, JWTVerifyResult, ResolvedKey } from '../types'; | ||
import type * as types from '../types'; | ||
/** Combination of JWS Verification options and JWT Claims Set verification options. */ | ||
export interface JWTVerifyOptions extends VerifyOptions, JWTClaimVerificationOptions { | ||
export interface JWTVerifyOptions extends types.VerifyOptions, types.JWTClaimVerificationOptions { | ||
} | ||
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
export interface JWTVerifyGetKey extends GenericGetKeyFunction<JWTHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> { | ||
export interface JWTVerifyGetKey extends types.GenericGetKeyFunction<types.JWTHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> { | ||
} | ||
@@ -26,3 +26,3 @@ /** | ||
*/ | ||
export declare function jwtVerify<PayloadType = JWTPayload>(jwt: string | Uint8Array, key: KeyLike | Uint8Array | JWK, options?: JWTVerifyOptions): Promise<JWTVerifyResult<PayloadType>>; | ||
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType>>; | ||
/** | ||
@@ -34,2 +34,2 @@ * @param jwt JSON Web Token value (encoded as JWS). | ||
*/ | ||
export declare function jwtVerify<PayloadType = JWTPayload, KeyLikeType extends KeyLike = KeyLike>(jwt: string | Uint8Array, getKey: JWTVerifyGetKey, options?: JWTVerifyOptions): Promise<JWTVerifyResult<PayloadType> & ResolvedKey<KeyLikeType>>; | ||
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTVerifyGetKey, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType> & types.ResolvedKey>; |
@@ -1,5 +0,4 @@ | ||
import type { JWK, KeyLike } from '../types'; | ||
import type * as types from '../types'; | ||
/** | ||
* Exports a runtime-specific public key representation ({@link !KeyObject} or {@link !CryptoKey}) to | ||
* a PEM-encoded SPKI string format. | ||
* Exports a public {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded SPKI string format. | ||
* | ||
@@ -9,8 +8,7 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well | ||
* | ||
* @param key Key representation to transform to a PEM-encoded SPKI string format. | ||
* @param key Key to export to a PEM-encoded SPKI string format. | ||
*/ | ||
export declare function exportSPKI(key: KeyLike): Promise<string>; | ||
export declare function exportSPKI(key: types.CryptoKey | types.KeyObject): Promise<string>; | ||
/** | ||
* Exports a runtime-specific private key representation ({@link !KeyObject} or {@link !CryptoKey}) to | ||
* a PEM-encoded PKCS8 string format. | ||
* Exports a private {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded PKCS8 string format. | ||
* | ||
@@ -20,7 +18,7 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well | ||
* | ||
* @param key Key representation to transform to a PEM-encoded PKCS8 string format. | ||
* @param key Key to export to a PEM-encoded PKCS8 string format. | ||
*/ | ||
export declare function exportPKCS8(key: KeyLike): Promise<string>; | ||
export declare function exportPKCS8(key: types.CryptoKey | types.KeyObject): Promise<string>; | ||
/** | ||
* Exports a runtime-specific key representation (KeyLike) to a JWK. | ||
* Exports a {@link !CryptoKey}, {@link !KeyObject}, or {@link !Uint8Array} to a JWK. | ||
* | ||
@@ -30,4 +28,4 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well | ||
* | ||
* @param key Key representation to export as JWK. | ||
* @param key Key to export as JWK. | ||
*/ | ||
export declare function exportJWK(key: KeyLike | Uint8Array): Promise<JWK>; | ||
export declare function exportJWK(key: types.CryptoKey | types.KeyObject | Uint8Array): Promise<types.JWK>; |
@@ -1,7 +0,7 @@ | ||
import type { KeyLike } from '../types'; | ||
export interface GenerateKeyPairResult<KeyLikeType extends KeyLike = KeyLike> { | ||
import type * as types from '../types'; | ||
export interface GenerateKeyPairResult { | ||
/** The generated Private Key. */ | ||
privateKey: KeyLikeType; | ||
privateKey: types.CryptoKey; | ||
/** Public Key corresponding to the generated Private Key. */ | ||
publicKey: KeyLikeType; | ||
publicKey: types.CryptoKey; | ||
} | ||
@@ -20,4 +20,3 @@ export interface GenerateKeyPairOptions { | ||
/** | ||
* (Only effective in Web Crypto API runtimes) The value to use as | ||
* {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false. | ||
* The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false. | ||
* | ||
@@ -31,5 +30,4 @@ */ | ||
* | ||
* Note: Under Web Crypto API runtime the `privateKey` is generated with `extractable` set to | ||
* `false` by default. See {@link GenerateKeyPairOptions.extractable} to generate an extractable | ||
* `privateKey`. | ||
* Note: The `privateKey` is generated with `extractable` set to `false` by default. See | ||
* {@link GenerateKeyPairOptions.extractable} to generate an extractable `privateKey`. | ||
* | ||
@@ -39,5 +37,6 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well | ||
* | ||
* @param alg JWA Algorithm Identifier to be used with the generated key pair. | ||
* @param alg JWA Algorithm Identifier to be used with the generated key pair. See | ||
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}. | ||
* @param options Additional options passed down to the key pair generation. | ||
*/ | ||
export declare function generateKeyPair<KeyLikeType extends KeyLike = KeyLike>(alg: string, options?: GenerateKeyPairOptions): Promise<GenerateKeyPairResult<KeyLikeType>>; | ||
export declare function generateKeyPair(alg: string, options?: GenerateKeyPairOptions): Promise<GenerateKeyPairResult>; |
@@ -1,7 +0,4 @@ | ||
import type { KeyLike } from '../types'; | ||
import type * as types from '../types'; | ||
export interface GenerateSecretOptions { | ||
/** | ||
* (Only effective in Web Crypto API runtimes) The value to use as | ||
* {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false. | ||
*/ | ||
/** The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false. */ | ||
extractable?: boolean; | ||
@@ -12,4 +9,3 @@ } | ||
* | ||
* Note: Under Web Crypto API runtime the secret key is generated with `extractable` set to `false` | ||
* by default. | ||
* Note: The secret key is generated with `extractable` set to `false` by default. | ||
* | ||
@@ -19,5 +15,6 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well | ||
* | ||
* @param alg JWA Algorithm Identifier to be used with the generated secret. | ||
* @param alg JWA Algorithm Identifier to be used with the generated secret. See | ||
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}. | ||
* @param options Additional options passed down to the secret generation. | ||
*/ | ||
export declare function generateSecret<KeyLikeType extends KeyLike = KeyLike>(alg: string, options?: GenerateSecretOptions): Promise<KeyLikeType | Uint8Array>; | ||
export declare function generateSecret(alg: string, options?: GenerateSecretOptions): Promise<types.CryptoKey | Uint8Array>; |
@@ -1,6 +0,6 @@ | ||
import type { JWK, KeyLike } from '../types'; | ||
export interface PEMImportOptions { | ||
import type * as types from '../types'; | ||
export interface KeyImportOptions { | ||
/** | ||
* (Only effective in Web Crypto API runtimes) The value to use as {@link !SubtleCrypto.importKey} | ||
* `extractable` argument. Default is false. | ||
* The value to use as {@link !SubtleCrypto.importKey} `extractable` argument. Default is false for | ||
* private and secret keys, true otherwise. | ||
*/ | ||
@@ -10,4 +10,3 @@ extractable?: boolean; | ||
/** | ||
* Imports a PEM-encoded SPKI string as a runtime-specific public key representation | ||
* ({@link !KeyObject} or {@link !CryptoKey}). | ||
* Imports a PEM-encoded SPKI string as a {@link !CryptoKey}. | ||
* | ||
@@ -22,10 +21,8 @@ * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in | ||
* @param spki PEM-encoded SPKI string | ||
* @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used | ||
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See | ||
* @param alg JSON Web Algorithm identifier to be used with the imported key. See | ||
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}. | ||
*/ | ||
export declare function importSPKI<KeyLikeType extends KeyLike = KeyLike>(spki: string, alg: string, options?: PEMImportOptions): Promise<KeyLikeType>; | ||
export declare function importSPKI(spki: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>; | ||
/** | ||
* Imports the SPKI from an X.509 string certificate as a runtime-specific public key representation | ||
* ({@link !KeyObject} or {@link !CryptoKey}). | ||
* Imports the SPKI from an X.509 string certificate as a {@link !CryptoKey}. | ||
* | ||
@@ -40,10 +37,8 @@ * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in | ||
* @param x509 X.509 certificate string | ||
* @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used | ||
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See | ||
* @param alg JSON Web Algorithm identifier to be used with the imported key. See | ||
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}. | ||
*/ | ||
export declare function importX509<KeyLikeType extends KeyLike = KeyLike>(x509: string, alg: string, options?: PEMImportOptions): Promise<KeyLikeType>; | ||
export declare function importX509(x509: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>; | ||
/** | ||
* Imports a PEM-encoded PKCS#8 string as a runtime-specific private key representation | ||
* ({@link !KeyObject} or {@link !CryptoKey}). | ||
* Imports a PEM-encoded PKCS#8 string as a {@link !CryptoKey}. | ||
* | ||
@@ -58,13 +53,12 @@ * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in | ||
* @param pkcs8 PEM-encoded PKCS#8 string | ||
* @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used | ||
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See | ||
* @param alg JSON Web Algorithm identifier to be used with the imported key. See | ||
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}. | ||
*/ | ||
export declare function importPKCS8<KeyLikeType extends KeyLike = KeyLike>(pkcs8: string, alg: string, options?: PEMImportOptions): Promise<KeyLikeType>; | ||
export declare function importPKCS8(pkcs8: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>; | ||
/** | ||
* Imports a JWK to a runtime-specific key representation (KeyLike). Either the JWK "alg" | ||
* (Algorithm) Parameter, or the optional "alg" argument, must be present. | ||
* Imports a JWK to a {@link !CryptoKey}. Either the JWK "alg" (Algorithm) Parameter, or the optional | ||
* "alg" argument, must be present. | ||
* | ||
* Note: When the runtime is using {@link https://w3c.github.io/webcrypto/ Web Cryptography API} the | ||
* jwk parameters "use", "key_ops", and "ext" are also used in the resulting {@link !CryptoKey}. | ||
* Note: The JSON Web Key parameters "use", "key_ops", and "ext" are also used in the | ||
* {@link !CryptoKey} import process. | ||
* | ||
@@ -75,7 +69,6 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well | ||
* @param jwk JSON Web Key. | ||
* @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used | ||
* with the imported key. Default is the "alg" property on the JWK, its presence is only enforced | ||
* in Web Crypto API runtimes. See | ||
* @param alg JSON Web Algorithm identifier to be used with the imported key. Default is the "alg" | ||
* property on the JWK. See | ||
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}. | ||
*/ | ||
export declare function importJWK<KeyLikeType extends KeyLike = KeyLike>(jwk: JWK, alg?: string): Promise<KeyLikeType | Uint8Array>; | ||
export declare function importJWK(jwk: types.JWK, alg?: string, options?: KeyImportOptions): Promise<types.CryptoKey | Uint8Array>; |
@@ -1,25 +0,1 @@ | ||
/** | ||
* KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets. These are | ||
* instances of {@link !CryptoKey} and additionally {@link !KeyObject} in Node.js runtime. | ||
* {@link !Uint8Array} instances are also accepted as symmetric secret representation only. | ||
* | ||
* {@link key/import Key Import Functions} can be used to import PEM, or JWK formatted asymmetric | ||
* keys and certificates to these runtime-specific representations. | ||
* | ||
* In Node.js the {@link !Buffer} class is a subclass of {@link !Uint8Array} and so {@link !Buffer} can | ||
* be provided for symmetric secrets as well. | ||
* | ||
* {@link !KeyObject} is a representation of a key/secret available in the Node.js runtime. In | ||
* addition to the {@link key/import Key Import Functions} you may use the runtime APIs | ||
* {@link !createPublicKey}, {@link !createPrivateKey}, and {@link !createSecretKey} to obtain a | ||
* {@link !KeyObject} from your existing key material. | ||
* | ||
* {@link !CryptoKey} is a representation of a key/secret available in the Browser and | ||
* Web-interoperable runtimes. In addition to the {@link key/import Key Import Functions} you may use | ||
* the {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key | ||
* material. | ||
* | ||
*/ | ||
export type KeyLike = { type: string } | ||
/** Generic JSON Web Key Parameters. */ | ||
@@ -187,3 +163,7 @@ export interface JWKParameters { | ||
export interface GetKeyFunction<IProtectedHeader, IToken> | ||
extends GenericGetKeyFunction<IProtectedHeader, IToken, KeyLike | Uint8Array> {} | ||
extends GenericGetKeyFunction< | ||
IProtectedHeader, | ||
IToken, | ||
CryptoKey | KeyObject | JWK | Uint8Array | ||
> {} | ||
@@ -328,3 +308,3 @@ /** | ||
*/ | ||
epk?: KeyLike | ||
epk?: CryptoKey | KeyObject | ||
} | ||
@@ -672,5 +652,5 @@ | ||
export interface ResolvedKey<KeyLikeType extends KeyLike = KeyLike> { | ||
export interface ResolvedKey { | ||
/** Key resolved from the key resolver function. */ | ||
key: KeyLikeType | Uint8Array | ||
key: CryptoKey | Uint8Array | ||
} | ||
@@ -699,2 +679,20 @@ | ||
export type CryptoRuntime = 'WebCryptoAPI' | 'node:crypto' | ||
/** | ||
* {@link !KeyObject} is a representation of a key/secret available in the Node.js runtime. You may | ||
* use the Node.js runtime APIs {@link !createPublicKey}, {@link !createPrivateKey}, and | ||
* {@link !createSecretKey} to obtain a {@link !KeyObject} from your existing key material. | ||
*/ | ||
export interface KeyObject { | ||
type: string | ||
} | ||
/** | ||
* {@link !CryptoKey} is a representation of a key/secret available in all supported runtimes. In | ||
* addition to the {@link key/import Key Import Functions} you may use the | ||
* {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key | ||
* material. | ||
*/ | ||
export type CryptoKey = Extract< | ||
Awaited<ReturnType<typeof crypto.subtle.generateKey>>, | ||
{ type: string } | ||
> |
@@ -1,2 +0,2 @@ | ||
import type { JWTPayload } from '../types'; | ||
import type * as types from '../types'; | ||
/** | ||
@@ -13,2 +13,2 @@ * Decodes a signed JSON Web Token payload. This does not validate the JWT Claims Set types or | ||
*/ | ||
export declare function decodeJwt<PayloadType = JWTPayload>(jwt: string): PayloadType & JWTPayload; | ||
export declare function decodeJwt<PayloadType = types.JWTPayload>(jwt: string): PayloadType & types.JWTPayload; |
@@ -1,3 +0,3 @@ | ||
import type { JWSHeaderParameters, JWEHeaderParameters } from '../types'; | ||
export type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderParameters; | ||
import type * as types from '../types'; | ||
export type ProtectedHeaderParameters = types.JWSHeaderParameters & types.JWEHeaderParameters; | ||
/** | ||
@@ -4,0 +4,0 @@ * Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization. |
@@ -1,2 +0,2 @@ | ||
import type { JWTPayload, KeyLike } from '../types'; | ||
import type * as types from '../types'; | ||
/** | ||
@@ -38,5 +38,5 @@ * A generic Error that all other JOSE specific Error subclasses extend. | ||
*/ | ||
payload: JWTPayload; | ||
payload: types.JWTPayload; | ||
/** @ignore */ | ||
constructor(message: string, payload: JWTPayload, claim?: string, reason?: string); | ||
constructor(message: string, payload: types.JWTPayload, claim?: string, reason?: string); | ||
} | ||
@@ -61,5 +61,5 @@ /** | ||
*/ | ||
payload: JWTPayload; | ||
payload: types.JWTPayload; | ||
/** @ignore */ | ||
constructor(message: string, payload: JWTPayload, claim?: string, reason?: string); | ||
constructor(message: string, payload: types.JWTPayload, claim?: string, reason?: string); | ||
} | ||
@@ -162,3 +162,3 @@ /** | ||
/** @ignore */ | ||
[Symbol.asyncIterator]: () => AsyncIterableIterator<KeyLike>; | ||
[Symbol.asyncIterator]: () => AsyncIterableIterator<types.CryptoKey>; | ||
/** @ignore */ | ||
@@ -165,0 +165,0 @@ static code: string; |
255
package.json
{ | ||
"name": "jose", | ||
"version": "5.10.0", | ||
"version": "6.0.0", | ||
"description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes", | ||
@@ -16,2 +16,3 @@ "keywords": [ | ||
"ecdsa", | ||
"ed25519", | ||
"eddsa", | ||
@@ -43,3 +44,2 @@ "edge", | ||
"rsa", | ||
"secp256k1", | ||
"sign", | ||
@@ -64,311 +64,130 @@ "signature", | ||
"sideEffects": false, | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./dist/types/index.d.ts", | ||
"bun": "./dist/browser/index.js", | ||
"deno": "./dist/browser/index.js", | ||
"browser": "./dist/browser/index.js", | ||
"worker": "./dist/browser/index.js", | ||
"workerd": "./dist/browser/index.js", | ||
"import": "./dist/node/esm/index.js", | ||
"require": "./dist/node/cjs/index.js" | ||
"default": "./dist/webapi/index.js" | ||
}, | ||
"./jwk/embedded": { | ||
"types": "./dist/types/jwk/embedded.d.ts", | ||
"bun": "./dist/browser/jwk/embedded.js", | ||
"deno": "./dist/browser/jwk/embedded.js", | ||
"browser": "./dist/browser/jwk/embedded.js", | ||
"worker": "./dist/browser/jwk/embedded.js", | ||
"workerd": "./dist/browser/jwk/embedded.js", | ||
"import": "./dist/node/esm/jwk/embedded.js", | ||
"require": "./dist/node/cjs/jwk/embedded.js" | ||
"default": "./dist/webapi/jwk/embedded.js" | ||
}, | ||
"./jwk/thumbprint": { | ||
"types": "./dist/types/jwk/thumbprint.d.ts", | ||
"bun": "./dist/browser/jwk/thumbprint.js", | ||
"deno": "./dist/browser/jwk/thumbprint.js", | ||
"browser": "./dist/browser/jwk/thumbprint.js", | ||
"worker": "./dist/browser/jwk/thumbprint.js", | ||
"workerd": "./dist/browser/jwk/thumbprint.js", | ||
"import": "./dist/node/esm/jwk/thumbprint.js", | ||
"require": "./dist/node/cjs/jwk/thumbprint.js" | ||
"default": "./dist/webapi/jwk/thumbprint.js" | ||
}, | ||
"./key/import": { | ||
"types": "./dist/types/key/import.d.ts", | ||
"bun": "./dist/browser/key/import.js", | ||
"deno": "./dist/browser/key/import.js", | ||
"browser": "./dist/browser/key/import.js", | ||
"worker": "./dist/browser/key/import.js", | ||
"workerd": "./dist/browser/key/import.js", | ||
"import": "./dist/node/esm/key/import.js", | ||
"require": "./dist/node/cjs/key/import.js" | ||
"default": "./dist/webapi/key/import.js" | ||
}, | ||
"./key/export": { | ||
"types": "./dist/types/key/export.d.ts", | ||
"bun": "./dist/browser/key/export.js", | ||
"deno": "./dist/browser/key/export.js", | ||
"browser": "./dist/browser/key/export.js", | ||
"worker": "./dist/browser/key/export.js", | ||
"workerd": "./dist/browser/key/export.js", | ||
"import": "./dist/node/esm/key/export.js", | ||
"require": "./dist/node/cjs/key/export.js" | ||
"default": "./dist/webapi/key/export.js" | ||
}, | ||
"./key/generate/keypair": { | ||
"types": "./dist/types/key/generate_key_pair.d.ts", | ||
"bun": "./dist/browser/key/generate_key_pair.js", | ||
"deno": "./dist/browser/key/generate_key_pair.js", | ||
"browser": "./dist/browser/key/generate_key_pair.js", | ||
"worker": "./dist/browser/key/generate_key_pair.js", | ||
"workerd": "./dist/browser/key/generate_key_pair.js", | ||
"import": "./dist/node/esm/key/generate_key_pair.js", | ||
"require": "./dist/node/cjs/key/generate_key_pair.js" | ||
"default": "./dist/webapi/key/generate_key_pair.js" | ||
}, | ||
"./key/generate/secret": { | ||
"types": "./dist/types/key/generate_secret.d.ts", | ||
"bun": "./dist/browser/key/generate_secret.js", | ||
"deno": "./dist/browser/key/generate_secret.js", | ||
"browser": "./dist/browser/key/generate_secret.js", | ||
"worker": "./dist/browser/key/generate_secret.js", | ||
"workerd": "./dist/browser/key/generate_secret.js", | ||
"import": "./dist/node/esm/key/generate_secret.js", | ||
"require": "./dist/node/cjs/key/generate_secret.js" | ||
"default": "./dist/webapi/key/generate_secret.js" | ||
}, | ||
"./jwks/remote": { | ||
"types": "./dist/types/jwks/remote.d.ts", | ||
"bun": "./dist/browser/jwks/remote.js", | ||
"deno": "./dist/browser/jwks/remote.js", | ||
"browser": "./dist/browser/jwks/remote.js", | ||
"worker": "./dist/browser/jwks/remote.js", | ||
"workerd": "./dist/browser/jwks/remote.js", | ||
"import": "./dist/node/esm/jwks/remote.js", | ||
"require": "./dist/node/cjs/jwks/remote.js" | ||
"default": "./dist/webapi/jwks/remote.js" | ||
}, | ||
"./jwks/local": { | ||
"types": "./dist/types/jwks/local.d.ts", | ||
"bun": "./dist/browser/jwks/local.js", | ||
"deno": "./dist/browser/jwks/local.js", | ||
"browser": "./dist/browser/jwks/local.js", | ||
"worker": "./dist/browser/jwks/local.js", | ||
"workerd": "./dist/browser/jwks/local.js", | ||
"import": "./dist/node/esm/jwks/local.js", | ||
"require": "./dist/node/cjs/jwks/local.js" | ||
"default": "./dist/webapi/jwks/local.js" | ||
}, | ||
"./jwt/sign": { | ||
"types": "./dist/types/jwt/sign.d.ts", | ||
"bun": "./dist/browser/jwt/sign.js", | ||
"deno": "./dist/browser/jwt/sign.js", | ||
"browser": "./dist/browser/jwt/sign.js", | ||
"worker": "./dist/browser/jwt/sign.js", | ||
"workerd": "./dist/browser/jwt/sign.js", | ||
"import": "./dist/node/esm/jwt/sign.js", | ||
"require": "./dist/node/cjs/jwt/sign.js" | ||
"default": "./dist/webapi/jwt/sign.js" | ||
}, | ||
"./jwt/verify": { | ||
"types": "./dist/types/jwt/verify.d.ts", | ||
"bun": "./dist/browser/jwt/verify.js", | ||
"deno": "./dist/browser/jwt/verify.js", | ||
"browser": "./dist/browser/jwt/verify.js", | ||
"worker": "./dist/browser/jwt/verify.js", | ||
"workerd": "./dist/browser/jwt/verify.js", | ||
"import": "./dist/node/esm/jwt/verify.js", | ||
"require": "./dist/node/cjs/jwt/verify.js" | ||
"default": "./dist/webapi/jwt/verify.js" | ||
}, | ||
"./jwt/encrypt": { | ||
"types": "./dist/types/jwt/encrypt.d.ts", | ||
"bun": "./dist/browser/jwt/encrypt.js", | ||
"deno": "./dist/browser/jwt/encrypt.js", | ||
"browser": "./dist/browser/jwt/encrypt.js", | ||
"worker": "./dist/browser/jwt/encrypt.js", | ||
"workerd": "./dist/browser/jwt/encrypt.js", | ||
"import": "./dist/node/esm/jwt/encrypt.js", | ||
"require": "./dist/node/cjs/jwt/encrypt.js" | ||
"default": "./dist/webapi/jwt/encrypt.js" | ||
}, | ||
"./jwt/decrypt": { | ||
"types": "./dist/types/jwt/decrypt.d.ts", | ||
"bun": "./dist/browser/jwt/decrypt.js", | ||
"deno": "./dist/browser/jwt/decrypt.js", | ||
"browser": "./dist/browser/jwt/decrypt.js", | ||
"worker": "./dist/browser/jwt/decrypt.js", | ||
"workerd": "./dist/browser/jwt/decrypt.js", | ||
"import": "./dist/node/esm/jwt/decrypt.js", | ||
"require": "./dist/node/cjs/jwt/decrypt.js" | ||
"default": "./dist/webapi/jwt/decrypt.js" | ||
}, | ||
"./jwt/unsecured": { | ||
"types": "./dist/types/jwt/unsecured.d.ts", | ||
"bun": "./dist/browser/jwt/unsecured.js", | ||
"deno": "./dist/browser/jwt/unsecured.js", | ||
"browser": "./dist/browser/jwt/unsecured.js", | ||
"worker": "./dist/browser/jwt/unsecured.js", | ||
"workerd": "./dist/browser/jwt/unsecured.js", | ||
"import": "./dist/node/esm/jwt/unsecured.js", | ||
"require": "./dist/node/cjs/jwt/unsecured.js" | ||
"default": "./dist/webapi/jwt/unsecured.js" | ||
}, | ||
"./jwt/decode": { | ||
"types": "./dist/types/util/decode_jwt.d.ts", | ||
"bun": "./dist/browser/util/decode_jwt.js", | ||
"deno": "./dist/browser/util/decode_jwt.js", | ||
"browser": "./dist/browser/util/decode_jwt.js", | ||
"worker": "./dist/browser/util/decode_jwt.js", | ||
"workerd": "./dist/browser/util/decode_jwt.js", | ||
"import": "./dist/node/esm/util/decode_jwt.js", | ||
"require": "./dist/node/cjs/util/decode_jwt.js" | ||
"default": "./dist/webapi/util/decode_jwt.js" | ||
}, | ||
"./decode/protected_header": { | ||
"types": "./dist/types/util/decode_protected_header.d.ts", | ||
"bun": "./dist/browser/util/decode_protected_header.js", | ||
"deno": "./dist/browser/util/decode_protected_header.js", | ||
"browser": "./dist/browser/util/decode_protected_header.js", | ||
"worker": "./dist/browser/util/decode_protected_header.js", | ||
"workerd": "./dist/browser/util/decode_protected_header.js", | ||
"import": "./dist/node/esm/util/decode_protected_header.js", | ||
"require": "./dist/node/cjs/util/decode_protected_header.js" | ||
"default": "./dist/webapi/util/decode_protected_header.js" | ||
}, | ||
"./jws/compact/sign": { | ||
"types": "./dist/types/jws/compact/sign.d.ts", | ||
"bun": "./dist/browser/jws/compact/sign.js", | ||
"deno": "./dist/browser/jws/compact/sign.js", | ||
"browser": "./dist/browser/jws/compact/sign.js", | ||
"worker": "./dist/browser/jws/compact/sign.js", | ||
"workerd": "./dist/browser/jws/compact/sign.js", | ||
"import": "./dist/node/esm/jws/compact/sign.js", | ||
"require": "./dist/node/cjs/jws/compact/sign.js" | ||
"default": "./dist/webapi/jws/compact/sign.js" | ||
}, | ||
"./jws/compact/verify": { | ||
"types": "./dist/types/jws/compact/verify.d.ts", | ||
"bun": "./dist/browser/jws/compact/verify.js", | ||
"deno": "./dist/browser/jws/compact/verify.js", | ||
"browser": "./dist/browser/jws/compact/verify.js", | ||
"worker": "./dist/browser/jws/compact/verify.js", | ||
"workerd": "./dist/browser/jws/compact/verify.js", | ||
"import": "./dist/node/esm/jws/compact/verify.js", | ||
"require": "./dist/node/cjs/jws/compact/verify.js" | ||
"default": "./dist/webapi/jws/compact/verify.js" | ||
}, | ||
"./jws/flattened/sign": { | ||
"types": "./dist/types/jws/flattened/sign.d.ts", | ||
"bun": "./dist/browser/jws/flattened/sign.js", | ||
"deno": "./dist/browser/jws/flattened/sign.js", | ||
"browser": "./dist/browser/jws/flattened/sign.js", | ||
"worker": "./dist/browser/jws/flattened/sign.js", | ||
"workerd": "./dist/browser/jws/flattened/sign.js", | ||
"import": "./dist/node/esm/jws/flattened/sign.js", | ||
"require": "./dist/node/cjs/jws/flattened/sign.js" | ||
"default": "./dist/webapi/jws/flattened/sign.js" | ||
}, | ||
"./jws/flattened/verify": { | ||
"types": "./dist/types/jws/flattened/verify.d.ts", | ||
"bun": "./dist/browser/jws/flattened/verify.js", | ||
"deno": "./dist/browser/jws/flattened/verify.js", | ||
"browser": "./dist/browser/jws/flattened/verify.js", | ||
"worker": "./dist/browser/jws/flattened/verify.js", | ||
"workerd": "./dist/browser/jws/flattened/verify.js", | ||
"import": "./dist/node/esm/jws/flattened/verify.js", | ||
"require": "./dist/node/cjs/jws/flattened/verify.js" | ||
"default": "./dist/webapi/jws/flattened/verify.js" | ||
}, | ||
"./jws/general/sign": { | ||
"types": "./dist/types/jws/general/sign.d.ts", | ||
"bun": "./dist/browser/jws/general/sign.js", | ||
"deno": "./dist/browser/jws/general/sign.js", | ||
"browser": "./dist/browser/jws/general/sign.js", | ||
"worker": "./dist/browser/jws/general/sign.js", | ||
"workerd": "./dist/browser/jws/general/sign.js", | ||
"import": "./dist/node/esm/jws/general/sign.js", | ||
"require": "./dist/node/cjs/jws/general/sign.js" | ||
"default": "./dist/webapi/jws/general/sign.js" | ||
}, | ||
"./jws/general/verify": { | ||
"types": "./dist/types/jws/general/verify.d.ts", | ||
"bun": "./dist/browser/jws/general/verify.js", | ||
"deno": "./dist/browser/jws/general/verify.js", | ||
"browser": "./dist/browser/jws/general/verify.js", | ||
"worker": "./dist/browser/jws/general/verify.js", | ||
"workerd": "./dist/browser/jws/general/verify.js", | ||
"import": "./dist/node/esm/jws/general/verify.js", | ||
"require": "./dist/node/cjs/jws/general/verify.js" | ||
"default": "./dist/webapi/jws/general/verify.js" | ||
}, | ||
"./jwe/compact/encrypt": { | ||
"types": "./dist/types/jwe/compact/encrypt.d.ts", | ||
"bun": "./dist/browser/jwe/compact/encrypt.js", | ||
"deno": "./dist/browser/jwe/compact/encrypt.js", | ||
"browser": "./dist/browser/jwe/compact/encrypt.js", | ||
"worker": "./dist/browser/jwe/compact/encrypt.js", | ||
"workerd": "./dist/browser/jwe/compact/encrypt.js", | ||
"import": "./dist/node/esm/jwe/compact/encrypt.js", | ||
"require": "./dist/node/cjs/jwe/compact/encrypt.js" | ||
"default": "./dist/webapi/jwe/compact/encrypt.js" | ||
}, | ||
"./jwe/compact/decrypt": { | ||
"types": "./dist/types/jwe/compact/decrypt.d.ts", | ||
"bun": "./dist/browser/jwe/compact/decrypt.js", | ||
"deno": "./dist/browser/jwe/compact/decrypt.js", | ||
"browser": "./dist/browser/jwe/compact/decrypt.js", | ||
"worker": "./dist/browser/jwe/compact/decrypt.js", | ||
"workerd": "./dist/browser/jwe/compact/decrypt.js", | ||
"import": "./dist/node/esm/jwe/compact/decrypt.js", | ||
"require": "./dist/node/cjs/jwe/compact/decrypt.js" | ||
"default": "./dist/webapi/jwe/compact/decrypt.js" | ||
}, | ||
"./jwe/flattened/encrypt": { | ||
"types": "./dist/types/jwe/flattened/encrypt.d.ts", | ||
"bun": "./dist/browser/jwe/flattened/encrypt.js", | ||
"deno": "./dist/browser/jwe/flattened/encrypt.js", | ||
"browser": "./dist/browser/jwe/flattened/encrypt.js", | ||
"worker": "./dist/browser/jwe/flattened/encrypt.js", | ||
"workerd": "./dist/browser/jwe/flattened/encrypt.js", | ||
"import": "./dist/node/esm/jwe/flattened/encrypt.js", | ||
"require": "./dist/node/cjs/jwe/flattened/encrypt.js" | ||
"default": "./dist/webapi/jwe/flattened/encrypt.js" | ||
}, | ||
"./jwe/flattened/decrypt": { | ||
"types": "./dist/types/jwe/flattened/decrypt.d.ts", | ||
"bun": "./dist/browser/jwe/flattened/decrypt.js", | ||
"deno": "./dist/browser/jwe/flattened/decrypt.js", | ||
"browser": "./dist/browser/jwe/flattened/decrypt.js", | ||
"worker": "./dist/browser/jwe/flattened/decrypt.js", | ||
"workerd": "./dist/browser/jwe/flattened/decrypt.js", | ||
"import": "./dist/node/esm/jwe/flattened/decrypt.js", | ||
"require": "./dist/node/cjs/jwe/flattened/decrypt.js" | ||
"default": "./dist/webapi/jwe/flattened/decrypt.js" | ||
}, | ||
"./jwe/general/encrypt": { | ||
"types": "./dist/types/jwe/general/encrypt.d.ts", | ||
"bun": "./dist/browser/jwe/general/encrypt.js", | ||
"deno": "./dist/browser/jwe/general/encrypt.js", | ||
"browser": "./dist/browser/jwe/general/encrypt.js", | ||
"worker": "./dist/browser/jwe/general/encrypt.js", | ||
"workerd": "./dist/browser/jwe/general/encrypt.js", | ||
"import": "./dist/node/esm/jwe/general/encrypt.js", | ||
"require": "./dist/node/cjs/jwe/general/encrypt.js" | ||
"default": "./dist/webapi/jwe/general/encrypt.js" | ||
}, | ||
"./jwe/general/decrypt": { | ||
"types": "./dist/types/jwe/general/decrypt.d.ts", | ||
"bun": "./dist/browser/jwe/general/decrypt.js", | ||
"deno": "./dist/browser/jwe/general/decrypt.js", | ||
"browser": "./dist/browser/jwe/general/decrypt.js", | ||
"worker": "./dist/browser/jwe/general/decrypt.js", | ||
"workerd": "./dist/browser/jwe/general/decrypt.js", | ||
"import": "./dist/node/esm/jwe/general/decrypt.js", | ||
"require": "./dist/node/cjs/jwe/general/decrypt.js" | ||
"default": "./dist/webapi/jwe/general/decrypt.js" | ||
}, | ||
"./errors": { | ||
"types": "./dist/types/util/errors.d.ts", | ||
"bun": "./dist/browser/util/errors.js", | ||
"deno": "./dist/browser/util/errors.js", | ||
"browser": "./dist/browser/util/errors.js", | ||
"worker": "./dist/browser/util/errors.js", | ||
"workerd": "./dist/browser/util/errors.js", | ||
"import": "./dist/node/esm/util/errors.js", | ||
"require": "./dist/node/cjs/util/errors.js" | ||
"default": "./dist/webapi/util/errors.js" | ||
}, | ||
"./base64url": { | ||
"types": "./dist/types/util/base64url.d.ts", | ||
"bun": "./dist/browser/util/base64url.js", | ||
"deno": "./dist/browser/util/base64url.js", | ||
"browser": "./dist/browser/util/base64url.js", | ||
"worker": "./dist/browser/util/base64url.js", | ||
"workerd": "./dist/browser/util/base64url.js", | ||
"import": "./dist/node/esm/util/base64url.js", | ||
"require": "./dist/node/cjs/util/base64url.js" | ||
"default": "./dist/webapi/util/base64url.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "./dist/node/cjs/index.js", | ||
"browser": "./dist/browser/index.js", | ||
"main": "./dist/webapi/index.js", | ||
"types": "./dist/types/index.d.ts", | ||
"files": [ | ||
"dist/**/package.json", | ||
"dist/**/*.js", | ||
"dist/webapi/**/*.js", | ||
"dist/types/**/*.d.ts", | ||
@@ -378,8 +197,6 @@ "!dist/**/*.bundle.js", | ||
"!dist/**/*.min.js", | ||
"!dist/node/webcrypto/**/*", | ||
"!dist/types/runtime/*", | ||
"!dist/types/lib/*", | ||
"!dist/deno/**/*" | ||
], | ||
"deno": "./dist/browser/index.js" | ||
] | ||
} |
@@ -21,9 +21,9 @@ # jose | ||
`jose` has no dependencies and it exports tree-shakeable ESM. CJS is also supported. | ||
`jose` has no dependencies and it exports tree-shakeable ESM[^cjs]. | ||
## Documentation | ||
`jose` is distributed via [npmjs.com](https://www.npmjs.com/package/jose), [deno.land/x](https://deno.land/x/jose), [cdnjs.com](https://cdnjs.com/libraries/jose), [jsdelivr.com](https://www.jsdelivr.com/package/npm/jose), and [github.com](https://github.com/panva/jose). | ||
`jose` is distributed via [npmjs.com](https://www.npmjs.com/package/jose), [jsr.io](https://jsr.io/@panva/jose), [deno.land/x](https://deno.land/x/jose), [cdnjs.com](https://cdnjs.com/libraries/jose), [jsdelivr.com](https://www.jsdelivr.com/package/npm/jose), and [github.com](https://github.com/panva/jose). | ||
**`example`** ESM import | ||
**`example`** ESM import[^cjs] | ||
@@ -34,8 +34,2 @@ ```js | ||
**`example`** CJS require | ||
```js | ||
const jose = require('jose') | ||
``` | ||
### JSON Web Tokens (JWT) | ||
@@ -127,7 +121,8 @@ | ||
| Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | | ||
| ----------------------------------------------- | ----------------- | ------------------ | --------------- | | ||
| [v5.x](https://github.com/panva/jose/tree/v5.x) | ✅ | ✅ | ✅ | | ||
| [v4.x](https://github.com/panva/jose/tree/v4.x) | ✅ | ❌ | ❌ | | ||
| [v2.x](https://github.com/panva/jose/tree/v2.x) | ✅ | ❌ | ❌ | | ||
| Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | Runtime and Module type | | ||
| ----------------------------------------------- | ----------------- | ------------------ | --------------- | ------------------------------- | | ||
| [v6.x](https://github.com/panva/jose/tree/v6.x) | ✅ | ✅ | ✅ | Universal[^universal] ESM[^cjs] | | ||
| [v5.x](https://github.com/panva/jose/tree/v5.x) | ✅ | ❌ | ❌ | Universal[^universal] CJS + ESM | | ||
| [v4.x](https://github.com/panva/jose/tree/v4.x) | ✅ | ❌ | ❌ | Universal[^universal] CJS + ESM | | ||
| [v2.x](https://github.com/panva/jose/tree/v2.x) | ✅ | ❌ | ❌ | Node.js CJS | | ||
@@ -148,3 +143,2 @@ ## Specifications | ||
- CFRG Elliptic Curve ECDH and Signatures - [RFC8037](https://www.rfc-editor.org/rfc/rfc8037) | ||
- secp256k1 EC Key curve support - [RFC8812](https://www.rfc-editor.org/rfc/rfc8812) | ||
@@ -156,1 +150,7 @@ The algorithm implementations in `jose` have been tested using test vectors from their respective specifications as well as [RFC7520](https://www.rfc-editor.org/rfc/rfc7520). | ||
[sponsor-auth0]: https://a0.to/signup/panva | ||
[WebCryptoAPI]: https://w3c.github.io/webcrypto/ | ||
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | ||
[^cjs]: CJS style `let jose = require('jose')` is possible in Node.js versions where `process.features.require_module` is `true` by default (^20.19.0 || ^22.12.0 || >= 23.0.0) or with the `--experimental-require-module` Node.js CLI flag. | ||
[^universal]: Assumes runtime support of [WebCryptoAPI][] and [Fetch API][] |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Yes
243174
104
5835
2