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

jose-node-esm-runtime

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jose-node-esm-runtime - npm Package Compare versions

Comparing version 4.13.1 to 4.13.2

2

dist/node/esm/jws/general/sign.js

@@ -61,3 +61,3 @@ import { FlattenedSign } from '../flattened/sign.js';

else if (jws.payload !== payload) {
throw new JWSInvalid('inconsistent use of JWS Unencoded Payload Option (RFC7797)');
throw new JWSInvalid('inconsistent use of JWS Unencoded Payload (RFC7797)');
}

@@ -64,0 +64,0 @@ jws.signatures.push(rest);

@@ -11,16 +11,5 @@ import type { KeyLike, DecryptOptions, CompactJWEHeaderParameters, GetKeyFunction, FlattenedJWE, CompactDecryptResult, ResolvedKey } from '../../types';

*
* @example Usage
*
* ```js
* const jwe =
* 'eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0.nyQ19eq9ogh9wA7fFtnI2oouzy5_8b5DeLkoRMfi2yijgfTs2zEnayCEofz_qhnL-nwszabd9qUeHv0-IwvhhJJS7GUJOU3ikiIe42qcIAFme1A_Fo9CTxw4XTOy-I5qanl8So91u6hwfyN1VxAqVLsSE7_23EC-gfGEg_5znew9PyXXsOIE-K_HH7IQowRrlZ1X_bM_Liu53RzDpLDvRz59mp3S8L56YqpM8FexFGTGpEaoTcEIst375qncYt3-79IVR7gZN1RWsWgjPatfvVbnh74PglQcATSf3UUhaW0OAKn6q7r3PDx6DIKQ35bgHQg5QopuN00eIfLQL2trGw.W3grIVj5HVuAb76X.6PcuDe5D6ttWFYyv0oqqdDXfI2R8wBg1F2Q80UUA_Gv8eEimNWfxIWdLxrjzgQGSvIhxmFKuLM0.a93_Ug3uZHuczj70Zavx8Q'
*
* const { plaintext, protectedHeader } = await jose.compactDecrypt(jwe, privateKey)
*
* console.log(protectedHeader)
* console.log(new TextDecoder().decode(plaintext))
* ```
*
* @param jwe Compact JWE.
* @param key Private Key or Secret to decrypt the JWE with.
* @param key Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.

@@ -31,5 +20,6 @@ */

* @param jwe Compact JWE.
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with.
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.
*/
export declare function compactDecrypt<T extends KeyLike = KeyLike>(jwe: string | Uint8Array, getKey: CompactDecryptGetKey, options?: DecryptOptions): Promise<CompactDecryptResult & ResolvedKey<T>>;
import type { KeyLike, JWEKeyManagementHeaderParameters, CompactJWEHeaderParameters, EncryptOptions } from '../../types';
/**
* The CompactEncrypt class is a utility for creating Compact JWE strings.
* The CompactEncrypt class is used to build and encrypt Compact JWE strings.
*
* @example Usage
*
* ```js
* const jwe = await new jose.CompactEncrypt(
* new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
* )
* .setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' })
* .encrypt(publicKey)
*
* console.log(jwe)
* ```
*/

