jose-browser-runtime
Advanced tools
Comparing version 4.1.5 to 4.2.0
export { compactDecrypt } from './jwe/compact/decrypt.js'; | ||
export { flattenedDecrypt } from './jwe/flattened/decrypt.js'; | ||
export { generalDecrypt } from './jwe/general/decrypt.js'; | ||
export { GeneralEncrypt } from './jwe/general/encrypt.js'; | ||
export { compactVerify } from './jws/compact/verify.js'; | ||
@@ -5,0 +6,0 @@ export { flattenedVerify } from './jws/flattened/verify.js'; |
@@ -10,2 +10,3 @@ import { encode as base64url } from '../../runtime/base64url.js'; | ||
import validateCrit from '../../lib/validate_crit.js'; | ||
export const unprotected = Symbol(); | ||
export class FlattenedEncrypt { | ||
@@ -69,3 +70,3 @@ constructor(plaintext) { | ||
if (!isDisjoint(this._protectedHeader, this._unprotectedHeader, this._sharedUnprotectedHeader)) { | ||
throw new JWEInvalid('JWE Shared Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint'); | ||
throw new JWEInvalid('JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint'); | ||
} | ||
@@ -109,7 +110,17 @@ const joseHeader = { | ||
if (parameters) { | ||
if (!this._protectedHeader) { | ||
this.setProtectedHeader(parameters); | ||
if (options && unprotected in options) { | ||
if (!this._unprotectedHeader) { | ||
this.setUnprotectedHeader(parameters); | ||
} | ||
else { | ||
this._unprotectedHeader = { ...this._unprotectedHeader, ...parameters }; | ||
} | ||
} | ||
else { | ||
this._protectedHeader = { ...this._protectedHeader, ...parameters }; | ||
if (!this._protectedHeader) { | ||
this.setProtectedHeader(parameters); | ||
} | ||
else { | ||
this._protectedHeader = { ...this._protectedHeader, ...parameters }; | ||
} | ||
} | ||
@@ -116,0 +127,0 @@ } |
@@ -11,2 +11,5 @@ import { flattenedDecrypt } from '../flattened/decrypt.js'; | ||
} | ||
if (!jwe.recipients.length) { | ||
throw new JWEInvalid('JWE Recipients has no members'); | ||
} | ||
for (const recipient of jwe.recipients) { | ||
@@ -13,0 +16,0 @@ try { |
@@ -7,2 +7,4 @@ export { compactDecrypt } from './jwe/compact/decrypt'; | ||
export type { GeneralDecryptGetKey } from './jwe/general/decrypt'; | ||
export { GeneralEncrypt } from './jwe/general/encrypt'; | ||
export type { Recipient } from './jwe/general/encrypt'; | ||
export { compactVerify } from './jws/compact/verify'; | ||
@@ -44,2 +46,2 @@ export type { CompactVerifyGetKey } from './jws/compact/verify'; | ||
export * as base64url from './util/base64url'; | ||
export type { KeyLike, JWK, FlattenedJWSInput, GeneralJWSInput, FlattenedJWS, GeneralJWS, JoseHeaderParameters, JWSHeaderParameters, JWEKeyManagementHeaderParameters, FlattenedJWE, GeneralJWE, JWEHeaderParameters, CritOption, DecryptOptions, EncryptOptions, JWTClaimVerificationOptions, VerifyOptions, SignOptions, JWTPayload, DeflateFunction, InflateFunction, FlattenedDecryptResult, GeneralDecryptResult, CompactDecryptResult, FlattenedVerifyResult, GeneralVerifyResult, CompactVerifyResult, JWTVerifyResult, JWTDecryptResult, ResolvedKey, } from './types'; | ||
export type { KeyLike, JWK, FlattenedJWSInput, GeneralJWSInput, FlattenedJWS, GeneralJWS, JoseHeaderParameters, JWSHeaderParameters, JWEKeyManagementHeaderParameters, FlattenedJWE, GeneralJWE, JWEHeaderParameters, CritOption, DeflateOption, DecryptOptions, EncryptOptions, JWTClaimVerificationOptions, VerifyOptions, SignOptions, JWTPayload, DeflateFunction, InflateFunction, FlattenedDecryptResult, GeneralDecryptResult, CompactDecryptResult, FlattenedVerifyResult, GeneralVerifyResult, CompactVerifyResult, JWTVerifyResult, JWTDecryptResult, ResolvedKey, } from './types'; |
import type { KeyLike, FlattenedJWE, JWEHeaderParameters, JWEKeyManagementHeaderParameters, EncryptOptions } from '../../types'; | ||
export declare const unprotected: unique symbol; | ||
export declare class FlattenedEncrypt { | ||
@@ -3,0 +4,0 @@ private _plaintext; |
@@ -203,5 +203,6 @@ /** | ||
} | ||
export interface EncryptOptions extends CritOption { | ||
export interface DeflateOption { | ||
deflateRaw?: DeflateFunction | ||
} | ||
export interface EncryptOptions extends CritOption, DeflateOption {} | ||
export interface JWTClaimVerificationOptions { | ||
@@ -208,0 +209,0 @@ audience?: string | string[] |
{ | ||
"name": "jose-browser-runtime", | ||
"version": "4.1.5", | ||
"version": "4.2.0", | ||
"description": "(Browser Runtime) 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161039
108
3956