jose-node-esm-runtime
Advanced tools
Comparing version 3.14.4 to 3.15.0
@@ -66,2 +66,3 @@ import isDisjoint from '../../lib/is_disjoint.js'; | ||
signature: base64url(signature), | ||
payload: '', | ||
}; | ||
@@ -68,0 +69,0 @@ if (b64) { |
@@ -49,4 +49,6 @@ import FlattenedSign from '../flattened/sign.js'; | ||
signatures: [], | ||
payload: '', | ||
}; | ||
await Promise.all(this._signatures.map(async (sig, i) => { | ||
let payloads = new Set(); | ||
await Promise.all(this._signatures.map(async (sig) => { | ||
const { protectedHeader, unprotectedHeader, options, key } = signatureRef.get(sig); | ||
@@ -61,12 +63,8 @@ const flattened = new FlattenedSign(this._payload); | ||
const { payload, ...rest } = await flattened.sign(key, options); | ||
if ('payload' in jws && jws.payload !== payload) { | ||
throw new JWSInvalid(`index ${i} signature produced a different payload`); | ||
} | ||
else { | ||
jws.payload = payload; | ||
} | ||
payloads.add(payload); | ||
jws.payload = payload; | ||
jws.signatures.push(rest); | ||
})); | ||
if ('payload' in jws && jws.payload === undefined) { | ||
delete jws.payload; | ||
if (payloads.size !== 1) { | ||
throw new JWSInvalid('inconsistent use of JWS Unencoded Payload Option (RFC7797)'); | ||
} | ||
@@ -73,0 +71,0 @@ return jws; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, CompactDecryptResult } from '../../types'; | ||
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, CompactDecryptResult } from '../../types.d'; | ||
export interface CompactDecryptGetKey extends GetKeyFunction<JWEHeaderParameters, FlattenedJWE> { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, JWEKeyManagementHeaderParameters, JWEHeaderParameters, EncryptOptions } from '../../types'; | ||
import type { KeyLike, JWEKeyManagementHeaderParameters, JWEHeaderParameters, EncryptOptions } from '../../types.d'; | ||
declare class CompactEncrypt { | ||
@@ -3,0 +3,0 @@ private _flattened; |
@@ -1,2 +0,2 @@ | ||
import type { FlattenedDecryptResult, KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, GetKeyFunction } from '../../types'; | ||
import type { FlattenedDecryptResult, KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, GetKeyFunction } from '../../types.d'; | ||
export interface FlattenedDecryptGetKey extends GetKeyFunction<JWEHeaderParameters | undefined, FlattenedJWE> { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, FlattenedJWE, JWEHeaderParameters, JWEKeyManagementHeaderParameters, EncryptOptions } from '../../types'; | ||
import type { KeyLike, FlattenedJWE, JWEHeaderParameters, JWEKeyManagementHeaderParameters, EncryptOptions } from '../../types.d'; | ||
declare class FlattenedEncrypt { | ||
@@ -3,0 +3,0 @@ private _plaintext; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, GeneralJWE, GeneralDecryptResult } from '../../types'; | ||
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, GeneralJWE, GeneralDecryptResult } from '../../types.d'; | ||
export interface GeneralDecryptGetKey extends GetKeyFunction<JWEHeaderParameters, FlattenedJWE> { | ||
@@ -3,0 +3,0 @@ } |
/// <reference types="node" /> | ||
import type { KeyObject } from 'crypto'; | ||
import type { FlattenedJWSInput, JWSHeaderParameters } from '../types'; | ||
import type { KeyObject, FlattenedJWSInput, JWSHeaderParameters } from '../types.d'; | ||
declare function EmbeddedJWK(protectedHeader: JWSHeaderParameters, token: FlattenedJWSInput): Promise<CryptoKey | KeyObject>; | ||
export { EmbeddedJWK }; | ||
export default EmbeddedJWK; |
@@ -1,2 +0,2 @@ | ||
import type { JWK, KeyLike } from '../types'; | ||
import type { JWK, KeyLike } from '../types.d'; | ||
declare function fromKeyLike(key: KeyLike): Promise<JWK>; | ||
@@ -3,0 +3,0 @@ export { fromKeyLike }; |
@@ -1,2 +0,2 @@ | ||
import type { JWK, KeyLike } from '../types'; | ||
import type { JWK, KeyLike } from '../types.d'; | ||
declare function parseJwk(jwk: JWK, alg?: string, octAsKeyObject?: boolean): Promise<KeyLike>; | ||
@@ -3,0 +3,0 @@ export { parseJwk }; |
@@ -1,2 +0,2 @@ | ||
import type { JWK } from '../types'; | ||
import type { JWK } from '../types.d'; | ||
declare function calculateThumbprint(jwk: JWK, digestAlgorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>; | ||
@@ -3,0 +3,0 @@ export { calculateThumbprint }; |
@@ -1,9 +0,6 @@ | ||
/// <reference types="node" /> | ||
import type * as http from 'http'; | ||
import type * as https from 'https'; | ||
import type { JWSHeaderParameters, FlattenedJWSInput, GetKeyFunction } from '../types'; | ||
import type { JWSHeaderParameters, FlattenedJWSInput, GetKeyFunction } from '../types.d'; | ||
export interface RemoteJWKSetOptions { | ||
timeoutDuration?: number; | ||
cooldownDuration?: number; | ||
agent?: https.Agent | http.Agent; | ||
agent?: any; | ||
} | ||
@@ -10,0 +7,0 @@ declare function createRemoteJWKSet(url: URL, options?: RemoteJWKSetOptions): GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput>; |
@@ -1,2 +0,2 @@ | ||
import type { JWSHeaderParameters, KeyLike, SignOptions } from '../../types'; | ||
import type { JWSHeaderParameters, KeyLike, SignOptions } from '../../types.d'; | ||
declare class CompactSign { | ||
@@ -3,0 +3,0 @@ private _flattened; |
@@ -1,2 +0,2 @@ | ||
import type { CompactVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types'; | ||
import type { CompactVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types.d'; | ||
export interface CompactVerifyGetKey extends GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput> { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, FlattenedJWS, JWSHeaderParameters, SignOptions } from '../../types'; | ||
import type { KeyLike, FlattenedJWS, JWSHeaderParameters, SignOptions } from '../../types.d'; | ||
declare class FlattenedSign { | ||
@@ -3,0 +3,0 @@ private _payload; |
@@ -1,2 +0,2 @@ | ||
import type { FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GetKeyFunction } from '../../types'; | ||
import type { FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GetKeyFunction } from '../../types.d'; | ||
export interface FlattenedVerifyGetKey extends GetKeyFunction<JWSHeaderParameters | undefined, FlattenedJWSInput> { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, GeneralJWS, JWSHeaderParameters, SignOptions } from '../../types'; | ||
import type { KeyLike, GeneralJWS, JWSHeaderParameters, SignOptions } from '../../types.d'; | ||
export interface Signature { | ||
@@ -3,0 +3,0 @@ setProtectedHeader(protectedHeader: JWSHeaderParameters): Signature; |
@@ -1,2 +0,2 @@ | ||
import type { GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types'; | ||
import type { GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types.d'; | ||
export interface GeneralVerifyGetKey extends GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput> { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, DecryptOptions, JWTPayload, JWTClaimVerificationOptions, GetKeyFunction, JWEHeaderParameters, FlattenedJWE, JWTDecryptResult } from '../types'; | ||
import type { KeyLike, DecryptOptions, JWTPayload, JWTClaimVerificationOptions, GetKeyFunction, JWEHeaderParameters, FlattenedJWE, JWTDecryptResult } from '../types.d'; | ||
interface JWTDecryptOptions extends DecryptOptions, JWTClaimVerificationOptions { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { EncryptOptions, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWTPayload, KeyLike } from '../types'; | ||
import type { EncryptOptions, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWTPayload, KeyLike } from '../types.d'; | ||
import ProduceJWT from '../lib/jwt_producer'; | ||
@@ -3,0 +3,0 @@ declare class EncryptJWT extends ProduceJWT { |
@@ -1,2 +0,2 @@ | ||
import type { JWSHeaderParameters, JWTPayload, KeyLike, SignOptions } from '../types'; | ||
import type { JWSHeaderParameters, JWTPayload, KeyLike, SignOptions } from '../types.d'; | ||
import ProduceJWT from '../lib/jwt_producer'; | ||
@@ -3,0 +3,0 @@ declare class SignJWT extends ProduceJWT { |
@@ -1,2 +0,2 @@ | ||
import type { JWSHeaderParameters, JWTClaimVerificationOptions, JWTPayload } from '../types'; | ||
import type { JWSHeaderParameters, JWTClaimVerificationOptions, JWTPayload } from '../types.d'; | ||
import ProduceJWT from '../lib/jwt_producer'; | ||
@@ -3,0 +3,0 @@ interface UnsecuredResult { |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike, VerifyOptions, JWTPayload, JWTClaimVerificationOptions, JWSHeaderParameters, GetKeyFunction, FlattenedJWSInput, JWTVerifyResult } from '../types'; | ||
import type { KeyLike, VerifyOptions, JWTPayload, JWTClaimVerificationOptions, JWSHeaderParameters, GetKeyFunction, FlattenedJWSInput, JWTVerifyResult } from '../types.d'; | ||
interface JWTVerifyOptions extends VerifyOptions, JWTClaimVerificationOptions { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { JWTPayload } from '../types'; | ||
import type { JWTPayload } from '../types.d'; | ||
export default class ProduceJWT { | ||
@@ -3,0 +3,0 @@ protected _payload: JWTPayload; |
/// <reference lib="dom"/> | ||
import type { KeyObject } from 'crypto' | ||
export type { KeyObject } | ||
export type KeyLike = KeyObject | CryptoKey | Uint8Array | ||
export interface JWK { | ||
@@ -36,3 +38,2 @@ alg?: string | ||
} | ||
export type KeyLike = KeyObject | CryptoKey | Uint8Array | ||
export interface FlattenedJWSInput { | ||
@@ -49,7 +50,7 @@ header?: JWSHeaderParameters | ||
export interface FlattenedJWS extends Partial<FlattenedJWSInput> { | ||
payload?: string | ||
payload: string | ||
signature: string | ||
} | ||
export interface GeneralJWS { | ||
payload?: string | ||
payload: string | ||
signatures: Omit<FlattenedJWSInput, 'payload'>[] | ||
@@ -56,0 +57,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { JWSHeaderParameters, JWEHeaderParameters } from '../types'; | ||
import type { JWSHeaderParameters, JWEHeaderParameters } from '../types.d'; | ||
export declare type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderParameters; | ||
@@ -3,0 +3,0 @@ declare function decodeProtectedHeader(token: string | object): ProtectedHeaderParameters; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike } from '../types'; | ||
import type { KeyLike } from '../types.d'; | ||
export interface GenerateKeyPairResult { | ||
@@ -3,0 +3,0 @@ privateKey: KeyLike; |
@@ -1,2 +0,2 @@ | ||
import type { KeyLike } from '../types'; | ||
import type { KeyLike } from '../types.d'; | ||
export interface GenerateSecretOptions { | ||
@@ -3,0 +3,0 @@ extractable?: boolean; |
{ | ||
"name": "jose-node-esm-runtime", | ||
"version": "3.14.4", | ||
"version": "3.15.0", | ||
"description": "(Node.JS ESM Runtime) 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK with no dependencies", | ||
@@ -10,2 +10,3 @@ "keywords": [ | ||
"detached", | ||
"deno", | ||
"ec", | ||
@@ -75,2 +76,9 @@ "ecdsa", | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"./dist/types/*" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
@@ -89,10 +97,3 @@ "dist/**/package.json", | ||
], | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"./dist/types/*" | ||
] | ||
} | ||
}, | ||
"type": "module" | ||
} |
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
152366
3884