From d992deb0b1b828285fe9249ac52d986dc9287cf1 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Fri, 21 Jun 2019 15:15:39 +0200 Subject: [PATCH] fix: ensure runtime @panva/jose dependency ^1.3.0 --- lib/client.js | 6 +++--- lib/issuer.js | 2 +- package.json | 10 +++++----- test/client/client_instance.test.js | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/client.js b/lib/client.js index 9b871b0d..7b44b96a 100644 --- a/lib/client.js +++ b/lib/client.js @@ -155,7 +155,7 @@ async function claimJWT(jwt) { } function getKeystore(jwks) { - const keystore = jose.JWKS.KeyStore.fromJWKS(jwks); + const keystore = jose.JWKS.asKeyStore(jwks); if (keystore.all().some(key => key.type !== 'private')) { throw new TypeError('jwks must only contain private keys'); } @@ -1000,7 +1000,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base .digest() .slice(0, len / 8); - const key = jose.JWK.importKey({ k: base64url.encode(derivedBuffer), kty: 'oct' }); + const key = jose.JWK.asKey({ k: base64url.encode(derivedBuffer), kty: 'oct' }); instance(this).set(cacheKey, key); return key; @@ -1019,7 +1019,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base return instance(this).get('jose_secret'); } - const key = jose.JWK.importKey({ k: base64url.encode(this.client_secret), kty: 'oct' }); + const key = jose.JWK.asKey({ k: base64url.encode(this.client_secret), kty: 'oct' }); instance(this).set('jose_secret', key); return key; diff --git a/lib/issuer.js b/lib/issuer.js index a4a19ef6..61f8a982 100644 --- a/lib/issuer.js +++ b/lib/issuer.js @@ -84,7 +84,7 @@ class Issuer { }); const jwks = processResponse(response); - const joseKeyStore = jose.JWKS.KeyStore.fromJWKS(jwks); + const joseKeyStore = jose.JWKS.asKeyStore(jwks); cache.set('throttle', true, 60 * 1000); instance(this).set('keystore', joseKeyStore); return joseKeyStore; diff --git a/package.json b/package.json index f77c270d..b7bb1d68 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "test": "mocha" }, "dependencies": { - "@panva/jose": "^1.2.0", + "@panva/jose": "^1.3.0", "base64url": "^3.0.1", "got": "^9.6.0", "lodash": "^4.17.11", @@ -47,15 +47,15 @@ "p-any": "^2.1.0" }, "devDependencies": { - "@commitlint/cli": "^7.6.0", - "@commitlint/config-conventional": "^7.6.0", + "@commitlint/cli": "^8.0.0", + "@commitlint/config-conventional": "^8.0.0", "chai": "^4.2.0", "eslint": "^5.16.0", "eslint-config-airbnb-base": "^13.1.0", "eslint-plugin-import": "^2.17.1", - "husky": "^2.2.0", + "husky": "^2.4.1", "mocha": "^6.1.3", - "nock": "^11.0.0-beta.14", + "nock": "^11.0.0-beta.20", "nyc": "^14.1.0", "readable-mock-req": "^0.2.2", "sinon": "^7.3.1", diff --git a/test/client/client_instance.test.js b/test/client/client_instance.test.js index b837b1f9..4e2d7638 100644 --- a/test/client/client_instance.test.js +++ b/test/client/client_instance.test.js @@ -2764,7 +2764,7 @@ describe('Client', () => { /* eslint-disable max-len */ describe('signed and encrypted responses', function () { before(function () { - this.keystore = jose.JWKS.KeyStore.fromJWKS({ + this.keystore = jose.JWKS.asKeyStore({ keys: [ { kty: 'EC',