From 447f2bee01d8f144aab20867d38940bd271f7b5c Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Wed, 8 Apr 2020 08:51:13 +0200 Subject: [PATCH] refactor: clear check for supported curves --- lib/jwk/key/ec.js | 2 +- lib/jwk/key/okp.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jwk/key/ec.js b/lib/jwk/key/ec.js index e33469a887..489656351c 100644 --- a/lib/jwk/key/ec.js +++ b/lib/jwk/key/ec.js @@ -27,7 +27,7 @@ class ECKey extends Key { super(...args) this[JWK_MEMBERS]() Object.defineProperty(this, 'kty', { value: 'EC', enumerable: true }) - if (!this.crv || typeof this.crv !== 'string') { + if (!EC_CURVES.has(this.crv)) { throw new errors.JOSENotSupported('unsupported EC key curve') } } diff --git a/lib/jwk/key/okp.js b/lib/jwk/key/okp.js index 5cb0c1370e..4c12d2a6aa 100644 --- a/lib/jwk/key/okp.js +++ b/lib/jwk/key/okp.js @@ -24,7 +24,7 @@ class OKPKey extends Key { super(...args) this[JWK_MEMBERS]() Object.defineProperty(this, 'kty', { value: 'OKP', enumerable: true }) - if (!this.crv || typeof this.crv !== 'string') { + if (!OKP_CURVES.has(this.crv)) { throw new errors.JOSENotSupported('unsupported OKP key curve') } }