We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a915ffc + f9a9948 commit ff484acCopy full SHA for ff484ac
1 file changed
test/jws.test.js
@@ -291,6 +291,17 @@ test('jws.decode: with a bogus header ', function (t) {
291
t.end();
292
});
293
294
+test('jws.decode: with invalid json in body', function (t) {
295
+ const header = Buffer('{"alg":"HS256","typ":"JWT"}').toString('base64');
296
+ const payload = Buffer('sup').toString('base64');
297
+ const sig = header + '.' + payload + '.';
298
+ var parts;
299
+ t.throws(function () {
300
+ parts = jws.decode(sig);
301
+ })
302
+ t.end();
303
+});
304
+
305
test('jws.verify: missing or invalid algorithm', function (t) {
306
const header = Buffer('{"something":"not an algo"}').toString('base64');
307
const payload = Buffer('sup').toString('base64');
0 commit comments