jose-node-esm-runtime
Advanced tools
Comparing version 3.12.3 to 3.13.0
@@ -21,3 +21,3 @@ import { createPublicKey } from 'crypto'; | ||
default: | ||
throw new JOSENotSupported('unsupported curve for this operation'); | ||
throw new JOSENotSupported('unsupported key curve for this operation'); | ||
} | ||
@@ -68,2 +68,5 @@ }; | ||
} | ||
else { | ||
throw new JOSENotSupported('unsupported key curve for this operation'); | ||
} | ||
} | ||
@@ -70,0 +73,0 @@ if (raw) |
@@ -7,6 +7,9 @@ import * as crypto from 'crypto'; | ||
import getSignKey from './get_sign_verify_key.js'; | ||
let oneShotSign = crypto.sign; | ||
if (oneShotSign.length > 3) { | ||
oneShotSign = promisify(oneShotSign); | ||
let oneShotSign; | ||
if (crypto.sign.length > 3) { | ||
oneShotSign = promisify(crypto.sign); | ||
} | ||
else { | ||
oneShotSign = crypto.sign; | ||
} | ||
const sign = async (alg, key, data) => { | ||
@@ -13,0 +16,0 @@ const keyObject = getSignKey(alg, key, 'sign'); |
@@ -12,6 +12,9 @@ import * as crypto from 'crypto'; | ||
const oneShotCallbackSupported = major >= 16 || (major === 15 && minor >= 13); | ||
let oneShotVerify = crypto.verify; | ||
if (oneShotVerify.length > 4 && oneShotCallbackSupported) { | ||
oneShotVerify = promisify(oneShotVerify); | ||
let oneShotVerify; | ||
if (crypto.verify.length > 4 && oneShotCallbackSupported) { | ||
oneShotVerify = promisify(crypto.verify); | ||
} | ||
else { | ||
oneShotVerify = crypto.verify; | ||
} | ||
const verify = async (alg, key, signature, data) => { | ||
@@ -32,7 +35,3 @@ if (alg.startsWith('HS')) { | ||
try { | ||
let result = oneShotVerify(algorithm, data, keyInput, signature); | ||
if (result instanceof Promise) { | ||
result = await result; | ||
} | ||
return result; | ||
return await oneShotVerify(algorithm, data, keyInput, signature); | ||
} | ||
@@ -39,0 +38,0 @@ catch { |
@@ -7,2 +7,2 @@ import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, CompactDecryptResult } from '../../types.d'; | ||
export default compactDecrypt; | ||
export type { KeyLike, DecryptOptions }; | ||
export type { KeyLike, DecryptOptions, CompactDecryptResult }; |
@@ -7,2 +7,2 @@ import type { FlattenedDecryptResult, KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, GetKeyFunction } from '../../types.d'; | ||
export default flattenedDecrypt; | ||
export type { KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions }; | ||
export type { KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, FlattenedDecryptResult }; |
@@ -7,2 +7,2 @@ import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, GeneralJWE, GeneralDecryptResult } from '../../types.d'; | ||
export default generalDecrypt; | ||
export type { KeyLike, GeneralJWE, DecryptOptions }; | ||
export type { KeyLike, GeneralJWE, DecryptOptions, GeneralDecryptResult }; |
@@ -7,2 +7,2 @@ import type { CompactVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types.d'; | ||
export default compactVerify; | ||
export type { KeyLike, VerifyOptions }; | ||
export type { KeyLike, VerifyOptions, CompactVerifyResult }; |
@@ -7,2 +7,2 @@ import type { FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GetKeyFunction } from '../../types.d'; | ||
export default flattenedVerify; | ||
export type { KeyLike, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, VerifyOptions }; | ||
export type { KeyLike, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, VerifyOptions, FlattenedVerifyResult, }; |
@@ -7,2 +7,2 @@ import type { GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types.d'; | ||
export default generalVerify; | ||
export type { KeyLike, GeneralJWSInput, VerifyOptions }; | ||
export type { KeyLike, GeneralJWSInput, VerifyOptions, GeneralVerifyResult }; |
@@ -9,2 +9,2 @@ import type { KeyLike, DecryptOptions, JWTPayload, JWTClaimVerificationOptions, GetKeyFunction, JWEHeaderParameters, FlattenedJWE, JWTDecryptResult } from '../types.d'; | ||
export default jwtDecrypt; | ||
export type { KeyLike, DecryptOptions, JWTPayload, JWTDecryptOptions }; | ||
export type { KeyLike, DecryptOptions, JWTPayload, JWTDecryptOptions, JWTDecryptResult }; |
import type { JWSHeaderParameters, JWTClaimVerificationOptions, JWTPayload } from '../types.d'; | ||
import ProduceJWT from '../lib/jwt_producer.js'; | ||
interface UnsecuredResult { | ||
payload: JWTPayload; | ||
header: JWSHeaderParameters; | ||
} | ||
declare class UnsecuredJWT extends ProduceJWT { | ||
encode(): string; | ||
static decode(jwt: string, options?: JWTClaimVerificationOptions): { | ||
payload: JWTPayload; | ||
header: JWSHeaderParameters; | ||
}; | ||
static decode(jwt: string, options?: JWTClaimVerificationOptions): UnsecuredResult; | ||
} | ||
export { UnsecuredJWT }; | ||
export default UnsecuredJWT; | ||
export type { JWSHeaderParameters, JWTPayload }; | ||
export type { JWSHeaderParameters, JWTPayload, UnsecuredResult }; |
@@ -9,2 +9,2 @@ import type { KeyLike, VerifyOptions, JWTPayload, JWTClaimVerificationOptions, JWSHeaderParameters, GetKeyFunction, FlattenedJWSInput, JWTVerifyResult } from '../types.d'; | ||
export default jwtVerify; | ||
export type { KeyLike, JWTPayload, JWTVerifyOptions, JWSHeaderParameters, GetKeyFunction }; | ||
export type { KeyLike, JWTPayload, JWTVerifyOptions, JWSHeaderParameters, GetKeyFunction, JWTVerifyResult, }; |
{ | ||
"name": "jose-node-esm-runtime", | ||
"version": "3.12.3", | ||
"version": "3.13.0", | ||
"description": "(Node.JS ESM Runtime) 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK with no dependencies", | ||
@@ -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
145946
3736