Skip to content
This repository was archived by the owner on May 7, 2018. It is now read-only.

Commit 751d99d

Browse files
committed
Merge pull request #34 from baisong/master
Fix failing tests
2 parents 21707c2 + 9f0491a commit 751d99d

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ function unpackJWS(signature, callback) {
388388
const payload = jsonParse(parts.payload);
389389
if (!payload)
390390
return callback(makeError('jws-payload-parse'));
391+
payload.header = parts.header;
391392
return callback(null, payload)
392393
}
393394

@@ -457,9 +458,10 @@ function fullValidateSignedAssertion(signature, callback) {
457458
return getLinkedResources(structures, callback);
458459
},
459460
function verifySignature(resources, callback) {
461+
var algorithm = data.structures.assertion.header.alg;
460462
data.resources = resources;
461463
const publicKey = resources['assertion.verify.url'];
462-
if (!jws.verify(signature, publicKey))
464+
if (!jws.verify(signature, algorithm, publicKey))
463465
return callback(makeError('verify-signature'))
464466
return callback(null, resources);
465467
},

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"dataurl": "~0.1.0",
1212
"request": "~2.14.0",
1313
"async": "~0.2.5",
14-
"jws": "0.2.2",
14+
"jws": "~3.1.0",
1515
"deep-equal": "0.0.0"
1616
},
1717
"devDependencies": {
18-
"nock": "~0.22.1",
18+
"nock": "~1.0.0",
1919
"tap": "~0.4.0",
2020
"underscore": "~1.5.1",
2121
"sinon": "~1.7.3",

test/validator-remote.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ test('validator.unpackJWS: bad payload', function (t) {
133133
});
134134

135135
test('validator.unpackJWS: everything good', function (t) {
136-
const expect = {sup: 'lol'};
136+
const expect = {sup: 'lol', header: { alg: 'rs256' }};
137137
const signature = jws.sign({
138138
header: { alg: 'rs256' },
139139
payload: expect,

0 commit comments

Comments
 (0)