jose-browser-runtime
Advanced tools
Comparing version 3.11.4 to 3.11.5
import parseJWK from '../jwk/parse.js'; | ||
import { JWKSInvalid, JOSENotSupported, JWKSNoMatchingKey, JWKSMultipleMatchingKeys, } from '../util/errors.js'; | ||
import fetchJson from '../runtime/fetch.js'; | ||
import isObject from '../lib/is_object.js'; | ||
function getKtyFromAlg(alg) { | ||
@@ -18,3 +19,3 @@ switch (alg.substr(0, 2)) { | ||
function isJWKLike(key) { | ||
return key && typeof key === 'object'; | ||
return isObject(key); | ||
} | ||
@@ -21,0 +22,0 @@ class RemoteJWKSet { |
@@ -0,3 +1,16 @@ | ||
function isObjectLike(value) { | ||
return typeof value === 'object' && value !== null; | ||
} | ||
export default function isObject(input) { | ||
return typeof input === 'object' && !!input && input.constructor === Object; | ||
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') { | ||
return false; | ||
} | ||
if (Object.getPrototypeOf(input) === null) { | ||
return true; | ||
} | ||
let proto = input; | ||
while (Object.getPrototypeOf(proto) !== null) { | ||
proto = Object.getPrototypeOf(proto); | ||
} | ||
return Object.getPrototypeOf(input) === proto; | ||
} |
@@ -5,2 +5,3 @@ import { JWTClaimValidationFailed, JWTExpired, JWTInvalid } from '../util/errors.js'; | ||
import secs from './secs.js'; | ||
import isObject from './is_object.js'; | ||
const normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, ''); | ||
@@ -29,3 +30,3 @@ const checkAudiencePresence = (audPayload, audOption) => { | ||
} | ||
if (typeof payload !== 'object' || !payload || Array.isArray(payload)) { | ||
if (!isObject(payload)) { | ||
throw new JWTInvalid('JWT Claims Set must be a top-level JSON object'); | ||
@@ -32,0 +33,0 @@ } |
{ | ||
"name": "jose-browser-runtime", | ||
"version": "3.11.4", | ||
"version": "3.11.5", | ||
"description": "(Browser 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
124156
3122