Skip to content

Commit

Permalink
refactor: clear check for supported curves
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Apr 8, 2020
1 parent 27b77b9 commit 447f2be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/jwk/key/ec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/jwk/key/okp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
Expand Down

0 comments on commit 447f2be

Please sign in to comment.