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

get-jwks

Package Overview
Dependencies
Maintainers
8
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-jwks - npm Package Compare versions

Comparing version 7.0.0 to 7.1.0

4

package.json
{
"name": "get-jwks",
"version": "7.0.0",
"version": "7.1.0",
"description": "Fetch utils for JWKS keys",

@@ -48,5 +48,5 @@ "main": "src/get-jwks.js",

"tap": "^16.0.0",
"tsd": "^0.21.0",
"tsd": "^0.22.0",
"typescript": "^4.5.5"
}
}

@@ -123,3 +123,5 @@ 'use strict'

const jwk = body.keys.find(
key => (key.alg === undefined || key.alg === alg) && key.kid === kid
key =>
(alg === undefined || key.alg === undefined || key.alg === alg) &&
key.kid === kid
)

@@ -126,0 +128,0 @@

@@ -78,2 +78,16 @@ 'use strict'

t.test(
'returns a jwk if no alg is provided and kid match but jwk has alg',
async t => {
nock(domain).get('/.well-known/jwks.json').reply(200, jwks)
const getJwks = buildGetJwks()
const key = jwks.keys[1]
const jwk = await getJwks.getJwk({ domain, kid: key.kid })
t.ok(jwk)
t.same(jwk, key)
}
)
t.test('caches a successful response', async t => {

@@ -80,0 +94,0 @@ nock(domain).get('/.well-known/jwks.json').once().reply(200, jwks)

@@ -57,14 +57,32 @@ 'use strict'

t.test('returns a jwk if no alg is provided and kid match for discovery', async t => {
nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig)
nock(domain).get('/.well-known/certs').reply(200, jwks)
const getJwks = buildGetJwks({ providerDiscovery: true })
const key = jwks.keys[2]
t.test(
'returns a jwk if no alg is provided and kid match for discovery',
async t => {
nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig)
nock(domain).get('/.well-known/certs').reply(200, jwks)
const getJwks = buildGetJwks({ providerDiscovery: true })
const key = jwks.keys[2]
const jwk = await getJwks.getJwk({ domain, kid: key.kid })
const jwk = await getJwks.getJwk({ domain, kid: key.kid })
t.ok(jwk)
t.same(jwk, key)
})
t.ok(jwk)
t.same(jwk, key)
}
)
t.test(
'returns a jwk if no alg is provided and kid match for discovery but jwk has alg',
async t => {
nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig)
nock(domain).get('/.well-known/certs').reply(200, jwks)
const getJwks = buildGetJwks({ providerDiscovery: true })
const key = jwks.keys[1]
const jwk = await getJwks.getJwk({ domain, kid: key.kid })
t.ok(jwk)
t.same(jwk, key)
}
)
t.test('caches a successful response for discovery', async t => {

@@ -71,0 +89,0 @@ nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig)

Sorry, the diff of this file is not supported yet

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