Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

Commit

Permalink
Merge pull request #7 from anvilresearch/vsimonian-fix-jsrsasign-veri…
Browse files Browse the repository at this point in the history
…fication

Use new jsrsasign/jsjws API for JWK verification
  • Loading branch information
christiansmith committed Oct 14, 2015
2 parents 319313f + bbc1121 commit 1bd3a82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/JWT.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,11 @@ JWT.decode = function (token, secret) {
// exposed in the node version of jsrsasign so we can't access it.
//
// Using jsjws is stopgap until there's a cleaner way.
var jws = new jsrsasign.jws.JWS()
var hN = base64url.decode(secret.n, 'hex')
var hE = base64url.decode(secret.e, 'hex')
var pubkey = jsrsasign.KEYUTIL.getKey({ n: hN, e: hE })

verified = jws.verifyJWSByNE(token, hN, hE)
verified = jsrsasign.jws.JWS.verify(token, pubkey)
}

if (!verified) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"dependencies": {
"lodash": "^3.10.1",
"base64url": "^1.0.4",
"jsrsasign": "^4.8.3",
"jsrsasign": "^5.0.0",
"jwa": "^1.0.0",
"valid-url": "^1.0.9"
}
Expand Down

0 comments on commit 1bd3a82

Please sign in to comment.