@@ -56,3 +45,4 @@ export declare class CompactEncrypt {

*
* @param key Public Key or Secret to encrypt the JWE with.
* @param key Public Key or Secret to encrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Encryption options.

@@ -59,0 +49,0 @@ */

@@ -11,26 +11,5 @@ import type { FlattenedDecryptResult, KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, GetKeyFunction, ResolvedKey } from '../../types';

*
* @example Usage
*
* ```js
* const jwe = {
* ciphertext: '9EzjFISUyoG-ifC2mSihfP0DPC80yeyrxhTzKt1C_VJBkxeBG0MI4Te61Pk45RAGubUvBpU9jm4',
* iv: '8Fy7A_IuoX5VXG9s',
* tag: 'W76IYV6arGRuDSaSyWrQNg',
* encrypted_key:
* 'Z6eD4UK_yFb5ZoKvKkGAdqywEG_m0e4IYo0x8Vf30LAMJcsc-_zSgIeiF82teZyYi2YYduHKoqImk7MRnoPZOlEs0Q5BNK1OgBmSOhCE8DFyqh9Zh48TCTP6lmBQ52naqoUJFMtHzu-0LwZH26hxos0GP3Dt19O379MJB837TdKKa87skq0zHaVLAquRHOBF77GI54Bc7O49d8aOrSu1VEFGMThlW2caspPRiTSePDMDPq7_WGk50izRhB3Asl9wmP9wEeaTrkJKRnQj5ips1SAZ1hDBsqEQKKukxP1HtdcopHV5_qgwU8Hjm5EwSLMluMQuiE6hwlkXGOujZLVizA',
* aad: 'VGhlIEZlbGxvd3NoaXAgb2YgdGhlIFJpbmc',
* protected: 'eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0',
* }
*
* const { plaintext, protectedHeader, additionalAuthenticatedData } =
* await jose.flattenedDecrypt(jwe, privateKey)
*
* console.log(protectedHeader)
* const decoder = new TextDecoder()
* console.log(decoder.decode(plaintext))
* console.log(decoder.decode(additionalAuthenticatedData))
* ```
*
* @param jwe Flattened JWE.
* @param key Private Key or Secret to decrypt the JWE with.
* @param key Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.

@@ -41,5 +20,6 @@ */

* @param jwe Flattened JWE.
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with.
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.
*/
export declare function flattenedDecrypt<T extends KeyLike = KeyLike>(jwe: FlattenedJWE, getKey: FlattenedDecryptGetKey, options?: DecryptOptions): Promise<FlattenedDecryptResult & ResolvedKey<T>>;

@@ -5,16 +5,4 @@ import type { KeyLike, FlattenedJWE, JWEHeaderParameters, JWEKeyManagementHeaderParameters, EncryptOptions } from '../../types';

/**
* The FlattenedEncrypt class is a utility for creating Flattened JWE objects.
* The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects.
*
* @example Usage
*
* ```js
* const jwe = await new jose.FlattenedEncrypt(
* new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
* )
* .setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' })
* .setAdditionalAuthenticatedData(encoder.encode('The Fellowship of the Ring'))
* .encrypt(publicKey)
*
* console.log(jwe)
* ```
*/

@@ -86,3 +74,4 @@ export declare class FlattenedEncrypt {

*
* @param key Public Key or Secret to encrypt the JWE with.
* @param key Public Key or Secret to encrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Encryption options.

@@ -89,0 +78,0 @@ */

@@ -11,30 +11,5 @@ import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, GeneralJWE, GeneralDecryptResult, ResolvedKey } from '../../types';

*
* @example Usage
*
* ```js
* const jwe = {
* ciphertext: '9EzjFISUyoG-ifC2mSihfP0DPC80yeyrxhTzKt1C_VJBkxeBG0MI4Te61Pk45RAGubUvBpU9jm4',
* iv: '8Fy7A_IuoX5VXG9s',
* tag: 'W76IYV6arGRuDSaSyWrQNg',
* aad: 'VGhlIEZlbGxvd3NoaXAgb2YgdGhlIFJpbmc',
* protected: 'eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0',
* recipients: [
* {
* encrypted_key:
* 'Z6eD4UK_yFb5ZoKvKkGAdqywEG_m0e4IYo0x8Vf30LAMJcsc-_zSgIeiF82teZyYi2YYduHKoqImk7MRnoPZOlEs0Q5BNK1OgBmSOhCE8DFyqh9Zh48TCTP6lmBQ52naqoUJFMtHzu-0LwZH26hxos0GP3Dt19O379MJB837TdKKa87skq0zHaVLAquRHOBF77GI54Bc7O49d8aOrSu1VEFGMThlW2caspPRiTSePDMDPq7_WGk50izRhB3Asl9wmP9wEeaTrkJKRnQj5ips1SAZ1hDBsqEQKKukxP1HtdcopHV5_qgwU8Hjm5EwSLMluMQuiE6hwlkXGOujZLVizA',
* },
* ],
* }
*
* const { plaintext, protectedHeader, additionalAuthenticatedData } =
* await jose.generalDecrypt(jwe, privateKey)
*
* console.log(protectedHeader)
* const decoder = new TextDecoder()
* console.log(decoder.decode(plaintext))
* console.log(decoder.decode(additionalAuthenticatedData))
* ```
*
* @param jwe General JWE.
* @param key Private Key or Secret to decrypt the JWE with.
* @param key Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.

@@ -45,5 +20,6 @@ */

* @param jwe General JWE.
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with.
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.
*/
export declare function generalDecrypt<T extends KeyLike = KeyLike>(jwe: GeneralJWE, getKey: GeneralDecryptGetKey, options?: DecryptOptions): Promise<GeneralDecryptResult & ResolvedKey<T>>;

@@ -17,19 +17,4 @@ import type { KeyLike, GeneralJWE, JWEHeaderParameters, CritOption, DeflateOption } from '../../types';

/**
* The GeneralEncrypt class is a utility for creating General JWE objects.
* The GeneralEncrypt class is used to build and encrypt General JWE objects.
*
* @example Usage
*
* ```js
* const jwe = await new jose.GeneralEncrypt(
* new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
* )
* .setProtectedHeader({ enc: 'A256GCM' })
* .addRecipient(ecPublicKey)
* .setUnprotectedHeader({ alg: 'ECDH-ES+A256KW' })
* .addRecipient(rsaPublicKey)
* .setUnprotectedHeader({ alg: 'RSA-OAEP-384' })
* .encrypt()
*
* console.log(jwe)
* ```
*/

@@ -48,2 +33,3 @@ export declare class GeneralEncrypt {

* @param key Public Key or Secret to encrypt the Content Encryption Key for the recipient with.
* See {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Encryption options.

@@ -50,0 +36,0 @@ */

@@ -8,17 +8,3 @@ import type { KeyLike, FlattenedJWSInput, JWSHeaderParameters } from '../types';

*
* @example Usage
*
* ```js
* const jwt =
* 'eyJqd2siOnsiY3J2IjoiUC0yNTYiLCJ4IjoiVU05ZzVuS25aWFlvdldBbE03NmNMejl2VG96UmpfX0NIVV9kT2wtZ09vRSIsInkiOiJkczhhZVF3MWwyY0RDQTdiQ2tPTnZ3REtwWEFidFhqdnFDbGVZSDhXc19VIiwia3R5IjoiRUMifSwiYWxnIjoiRVMyNTYifQ.eyJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSIsImlhdCI6MTYwNDU4MDc5NH0.60boak3_dErnW47ZPty1C0nrjeVq86EN_eK0GOq6K8w2OA0thKoBxFK4j-NuU9yZ_A9UKGxPT_G87DladBaV9g'
*
* const { payload, protectedHeader } = await jose.jwtVerify(jwt, jose.EmbeddedJWK, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
*
* console.log(protectedHeader)
* console.log(payload)
* ```
*/
export declare function EmbeddedJWK<T extends KeyLike = KeyLike>(protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput): Promise<T>;

@@ -5,20 +5,6 @@ import type { JWK } from '../types';

*
* @example Usage
*
* ```js
* const thumbprint = await jose.calculateJwkThumbprint({
* kty: 'EC',
* crv: 'P-256',
* x: 'jJ6Flys3zK9jUhnOHf6G49Dyp5hah6CNP84-gY-n9eo',
* y: 'nhI6iD5eFXgBTLt_1p3aip-5VbZeMhxeFSpjfEAf7Ww',
* })
*
* console.log(thumbprint)
* // 'w9eYdC6_s_tLQ8lH6PUpc0mddazaqtPgeC2IgWDiqY8'
* ```
*
* @param jwk JSON Web Key.
* @param digestAlgorithm Digest Algorithm to use for calculating the thumbprint. Default is
* "sha256".
* @see [RFC7638](https://www.rfc-editor.org/rfc/rfc7638)
* @see {@link https://www.rfc-editor.org/rfc/rfc7638 RFC7638}
*/

@@ -29,21 +15,7 @@ export declare function calculateJwkThumbprint(jwk: JWK, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>;

*
* @example Usage
*
* ```js
* const thumbprintUri = await jose.calculateJwkThumbprintUri({
* kty: 'EC',
* crv: 'P-256',
* x: 'jJ6Flys3zK9jUhnOHf6G49Dyp5hah6CNP84-gY-n9eo',
* y: 'nhI6iD5eFXgBTLt_1p3aip-5VbZeMhxeFSpjfEAf7Ww',
* })
*
* console.log(thumbprint)
* // 'urn:ietf:params:oauth:jwk-thumbprint:sha-256:w9eYdC6_s_tLQ8lH6PUpc0mddazaqtPgeC2IgWDiqY8'
* ```
*
* @param jwk JSON Web Key.
* @param digestAlgorithm Digest Algorithm to use for calculating the thumbprint. Default is
* "sha256".
* @see [RFC9278](https://www.rfc-editor.org/rfc/rfc9278)
* @see {@link https://www.rfc-editor.org/rfc/rfc9278 RFC9278}
*/
export declare function calculateJwkThumbprintUri(jwk: JWK, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>;

@@ -24,63 +24,4 @@ import type { KeyLike, JWSHeaderParameters, JSONWebKeySet, FlattenedJWSInput } from '../types';

*
* @example Usage
*
* ```js
* const JWKS = jose.createLocalJWKSet({
* keys: [
* {
* kty: 'RSA',
* e: 'AQAB',
* n: '12oBZRhCiZFJLcPg59LkZZ9mdhSMTKAQZYq32k_ti5SBB6jerkh-WzOMAO664r_qyLkqHUSp3u5SbXtseZEpN3XPWGKSxjsy-1JyEFTdLSYe6f9gfrmxkUF_7DTpq0gn6rntP05g2-wFW50YO7mosfdslfrTJYWHFhJALabAeYirYD7-9kqq9ebfFMF4sRRELbv9oi36As6Q9B3Qb5_C1rAzqfao_PCsf9EPsTZsVVVkA5qoIAr47lo1ipfiBPxUCCNSdvkmDTYgvvRm6ZoMjFbvOtgyts55fXKdMWv7I9HMD5HwE9uW839PWA514qhbcIsXEYSFMPMV6fnlsiZvQQ',
* alg: 'PS256',
* },
* {
* crv: 'P-256',
* kty: 'EC',
* x: 'ySK38C1jBdLwDsNWKzzBHqKYEE5Cgv-qjWvorUXk9fw',
* y: '_LeQBw07cf5t57Iavn4j-BqJsAD1dpoz8gokd3sBsOo',
* alg: 'ES256',
* },
* ],
* })
*
* const { payload, protectedHeader } = await jose.jwtVerify(jwt, JWKS, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @example Opting-in to multiple JWKS matches using `createLocalJWKSet`
*
* ```js
* const options = {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* }
* const { payload, protectedHeader } = await jose
* .jwtVerify(jwt, JWKS, options)
* .catch(async (error) => {
* if (error?.code === 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') {
* for await (const publicKey of error) {
* try {
* return await jose.jwtVerify(jwt, publicKey, options)
* } catch (innerError) {
* if (innerError?.code === 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED') {
* continue
* }
* throw innerError
* }
* }
* throw new jose.errors.JWSSignatureVerificationFailed()
* }
*
* throw error
* })
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @param jwks JSON Web Key Set formatted object.
*/
export declare function createLocalJWKSet<T extends KeyLike = KeyLike>(jwks: JSONWebKeySet): (protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput) => Promise<T>;

@@ -20,7 +20,7 @@ import type { KeyLike, JWSHeaderParameters, FlattenedJWSInput } from '../types';

/**
* An instance of [http.Agent](https://nodejs.org/api/http.html#class-httpagent) or
* [https.Agent](https://nodejs.org/api/https.html#class-httpsagent) to pass to the
* [http.get](https://nodejs.org/api/http.html#httpgetoptions-callback) or
* [https.get](https://nodejs.org/api/https.html#httpsgetoptions-callback) method's options. Use
* when behind an http(s) proxy. This is a Node.js runtime specific option, it is ignored when
* 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.

@@ -47,45 +47,2 @@ */

*
* @example Usage
*
* ```js
* const JWKS = jose.createRemoteJWKSet(new URL('https://www.googleapis.com/oauth2/v3/certs'))
*
* const { payload, protectedHeader } = await jose.jwtVerify(jwt, JWKS, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @example Opting-in to multiple JWKS matches using `createRemoteJWKSet`
*
* ```js
* const options = {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* }
* const { payload, protectedHeader } = await jose
* .jwtVerify(jwt, JWKS, options)
* .catch(async (error) => {
* if (error?.code === 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') {
* for await (const publicKey of error) {
* try {
* return await jose.jwtVerify(jwt, publicKey, options)
* } catch (innerError) {
* if (innerError?.code === 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED') {
* continue
* }
* throw innerError
* }
* }
* throw new jose.errors.JWSSignatureVerificationFailed()
* }
*
* throw error
* })
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @param url URL to fetch the JSON Web Key Set from.

@@ -92,0 +49,0 @@ * @param options Options for the remote JSON Web Key Set.

import type { CompactJWSHeaderParameters, KeyLike, SignOptions } from '../../types';
/**
* The CompactSign class is a utility for creating Compact JWS strings.
* The CompactSign class is used to build and sign Compact JWS strings.
*
* @example Usage
*
* ```js
* const jws = await new jose.CompactSign(
* new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
* )
* .setProtectedHeader({ alg: 'ES256' })
* .sign(privateKey)
*
* console.log(jws)
* ```
*/

@@ -30,3 +19,4 @@ export declare class CompactSign {

*
* @param key Private Key or Secret to sign the JWS with.
* @param key Private Key or Secret to sign the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Sign options.

@@ -33,0 +23,0 @@ */

@@ -6,5 +6,3 @@ import type { CompactVerifyResult, FlattenedJWSInput, GetKeyFunction, CompactJWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types';

*
* See
* [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset)
* to verify using a remote JSON Web Key Set.
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
*/

@@ -16,16 +14,5 @@ export interface CompactVerifyGetKey extends GetKeyFunction<CompactJWSHeaderParameters, FlattenedJWSInput> {

*
* @example Usage
*
* ```js
* const jws =
* 'eyJhbGciOiJFUzI1NiJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4.kkAs_gPPxWMI3rHuVlxHaTPfDWDoqdI8jSvuSmqV-8IHIWXg9mcAeC9ggV-45ZHRbiRJ3obUIFo1rHphPA5URg'
*
* const { payload, protectedHeader } = await jose.compactVerify(jws, publicKey)
*
* console.log(protectedHeader)
* console.log(new TextDecoder().decode(payload))
* ```
*
* @param jws Compact JWS.
* @param key Key to verify the JWS with.
* @param key Key to verify the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Verify options.

@@ -36,5 +23,6 @@ */

* @param jws Compact JWS.
* @param getKey Function resolving a key to verify the JWS with.
* @param getKey Function resolving a key to verify the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Verify options.
*/
export declare function compactVerify<T extends KeyLike = KeyLike>(jws: string | Uint8Array, getKey: CompactVerifyGetKey, options?: VerifyOptions): Promise<CompactVerifyResult & ResolvedKey<T>>;
import type { KeyLike, FlattenedJWS, JWSHeaderParameters, SignOptions } from '../../types';
/**
* The FlattenedSign class is a utility for creating Flattened JWS objects.
* The FlattenedSign class is used to build and sign Flattened JWS objects.
*
* @example Usage
*
* ```js
* const jws = await new jose.FlattenedSign(
* new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
* )
* .setProtectedHeader({ alg: 'ES256' })
* .sign(privateKey)
*
* console.log(jws)
* ```
*/

@@ -38,3 +27,4 @@ export declare class FlattenedSign {

*
* @param key Private Key or Secret to sign the JWS with.
* @param key Private Key or Secret to sign the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Sign options.

@@ -41,0 +31,0 @@ */

@@ -6,5 +6,3 @@ import type { FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GetKeyFunction, ResolvedKey } from '../../types';

*
* See
* [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset)
* to verify using a remote JSON Web Key Set.
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
*/

@@ -16,21 +14,5 @@ export interface FlattenedVerifyGetKey extends GetKeyFunction<JWSHeaderParameters | undefined, FlattenedJWSInput> {

*
* @example Usage
*
* ```js
* const decoder = new TextDecoder()
* const jws = {
* signature:
* 'FVVOXwj6kD3DqdfD9yYqfT2W9jv-Nop4kOehp_DeDGNB5dQNSPRvntBY6xH3uxlCxE8na9d_kyhYOcanpDJ0EA',
* payload: 'SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4',
* protected: 'eyJhbGciOiJFUzI1NiJ9',
* }
*
* const { payload, protectedHeader } = await jose.flattenedVerify(jws, publicKey)
*
* console.log(protectedHeader)
* console.log(decoder.decode(payload))
* ```
*
* @param jws Flattened JWS.
* @param key Key to verify the JWS with.
* @param key Key to verify the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Verify options.

@@ -41,5 +23,6 @@ */

* @param jws Flattened JWS.
* @param getKey Function resolving a key to verify the JWS with.
* @param getKey Function resolving a key to verify the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Verify options.
*/
export declare function flattenedVerify<T extends KeyLike = KeyLike>(jws: FlattenedJWSInput, getKey: FlattenedVerifyGetKey, options?: VerifyOptions): Promise<FlattenedVerifyResult & ResolvedKey<T>>;

@@ -23,18 +23,4 @@ import type { KeyLike, GeneralJWS, JWSHeaderParameters, SignOptions } from '../../types';

/**
* The GeneralSign class is a utility for creating General JWS objects.
* The GeneralSign class is used to build and sign General JWS objects.
*
* @example Usage
*
* ```js
* const jws = await new jose.GeneralSign(
* new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
* )
* .addSignature(ecPrivateKey)
* .setProtectedHeader({ alg: 'ES256' })
* .addSignature(rsaPrivateKey)
* .setProtectedHeader({ alg: 'PS256' })
* .sign()
*
* console.log(jws)
* ```
*/

@@ -49,3 +35,4 @@ export declare class GeneralSign {

*
* @param key Private Key or Secret to sign the individual JWS signature with.
* @param key Private Key or Secret to sign the individual JWS signature with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Sign options.

@@ -52,0 +39,0 @@ */

@@ -6,5 +6,3 @@ import type { GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types';

*
* See
* [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset)
* to verify using a remote JSON Web Key Set.
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
*/

@@ -16,24 +14,5 @@ export interface GeneralVerifyGetKey extends GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput> {

*
* @example Usage
*
* ```js
* const jws = {
* payload: 'SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4',
* signatures: [
* {
* signature:
* 'FVVOXwj6kD3DqdfD9yYqfT2W9jv-Nop4kOehp_DeDGNB5dQNSPRvntBY6xH3uxlCxE8na9d_kyhYOcanpDJ0EA',
* protected: 'eyJhbGciOiJFUzI1NiJ9',
* },
* ],
* }
*
* const { payload, protectedHeader } = await jose.generalVerify(jws, publicKey)
*
* console.log(protectedHeader)
* console.log(new TextDecoder().decode(payload))
* ```
*
* @param jws General JWS.
* @param key Key to verify the JWS with.
* @param key Key to verify the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Verify options.

@@ -44,5 +23,6 @@ */

* @param jws General JWS.
* @param getKey Function resolving a key to verify the JWS with.
* @param getKey Function resolving a key to verify the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Verify options.
*/
export declare function generalVerify<T extends KeyLike = KeyLike>(jws: GeneralJWSInput, getKey: GeneralVerifyGetKey, options?: VerifyOptions): Promise<GeneralVerifyResult & ResolvedKey<T>>;

@@ -15,20 +15,5 @@ import type { KeyLike, DecryptOptions, JWTClaimVerificationOptions, GetKeyFunction, CompactJWEHeaderParameters, FlattenedJWE, JWTDecryptResult, ResolvedKey } from '../types';

*
* @example Usage
*
* ```js
* const secret = jose.base64url.decode('zH4NRP1HMALxxCFnRZABFA7GOJtzU_gIj02alfL1lvI')
* const jwt =
* 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0..MB66qstZBPxAXKdsjet_lA.WHbtJTl4taHp7otOHLq3hBvv0yNPsPEKHYInmCPdDDeyV1kU-f-tGEiU4FxlSqkqAT2hVs8_wMNiQFAzPU1PUgIqWCPsBrPP3TtxYsrtwagpn4SvCsUsx0Mhw9ZhliAO8CLmCBQkqr_T9AcYsz5uZw.7nX9m7BGUu_u1p1qFHzyIg'
*
* const { payload, protectedHeader } = await jose.jwtDecrypt(jwt, secret, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
*
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @param jwt JSON Web Token value (encoded as JWE).
* @param key Private Key or Secret to decrypt and verify the JWT with.
* @param key Private Key or Secret to decrypt and verify the JWT with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWT Decryption and JWT Claims Set validation options.

@@ -39,5 +24,6 @@ */

* @param jwt JSON Web Token value (encoded as JWE).
* @param getKey Function resolving Private Key or Secret to decrypt and verify the JWT with.
* @param getKey Function resolving Private Key or Secret to decrypt and verify the JWT with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWT Decryption and JWT Claims Set validation options.
*/
export declare function jwtDecrypt<T extends KeyLike = KeyLike>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<JWTDecryptResult & ResolvedKey<T>>;
import type { EncryptOptions, CompactJWEHeaderParameters, JWEKeyManagementHeaderParameters, KeyLike } from '../types';
import { ProduceJWT } from './produce';
/**
* The EncryptJWT class is a utility for creating Compact JWE formatted JWT strings.
* The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens.
*
* @example Usage
*
* ```js
* const secret = jose.base64url.decode('zH4NRP1HMALxxCFnRZABFA7GOJtzU_gIj02alfL1lvI')
* const jwt = await new jose.EncryptJWT({ 'urn:example:claim': true })
* .setProtectedHeader({ alg: 'dir', enc: 'A128CBC-HS256' })
* .setIssuedAt()
* .setIssuer('urn:example:issuer')
* .setAudience('urn:example:audience')
* .setExpirationTime('2h')
* .encrypt(secret)
*
* console.log(jwt)
* ```
*/

@@ -64,14 +50,17 @@ export declare class EncryptJWT extends ProduceJWT {

/**
* Replicates the "iss" (Issuer) Claim as a JWE Protected Header Parameter as per
* [RFC7519#section-5.3](https://www.rfc-editor.org/rfc/rfc7519#section-5.3).
* Replicates the "iss" (Issuer) Claim as a JWE Protected Header Parameter.
*
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
*/
replicateIssuerAsHeader(): this;
/**
* Replicates the "sub" (Subject) Claim as a JWE Protected Header Parameter as per
* [RFC7519#section-5.3](https://www.rfc-editor.org/rfc/rfc7519#section-5.3).
* Replicates the "sub" (Subject) Claim as a JWE Protected Header Parameter.
*
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
*/
replicateSubjectAsHeader(): this;
/**
* Replicates the "aud" (Audience) Claim as a JWE Protected Header Parameter as per
* [RFC7519#section-5.3](https://www.rfc-editor.org/rfc/rfc7519#section-5.3).
* Replicates the "aud" (Audience) Claim as a JWE Protected Header Parameter.
*
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
*/

@@ -82,3 +71,4 @@ replicateAudienceAsHeader(): this;

*
* @param key Public Key or Secret to encrypt the JWT with.
* @param key Public Key or Secret to encrypt the JWT with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Encryption options.

@@ -85,0 +75,0 @@ */

import type { JWTHeaderParameters, KeyLike, SignOptions } from '../types';
import { ProduceJWT } from './produce';
/**
* The SignJWT class is a utility for creating Compact JWS formatted JWT strings.
* The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens.
*
* @example Usage with a symmetric secret
*
* ```js
* const secret = new TextEncoder().encode(
* 'cc7e0d44fd473002f1c42167459001140ec6389b7353f8088f4d9a95f2f596f2',
* )
* const alg = 'HS256'
*
* const jwt = await new jose.SignJWT({ 'urn:example:claim': true })
* .setProtectedHeader({ alg })
* .setIssuedAt()
* .setIssuer('urn:example:issuer')
* .setAudience('urn:example:audience')
* .setExpirationTime('2h')
* .sign(secret)
*
* console.log(jwt)
* ```
*
* @example Usage with a private PKCS#8 encoded RSA key
*
* ```js
* const alg = 'RS256'
* const pkcs8 = `-----BEGIN PRIVATE KEY-----
* MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCFg4UrY5xtulv
* /NXKmL1J4qI1SopAfTNMo3X7p+kJO7plqUYjzaztcre1qfh0m33Sm1Q8oPbO/GpP
* MU1/HgcceytgJ/b4UwufVVMl9BrMDYG8moDBylbVupFQS3Ly1L9i/iFG9Z9A9xzY
* Zzf799A45bnvNXL6s2glzvjiRvfQ2NDF0anTcnZLcYtC7ugq1IMM+ihAcPfw8Qw2
* chN/SmP4qAM+PKaQwagmU7doqmmyN9u38AfoYZ1GCFhEs5TBBT6H6h9YdHeVtiIq
* 1c+fl03biSIfLrV7dUBD39gBmXBcL/30Ya3D82mCEUC4zg/UkOfQOmkmV3Lc8YUL
* QZ8EJkBLAgMBAAECggEAVuVE/KEP6323WjpbBdAIv7HGahGrgGANvbxZsIhm34ls
* VOPK0XDegZkhAybMZHjRhp+gwVxX5ChC+J3cUpOBH5FNxElgW6HizD2Jcq6t6LoL
* YgPSrfEHm71iHg8JsgrqfUnGYFzMJmv88C6WdCtpgG/qJV1K00/Ly1G1QKoBffEs
* +v4fAMJrCbUdCz1qWto+PU+HLMEo+krfEpGgcmtZeRlDADh8cETMQlgQfQX2VWq/
* aAP4a1SXmo+j0cvRU4W5Fj0RVwNesIpetX2ZFz4p/JmB5sWFEj/fC7h5z2lq+6Bm
* e2T3BHtXkIxoBW0/pYVnASC8P2puO5FnVxDmWuHDYQKBgQDTuuBd3+0tSFVEX+DU
* 5qpFmHm5nyGItZRJTS+71yg5pBxq1KqNCUjAtbxR0q//fwauakh+BwRVCPOrqsUG
* jBSb3NYE70Srp6elqxgkE54PwQx4Mr6exJPnseM9U4K+hULllf5yjM9edreJE1nV
* NVgFjeyafQhrHKwgr7PERJ/ikwKBgQDqqsT1M+EJLmI1HtCspOG6cu7q3gf/wKRh
* E8tu84i3YyBnI8uJkKy92RNVI5fvpBARe3tjSdM25rr2rcrcmF/5g6Q9ImxZPGCt
* 86eOgO9ErNtbc4TEgybsP319UE4O41aKeNiBTAZKoYCxv/dMqG0j4avmWzd+foHq
* gSNUvR2maQKBgQCYeqOsV2B6VPY7KIVFLd0AA9/dwvEmgAYLiA/RShDI+hwQ/5jX
* uxDu37KAhqeC65sHLrmIMUt4Zdr+DRyZK3aIDNEAesPMjw/X6lCXYp1ZISD2yyym
* MFGH8X8CIkstI9Faf9vf6PJKSFrC1/HA7wq17VCwrUzLvrljTMW8meM/CwKBgCpo
* 2leGHLFQFKeM/iF1WuYbR1pi7gcmhY6VyTowARFDdOOu8GXYI5/bz0afvCGvAMho
* DJCREv7lC/zww6zCTPYG+HOj+PjXlJFba3ixjIxYwPvyEJiDK1Ge18sB7Fl8dHNq
* C5ayaqCqN1voWYUdGzxU2IA1E/5kVo5O8FesJeOhAoGBAImJbZFf+D5kA32Xxhac
* 59lLWBCsocvvbd1cvDMNlRywAAyhsCb1SuX4nEAK9mrSBdfmoF2Nm3eilfsOds0f
* K5mX069IKG82CMqh3Mzptd7e7lyb9lsoGO0BAtjho3cWtha/UZ70vfaMzGuZ6JmQ
* ak6k+8+UFd93M4z0Qo74OhXB
* -----END PRIVATE KEY-----`
* const privateKey = await jose.importPKCS8(pkcs8, alg)
*
* const jwt = await new jose.SignJWT({ 'urn:example:claim': true })
* .setProtectedHeader({ alg })
* .setIssuedAt()
* .setIssuer('urn:example:issuer')
* .setAudience('urn:example:audience')
* .setExpirationTime('2h')
* .sign(privateKey)
*
* console.log(jwt)
* ```
*
* @example Usage with a private JWK encoded RSA key
*
* ```js
* const alg = 'RS256'
* const jwk = {
* kty: 'RSA',
* n: 'whYOFK2Ocbbpb_zVypi9SeKiNUqKQH0zTKN1-6fpCTu6ZalGI82s7XK3tan4dJt90ptUPKD2zvxqTzFNfx4HHHsrYCf2-FMLn1VTJfQazA2BvJqAwcpW1bqRUEty8tS_Yv4hRvWfQPcc2Gc3-_fQOOW57zVy-rNoJc744kb30NjQxdGp03J2S3GLQu7oKtSDDPooQHD38PEMNnITf0pj-KgDPjymkMGoJlO3aKppsjfbt_AH6GGdRghYRLOUwQU-h-ofWHR3lbYiKtXPn5dN24kiHy61e3VAQ9_YAZlwXC_99GGtw_NpghFAuM4P1JDn0DppJldy3PGFC0GfBCZASw',
* e: 'AQAB',
* d: 'VuVE_KEP6323WjpbBdAIv7HGahGrgGANvbxZsIhm34lsVOPK0XDegZkhAybMZHjRhp-gwVxX5ChC-J3cUpOBH5FNxElgW6HizD2Jcq6t6LoLYgPSrfEHm71iHg8JsgrqfUnGYFzMJmv88C6WdCtpgG_qJV1K00_Ly1G1QKoBffEs-v4fAMJrCbUdCz1qWto-PU-HLMEo-krfEpGgcmtZeRlDADh8cETMQlgQfQX2VWq_aAP4a1SXmo-j0cvRU4W5Fj0RVwNesIpetX2ZFz4p_JmB5sWFEj_fC7h5z2lq-6Bme2T3BHtXkIxoBW0_pYVnASC8P2puO5FnVxDmWuHDYQ',
* p: '07rgXd_tLUhVRF_g1OaqRZh5uZ8hiLWUSU0vu9coOaQcatSqjQlIwLW8UdKv_38GrmpIfgcEVQjzq6rFBowUm9zWBO9Eq6enpasYJBOeD8EMeDK-nsST57HjPVOCvoVC5ZX-cozPXna3iRNZ1TVYBY3smn0IaxysIK-zxESf4pM',
* q: '6qrE9TPhCS5iNR7QrKThunLu6t4H_8CkYRPLbvOIt2MgZyPLiZCsvdkTVSOX76QQEXt7Y0nTNua69q3K3Jhf-YOkPSJsWTxgrfOnjoDvRKzbW3OExIMm7D99fVBODuNWinjYgUwGSqGAsb_3TKhtI-Gr5ls3fn6B6oEjVL0dpmk',
* dp: 'mHqjrFdgelT2OyiFRS3dAAPf3cLxJoAGC4gP0UoQyPocEP-Y17sQ7t-ygIanguubBy65iDFLeGXa_g0cmSt2iAzRAHrDzI8P1-pQl2KdWSEg9ssspjBRh_F_AiJLLSPRWn_b3-jySkhawtfxwO8Kte1QsK1My765Y0zFvJnjPws',
* dq: 'KmjaV4YcsVAUp4z-IXVa5htHWmLuByaFjpXJOjABEUN0467wZdgjn9vPRp-8Ia8AyGgMkJES_uUL_PDDrMJM9gb4c6P4-NeUkVtreLGMjFjA-_IQmIMrUZ7XywHsWXx0c2oLlrJqoKo3W-hZhR0bPFTYgDUT_mRWjk7wV6wl46E',
* qi: 'iYltkV_4PmQDfZfGFpzn2UtYEKyhy-9t3Vy8Mw2VHLAADKGwJvVK5ficQAr2atIF1-agXY2bd6KV-w52zR8rmZfTr0gobzYIyqHczOm13t7uXJv2WygY7QEC2OGjdxa2Fr9RnvS99ozMa5nomZBqTqT7z5QV33czjPRCjvg6FcE',
* }
* const privateKey = await jose.importJWK(jwk, alg)
*
* const jwt = await new jose.SignJWT({ 'urn:example:claim': true })
* .setProtectedHeader({ alg })
* .setIssuedAt()
* .setIssuer('urn:example:issuer')
* .setAudience('urn:example:audience')
* .setExpirationTime('2h')
* .sign(privateKey)
*
* console.log(jwt)
* ```
*/

@@ -109,3 +18,4 @@ export declare class SignJWT extends ProduceJWT {

*
* @param key Private Key or Secret to sign the JWT with.
* @param key Private Key or Secret to sign the JWT with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWT Sign options.

@@ -112,0 +22,0 @@ */

@@ -10,25 +10,2 @@ import type { JWSHeaderParameters, JWTClaimVerificationOptions, JWTPayload } from '../types';

*
* @example Encoding
*
* ```js
* const unsecuredJwt = new jose.UnsecuredJWT({ 'urn:example:claim': true })
* .setIssuedAt()
* .setIssuer('urn:example:issuer')
* .setAudience('urn:example:audience')
* .setExpirationTime('2h')
* .encode()
*
* console.log(unsecuredJwt)
* ```
*
* @example Decoding
*
* ```js
* const payload = jose.UnsecuredJWT.decode(jwt, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
*
* console.log(payload)
* ```
*/

@@ -35,0 +12,0 @@ export declare class UnsecuredJWT extends ProduceJWT {

@@ -9,5 +9,3 @@ import type { KeyLike, VerifyOptions, JWTClaimVerificationOptions, JWTHeaderParameters, GetKeyFunction, FlattenedJWSInput, JWTVerifyResult, ResolvedKey } from '../types';

*
* See
* [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset)
* to verify using a remote JSON Web Key Set.
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
*/

@@ -20,70 +18,5 @@ export interface JWTVerifyGetKey extends GetKeyFunction<JWTHeaderParameters, FlattenedJWSInput> {

*
* @example Usage with a symmetric secret
*
* ```js
* const secret = new TextEncoder().encode(
* 'cc7e0d44fd473002f1c42167459001140ec6389b7353f8088f4d9a95f2f596f2',
* )
* const jwt =
* 'eyJhbGciOiJIUzI1NiJ9.eyJ1cm46ZXhhbXBsZTpjbGFpbSI6dHJ1ZSwiaWF0IjoxNjY5MDU2MjMxLCJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSJ9.C4iSlLfAUMBq--wnC6VqD9gEOhwpRZpoRarE0m7KEnI'
*
* const { payload, protectedHeader } = await jose.jwtVerify(jwt, secret, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
*
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @example Usage with a public SPKI encoded RSA key
*
* ```js
* const alg = 'RS256'
* const spki = `-----BEGIN PUBLIC KEY-----
* MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwhYOFK2Ocbbpb/zVypi9
* SeKiNUqKQH0zTKN1+6fpCTu6ZalGI82s7XK3tan4dJt90ptUPKD2zvxqTzFNfx4H
* HHsrYCf2+FMLn1VTJfQazA2BvJqAwcpW1bqRUEty8tS/Yv4hRvWfQPcc2Gc3+/fQ
* OOW57zVy+rNoJc744kb30NjQxdGp03J2S3GLQu7oKtSDDPooQHD38PEMNnITf0pj
* +KgDPjymkMGoJlO3aKppsjfbt/AH6GGdRghYRLOUwQU+h+ofWHR3lbYiKtXPn5dN
* 24kiHy61e3VAQ9/YAZlwXC/99GGtw/NpghFAuM4P1JDn0DppJldy3PGFC0GfBCZA
* SwIDAQAB
* -----END PUBLIC KEY-----`
* const publicKey = await jose.importSPKI(spki, alg)
* const jwt =
* 'eyJhbGciOiJSUzI1NiJ9.eyJ1cm46ZXhhbXBsZTpjbGFpbSI6dHJ1ZSwiaWF0IjoxNjY5MDU2NDg4LCJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSJ9.gXrPZ3yM_60dMXGE69dusbpzYASNA-XIOwsb5D5xYnSxyj6_D6OR_uR_1vqhUm4AxZxcrH1_-XJAve9HCw8az_QzHcN-nETt-v6stCsYrn6Bv1YOc-mSJRZ8ll57KVqLbCIbjKwerNX5r2_Qg2TwmJzQdRs-AQDhy-s_DlJd8ql6wR4n-kDZpar-pwIvz4fFIN0Fj57SXpAbLrV6Eo4Byzl0xFD8qEYEpBwjrMMfxCZXTlAVhAq6KCoGlDTwWuExps342-0UErEtyIqDnDGcrfNWiUsoo8j-29IpKd-w9-C388u-ChCxoHz--H8WmMSZzx3zTXsZ5lXLZ9IKfanDKg'
*
* const { payload, protectedHeader } = await jose.jwtVerify(jwt, publicKey, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
*
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @example Usage with a public JWK encoded RSA key
*
* ```js
* const alg = 'RS256'
* const jwk = {
* kty: 'RSA',
* n: 'whYOFK2Ocbbpb_zVypi9SeKiNUqKQH0zTKN1-6fpCTu6ZalGI82s7XK3tan4dJt90ptUPKD2zvxqTzFNfx4HHHsrYCf2-FMLn1VTJfQazA2BvJqAwcpW1bqRUEty8tS_Yv4hRvWfQPcc2Gc3-_fQOOW57zVy-rNoJc744kb30NjQxdGp03J2S3GLQu7oKtSDDPooQHD38PEMNnITf0pj-KgDPjymkMGoJlO3aKppsjfbt_AH6GGdRghYRLOUwQU-h-ofWHR3lbYiKtXPn5dN24kiHy61e3VAQ9_YAZlwXC_99GGtw_NpghFAuM4P1JDn0DppJldy3PGFC0GfBCZASw',
* e: 'AQAB',
* }
* const publicKey = await jose.importJWK(jwk, alg)
* const jwt =
* 'eyJhbGciOiJSUzI1NiJ9.eyJ1cm46ZXhhbXBsZTpjbGFpbSI6dHJ1ZSwiaWF0IjoxNjY5MDU2NDg4LCJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSJ9.gXrPZ3yM_60dMXGE69dusbpzYASNA-XIOwsb5D5xYnSxyj6_D6OR_uR_1vqhUm4AxZxcrH1_-XJAve9HCw8az_QzHcN-nETt-v6stCsYrn6Bv1YOc-mSJRZ8ll57KVqLbCIbjKwerNX5r2_Qg2TwmJzQdRs-AQDhy-s_DlJd8ql6wR4n-kDZpar-pwIvz4fFIN0Fj57SXpAbLrV6Eo4Byzl0xFD8qEYEpBwjrMMfxCZXTlAVhAq6KCoGlDTwWuExps342-0UErEtyIqDnDGcrfNWiUsoo8j-29IpKd-w9-C388u-ChCxoHz--H8WmMSZzx3zTXsZ5lXLZ9IKfanDKg'
*
* const { payload, protectedHeader } = await jose.jwtVerify(jwt, publicKey, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
*
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @param jwt JSON Web Token value (encoded as JWS).
* @param key Key to verify the JWT with.
* @param key Key to verify the JWT with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWT Decryption and JWT Claims Set validation options.

@@ -93,19 +26,7 @@ */

/**
* @example Usage with a public JSON Web Key Set hosted on a remote URL
*
* ```js
* const JWKS = jose.createRemoteJWKSet(new URL('https://www.googleapis.com/oauth2/v3/certs'))
*
* const { payload, protectedHeader } = await jose.jwtVerify(jwt, JWKS, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @param jwt JSON Web Token value (encoded as JWS).
* @param getKey Function resolving a key to verify the JWT with.
* @param getKey Function resolving a key to verify the JWT with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWT Decryption and JWT Claims Set validation options.
*/
export declare function jwtVerify<T extends KeyLike = KeyLike>(jwt: string | Uint8Array, getKey: JWTVerifyGetKey, options?: JWTVerifyOptions): Promise<JWTVerifyResult & ResolvedKey<T>>;

@@ -6,10 +6,2 @@ import type { JWK, KeyLike } from '../types';

*
* @example Usage
*
* ```js
* const spkiPem = await jose.exportSPKI(publicKey)
*
* console.log(spkiPem)
* ```
*
* @param key Key representation to transform to a PEM-encoded SPKI string format.

@@ -22,10 +14,2 @@ */

*
* @example Usage
*
* ```js
* const pkcs8Pem = await jose.exportPKCS8(privateKey)
*
* console.log(pkcs8Pem)
* ```
*
* @param key Key representation to transform to a PEM-encoded PKCS8 string format.

@@ -37,14 +21,4 @@ */

*
* @example Usage
*
* ```js
* const privateJwk = await jose.exportJWK(privateKey)
* const publicJwk = await jose.exportJWK(publicKey)
*
* console.log(privateJwk)
* console.log(publicJwk)
* ```
*
* @param key Key representation to export as JWK.
*/
export declare function exportJWK(key: KeyLike | Uint8Array): Promise<JWK>;

@@ -21,3 +21,3 @@ import type { KeyLike } from '../types';

* (Only effective in Web Crypto API runtimes) The value to use as
* [SubtleCrypto.generateKey()](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey)
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey SubtleCrypto.generateKey()}
* `extractable` argument. Default is false.

@@ -34,10 +34,2 @@ */

*
* @example Usage
*
* ```js
* const { publicKey, privateKey } = await jose.generateKeyPair('PS256')
* console.log(publicKey)
* console.log(privateKey)
* ```
*
* @param alg JWA Algorithm Identifier to be used with the generated key pair.

@@ -44,0 +36,0 @@ * @param options Additional options passed down to the key pair generation.

@@ -5,3 +5,3 @@ import type { KeyLike } from '../types';

* (Only effective in Web Crypto API runtimes) The value to use as
* [SubtleCrypto.generateKey()](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey)
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey SubtleCrypto.generateKey()}
* `extractable` argument. Default is false.

@@ -17,9 +17,2 @@ */

*
* @example Usage
*
* ```js
* const secret = await jose.generateSecret('HS256')
* console.log(secret)
* ```
*
* @param alg JWA Algorithm Identifier to be used with the generated secret.

@@ -26,0 +19,0 @@ * @param options Additional options passed down to the secret generation.

@@ -5,3 +5,3 @@ import type { JWK, KeyLike } from '../types';

* (Only effective in Web Crypto API runtimes) The value to use as
* [SubtleCrypto.importKey()](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey)
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey SubtleCrypto.importKey()}
* `extractable` argument. Default is false.

@@ -13,19 +13,8 @@ */

* Imports a PEM-encoded SPKI string as a runtime-specific public key representation (KeyObject or
* CryptoKey). See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210) to learn
* about key to algorithm requirements and mapping.
* CryptoKey).
*
* @example Usage
*
* ```js
* const algorithm = 'ES256'
* const spki = `-----BEGIN PUBLIC KEY-----
* MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFlHHWfLk0gLBbsLTcuCrbCqoHqmM
* YJepMC+Q+Dd6RBmBiA41evUsNMwLeN+PNFqib+xwi9JkJ8qhZkq8Y/IzGg==
* -----END PUBLIC KEY-----`
* const ecPublicKey = await jose.importSPKI(spki, algorithm)
* ```
*
* @param pem 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.
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
*/

@@ -35,26 +24,8 @@ export declare function importSPKI<T extends KeyLike = KeyLike>(spki: string, alg: string, options?: PEMImportOptions): Promise<T>;

* Imports the SPKI from an X.509 string certificate as a runtime-specific public key representation
* (KeyObject or CryptoKey). See [Algorithm Key
* Requirements](https://github.com/panva/jose/issues/210) to learn about key to algorithm
* requirements and mapping.
* (KeyObject or CryptoKey).
*
* @example Usage
*
* ```js
* const algorithm = 'ES256'
* const x509 = `-----BEGIN CERTIFICATE-----
* MIIBXjCCAQSgAwIBAgIGAXvykuMKMAoGCCqGSM49BAMCMDYxNDAyBgNVBAMMK3Np
* QXBNOXpBdk1VaXhXVWVGaGtjZXg1NjJRRzFyQUhXaV96UlFQTVpQaG8wHhcNMjEw
* OTE3MDcwNTE3WhcNMjIwNzE0MDcwNTE3WjA2MTQwMgYDVQQDDCtzaUFwTTl6QXZN
* VWl4V1VlRmhrY2V4NTYyUUcxckFIV2lfelJRUE1aUGhvMFkwEwYHKoZIzj0CAQYI
* KoZIzj0DAQcDQgAE8PbPvCv5D5xBFHEZlBp/q5OEUymq7RIgWIi7tkl9aGSpYE35
* UH+kBKDnphJO3odpPZ5gvgKs2nwRWcrDnUjYLDAKBggqhkjOPQQDAgNIADBFAiEA
* 1yyMTRe66MhEXID9+uVub7woMkNYd0LhSHwKSPMUUTkCIFQGsfm1ecXOpeGOufAh
* v+A1QWZMuTWqYt+uh/YSRNDn
* -----END CERTIFICATE-----`
* const ecPublicKey = await jose.importX509(x509, algorithm)
* ```
*
* @param pem 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.
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
*/

@@ -64,20 +35,8 @@ export declare function importX509<T extends KeyLike = KeyLike>(x509: string, alg: string, options?: PEMImportOptions): Promise<T>;

* Imports a PEM-encoded PKCS#8 string as a runtime-specific private key representation (KeyObject
* or CryptoKey). See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210) to
* learn about key to algorithm requirements and mapping. Encrypted keys are not supported.
* or CryptoKey).
*
* @example Usage
*
* ```js
* const algorithm = 'ES256'
* const pkcs8 = `-----BEGIN PRIVATE KEY-----
* MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgiyvo0X+VQ0yIrOaN
* nlrnUclopnvuuMfoc8HHly3505OhRANCAAQWUcdZ8uTSAsFuwtNy4KtsKqgeqYxg
* l6kwL5D4N3pEGYGIDjV69Sw0zAt43480WqJv7HCL0mQnyqFmSrxj8jMa
* -----END PRIVATE KEY-----`
* const ecPrivateKey = await jose.importPKCS8(pkcs8, algorithm)
* ```
*
* @param pem 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.
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
*/

@@ -87,35 +46,11 @@ export declare function importPKCS8<T extends KeyLike = KeyLike>(pkcs8: string, alg: string, options?: PEMImportOptions): Promise<T>;

* Imports a JWK to a runtime-specific key representation (KeyLike). Either JWK "alg" (Algorithm)
* Parameter must be present or the optional "alg" argument. When running on a runtime using [Web
* Cryptography API](https://www.w3.org/TR/WebCryptoAPI/) the jwk parameters "use", "key_ops", and
* "ext" are also used in the resulting `CryptoKey`. See [Algorithm Key
* Requirements](https://github.com/panva/jose/issues/210) to learn about key to algorithm
* requirements and mapping.
* Parameter must be present or the optional "alg" argument. When running on a runtime using
* {@link https://www.w3.org/TR/WebCryptoAPI/ Web Cryptography API} the jwk parameters "use",
* "key_ops", and "ext" are also used in the resulting `CryptoKey`.
*
* @example Usage
*
* ```js
* const ecPublicKey = await jose.importJWK(
* {
* crv: 'P-256',
* kty: 'EC',
* x: 'ySK38C1jBdLwDsNWKzzBHqKYEE5Cgv-qjWvorUXk9fw',
* y: '_LeQBw07cf5t57Iavn4j-BqJsAD1dpoz8gokd3sBsOo',
* },
* 'ES256',
* )
*
* const rsaPublicKey = await jose.importJWK(
* {
* kty: 'RSA',
* e: 'AQAB',
* n: '12oBZRhCiZFJLcPg59LkZZ9mdhSMTKAQZYq32k_ti5SBB6jerkh-WzOMAO664r_qyLkqHUSp3u5SbXtseZEpN3XPWGKSxjsy-1JyEFTdLSYe6f9gfrmxkUF_7DTpq0gn6rntP05g2-wFW50YO7mosfdslfrTJYWHFhJALabAeYirYD7-9kqq9ebfFMF4sRRELbv9oi36As6Q9B3Qb5_C1rAzqfao_PCsf9EPsTZsVVVkA5qoIAr47lo1ipfiBPxUCCNSdvkmDTYgvvRm6ZoMjFbvOtgyts55fXKdMWv7I9HMD5HwE9uW839PWA514qhbcIsXEYSFMPMV6fnlsiZvQQ',
* },
* 'PS256',
* )
* ```
*
* @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.
* in Web Crypto API runtimes. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
* @param octAsKeyObject Forces a symmetric key to be imported to a KeyObject or CryptoKey. Default

@@ -122,0 +57,0 @@ * is true unless JWK "ext" (Extractable) is true.

/**
* KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets. These are
* instances of [CryptoKey](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) and
* additionally [KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) in Node.js runtime.
* [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
* instances of {@link https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey CryptoKey} and
* additionally {@link https://nodejs.org/api/crypto.html#class-keyobject KeyObject} in Node.js
* runtime.
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array Uint8Array}
* instances are also accepted as symmetric secret representation only.
*
* [Key Import Functions](../modules/key_import.md#readme) can be used to import PEM, or JWK
* formatted asymmetric keys and certificates to these runtime-specific representations.
* [Key Import Functions](../modules/key_import.md) can be used to import PEM, or JWK formatted
* asymmetric keys and certificates to these runtime-specific representations.
*
* In Node.js the [Buffer](https://nodejs.org/api/buffer.html#buffer) class is a subclass of
* In Node.js the {@link https://nodejs.org/api/buffer.html#buffer Buffer} class is a subclass of
* Uint8Array and so Buffer can be provided for symmetric secrets as well.
*
* [KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) is a representation of a
* {@link https://nodejs.org/api/crypto.html#class-keyobject KeyObject} is a representation of a
* key/secret available in the Node.js runtime. In addition to the import functions of this library
* you may use the runtime APIs
* [crypto.createPublicKey](https://nodejs.org/api/crypto.html#cryptocreatepublickeykey),
* [crypto.createPrivateKey](https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey), and
* [crypto.createSecretKey](https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding) to
* obtain a KeyObject from your existing key material.
* {@link https://nodejs.org/api/crypto.html#cryptocreatepublickeykey crypto.createPublicKey},
* {@link https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey crypto.createPrivateKey}, and
* {@link https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding crypto.createSecretKey}
* to obtain a `KeyObject` from your existing key material.
*
* [CryptoKey](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) is a representation of a
* key/secret available in the Browser and Web-interoperable runtimes. In addition to the import
* functions of this library you may use the
* [SubtleCrypto.importKey](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey)
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey CryptoKey} is a representation
* of a key/secret available in the Browser and Web-interoperable runtimes. In addition to the
* import functions of this library you may use the
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey SubtleCrypto.importKey}
* API to obtain a CryptoKey from your existing key material.
*
* @example Import a PEM-encoded SPKI Public Key
*
* ```js
* const algorithm = 'ES256'
* const spki = `-----BEGIN PUBLIC KEY-----
* MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFlHHWfLk0gLBbsLTcuCrbCqoHqmM
* YJepMC+Q+Dd6RBmBiA41evUsNMwLeN+PNFqib+xwi9JkJ8qhZkq8Y/IzGg==
* -----END PUBLIC KEY-----`
* const ecPublicKey = await jose.importSPKI(spki, algorithm)
* ```
*
* @example Import SPKI from an X.509 Certificate
*
* ```js
* const algorithm = 'ES256'
* const x509 = `-----BEGIN CERTIFICATE-----
* MIIBXjCCAQSgAwIBAgIGAXvykuMKMAoGCCqGSM49BAMCMDYxNDAyBgNVBAMMK3Np
* QXBNOXpBdk1VaXhXVWVGaGtjZXg1NjJRRzFyQUhXaV96UlFQTVpQaG8wHhcNMjEw
* OTE3MDcwNTE3WhcNMjIwNzE0MDcwNTE3WjA2MTQwMgYDVQQDDCtzaUFwTTl6QXZN
* VWl4V1VlRmhrY2V4NTYyUUcxckFIV2lfelJRUE1aUGhvMFkwEwYHKoZIzj0CAQYI
* KoZIzj0DAQcDQgAE8PbPvCv5D5xBFHEZlBp/q5OEUymq7RIgWIi7tkl9aGSpYE35
* UH+kBKDnphJO3odpPZ5gvgKs2nwRWcrDnUjYLDAKBggqhkjOPQQDAgNIADBFAiEA
* 1yyMTRe66MhEXID9+uVub7woMkNYd0LhSHwKSPMUUTkCIFQGsfm1ecXOpeGOufAh
* v+A1QWZMuTWqYt+uh/YSRNDn
* -----END CERTIFICATE-----`
* const ecPublicKey = await jose.importX509(x509, algorithm)
* ```
*
* @example Import a PEM-encoded PKCS8 Private Key
*
* ```js
* const algorithm = 'ES256'
* const pkcs8 = `-----BEGIN PRIVATE KEY-----
* MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgiyvo0X+VQ0yIrOaN
* nlrnUclopnvuuMfoc8HHly3505OhRANCAAQWUcdZ8uTSAsFuwtNy4KtsKqgeqYxg
* l6kwL5D4N3pEGYGIDjV69Sw0zAt43480WqJv7HCL0mQnyqFmSrxj8jMa
* -----END PRIVATE KEY-----`
* const ecPrivateKey = await jose.importPKCS8(pkcs8, algorithm)
* ```
*
* @example Import a JSON Web Key (JWK)
*
* ```js
* const ecPublicKey = await jose.importJWK(
* {
* crv: 'P-256',
* kty: 'EC',
* x: 'ySK38C1jBdLwDsNWKzzBHqKYEE5Cgv-qjWvorUXk9fw',
* y: '_LeQBw07cf5t57Iavn4j-BqJsAD1dpoz8gokd3sBsOo',
* },
* 'ES256',
* )
*
* const rsaPublicKey = await jose.importJWK(
* {
* kty: 'RSA',
* e: 'AQAB',
* n: '12oBZRhCiZFJLcPg59LkZZ9mdhSMTKAQZYq32k_ti5SBB6jerkh-WzOMAO664r_qyLkqHUSp3u5SbXtseZEpN3XPWGKSxjsy-1JyEFTdLSYe6f9gfrmxkUF_7DTpq0gn6rntP05g2-wFW50YO7mosfdslfrTJYWHFhJALabAeYirYD7-9kqq9ebfFMF4sRRELbv9oi36As6Q9B3Qb5_C1rAzqfao_PCsf9EPsTZsVVVkA5qoIAr47lo1ipfiBPxUCCNSdvkmDTYgvvRm6ZoMjFbvOtgyts55fXKdMWv7I9HMD5HwE9uW839PWA514qhbcIsXEYSFMPMV6fnlsiZvQQ',
* },
* 'PS256',
* )
* ```
*/

@@ -94,4 +33,4 @@ export type KeyLike = { type: string }

/**
* JSON Web Key ([JWK](https://www.rfc-editor.org/rfc/rfc7517)). "RSA", "EC", "OKP", and "oct" key
* types are supported.
* JSON Web Key ({@link https://www.rfc-editor.org/rfc/rfc7517 JWK}). "RSA", "EC", "OKP", and "oct"
* key types are supported.
*/

@@ -189,4 +128,5 @@ export interface JWK {

/**
* The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When RFC7797
* "b64": false is used the value passed may also be a Uint8Array.
* The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When when
* JWS Unencoded Payload ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) "b64": false is
* used the value passed may also be a Uint8Array.
*/

@@ -204,3 +144,3 @@ payload: string | Uint8Array

* Flattened JWS definition. Payload is returned as an empty string when JWS Unencoded Payload
* Option [RFC7797](https://www.rfc-editor.org/rfc/rfc7797) is used.
* ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) is used.
*/

@@ -213,4 +153,4 @@ export interface FlattenedJWS extends Partial<FlattenedJWSInput> {

/**
* General JWS definition. Payload is returned as an empty string when JWS Unencoded Payload Option
* [RFC7797](https://www.rfc-editor.org/rfc/rfc7797) is used.
* General JWS definition. Payload is returned as an empty string when JWS Unencoded Payload
* ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) is used.
*/

@@ -255,3 +195,3 @@ export interface GeneralJWS {

* This JWS Extension Header Parameter modifies the JWS Payload representation and the JWS Signing
* Input computation as per [RFC7797](https://www.rfc-editor.org/rfc/rfc7797).
* Input computation as per {@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}.
*/

@@ -483,3 +423,3 @@ b64?: boolean

*
* @see [RFC7519#section-4.1.1](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.1)
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.1 RFC7519#section-4.1.1}
*/

@@ -491,7 +431,11 @@ iss?: string

*
* @see [RFC7519#section-4.1.2](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.2)
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.2 RFC7519#section-4.1.2}
*/
sub?: string
/** JWT Audience [RFC7519#section-4.1.3](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.3). */
/**
* JWT Audience
*
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.3 RFC7519#section-4.1.3}
*/
aud?: string | string[]

@@ -502,3 +446,3 @@

*
* @see [RFC7519#section-4.1.7](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.7)
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.7 RFC7519#section-4.1.7}
*/

@@ -510,3 +454,3 @@ jti?: string

*
* @see [RFC7519#section-4.1.5](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5)
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5 RFC7519#section-4.1.5}
*/

@@ -518,3 +462,3 @@ nbf?: number

*
* @see [RFC7519#section-4.1.4](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4)
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4 RFC7519#section-4.1.4}
*/

@@ -526,3 +470,3 @@ exp?: number

*
* @see [RFC7519#section-4.1.6](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6)
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 RFC7519#section-4.1.6}
*/

@@ -537,3 +481,3 @@ iat?: number

* Deflate Raw implementation, e.g. promisified
* [zlib.deflateRaw](https://nodejs.org/api/zlib.html#zlibdeflaterawbuffer-options-callback).
* {@link https://nodejs.org/api/zlib.html#zlibdeflaterawbuffer-options-callback zlib.deflateRaw}.
*/

@@ -546,3 +490,3 @@ export interface DeflateFunction {

* Inflate Raw implementation, e.g. promisified
* [zlib.inflateRaw](https://nodejs.org/api/zlib.html#zlibinflaterawbuffer-options-callback).
* {@link https://nodejs.org/api/zlib.html#zlibinflaterawbuffer-options-callback zlib.inflateRaw}.
*/

@@ -549,0 +493,0 @@ export interface InflateFunction {

@@ -8,11 +8,4 @@ import type { JWTPayload } from '../types';

*
* @example Usage
*
* ```js
* const claims = jose.decodeJwt(token)
* console.log(claims)
* ```
*
* @param jwt JWT token in compact JWS serialization.
*/
export declare function decodeJwt(jwt: string): JWTPayload;

@@ -6,11 +6,4 @@ import type { JWSHeaderParameters, JWEHeaderParameters } from '../types';

*
* @example Usage
*
* ```js
* const protectedHeader = jose.decodeProtectedHeader(token)
* console.log(protectedHeader)
* ```
*
* @param token JWE/JWS/JWT token in any JOSE serialization.
*/
export declare function decodeProtectedHeader(token: string | object): ProtectedHeaderParameters;
import type { KeyLike } from '../types';
/** A generic Error subclass that all other specific JOSE Error subclasses inherit from. */
/**
* A generic Error that all other JOSE specific Error subclasses extend.
*
*/
export declare class JOSEError extends Error {

@@ -10,3 +13,6 @@ /** A unique error code for the particular error subclass. */

}
/** An error subclass thrown when a JWT Claim Set member validation fails. */
/**
* An error subclass thrown when a JWT Claim Set member validation fails.
*
*/
export declare class JWTClaimValidationFailed extends JOSEError {

@@ -21,3 +27,6 @@ static get code(): 'ERR_JWT_CLAIM_VALIDATION_FAILED';

}
/** An error subclass thrown when a JWT is expired. */
/**
* An error subclass thrown when a JWT is expired.
*
*/
export declare class JWTExpired extends JOSEError implements JWTClaimValidationFailed {

@@ -32,3 +41,6 @@ static get code(): 'ERR_JWT_EXPIRED';

}
/** An error subclass thrown when a JOSE Algorithm is not allowed per developer preference. */
/**
* An error subclass thrown when a JOSE Algorithm is not allowed per developer preference.
*
*/
export declare class JOSEAlgNotAllowed extends JOSEError {

@@ -41,2 +53,3 @@ static get code(): 'ERR_JOSE_ALG_NOT_ALLOWED';

* implementation or JOSE in general.
*
*/

@@ -47,3 +60,6 @@ export declare class JOSENotSupported extends JOSEError {

}
/** An error subclass thrown when a JWE ciphertext decryption fails. */
/**
* An error subclass thrown when a JWE ciphertext decryption fails.
*
*/
export declare class JWEDecryptionFailed extends JOSEError {

@@ -54,3 +70,6 @@ static get code(): 'ERR_JWE_DECRYPTION_FAILED';

}
/** An error subclass thrown when a JWE is invalid. */
/**
* An error subclass thrown when a JWE is invalid.
*
*/
export declare class JWEInvalid extends JOSEError {

@@ -60,3 +79,6 @@ static get code(): 'ERR_JWE_INVALID';

}
/** An error subclass thrown when a JWS is invalid. */
/**
* An error subclass thrown when a JWS is invalid.
*
*/
export declare class JWSInvalid extends JOSEError {

@@ -66,3 +88,6 @@ static get code(): 'ERR_JWS_INVALID';

}
/** An error subclass thrown when a JWT is invalid. */
/**
* An error subclass thrown when a JWT is invalid.
*
*/
export declare class JWTInvalid extends JOSEError {

@@ -72,3 +97,6 @@ static get code(): 'ERR_JWT_INVALID';

}
/** An error subclass thrown when a JWK is invalid. */
/**
* An error subclass thrown when a JWK is invalid.
*
*/
export declare class JWKInvalid extends JOSEError {

@@ -78,3 +106,6 @@ static get code(): 'ERR_JWK_INVALID';

}
/** An error subclass thrown when a JWKS is invalid. */
/**
* An error subclass thrown when a JWKS is invalid.
*
*/
export declare class JWKSInvalid extends JOSEError {

@@ -84,3 +115,6 @@ static get code(): 'ERR_JWKS_INVALID';

}
/** An error subclass thrown when no keys match from a JWKS. */
/**
* An error subclass thrown when no keys match from a JWKS.
*
*/
export declare class JWKSNoMatchingKey extends JOSEError {

@@ -91,3 +125,6 @@ static get code(): 'ERR_JWKS_NO_MATCHING_KEY';

}
/** An error subclass thrown when multiple keys match from a JWKS. */
/**
* An error subclass thrown when multiple keys match from a JWKS.
*
*/
export declare class JWKSMultipleMatchingKeys extends JOSEError {

@@ -100,3 +137,6 @@ /** @ignore */

}
/** Timeout was reached when retrieving the JWKS response. */
/**
* Timeout was reached when retrieving the JWKS response.
*
*/
export declare class JWKSTimeout extends JOSEError {

@@ -107,3 +147,6 @@ static get code(): 'ERR_JWKS_TIMEOUT';

}
/** An error subclass thrown when JWS signature verification fails. */
/**
* An error subclass thrown when JWS signature verification fails.
*
*/
export declare class JWSSignatureVerificationFailed extends JOSEError {

@@ -110,0 +153,0 @@ static get code(): 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';

{
"name": "jose-node-esm-runtime",
"version": "4.13.1",
"version": "4.13.2",
"homepage": "https://github.com/panva/jose",

@@ -5,0 +5,0 @@ "repository": "panva/jose",

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