temporarly fix an issue of double callback in JWS

This commit is contained in:
José F. Romaniello
2016-07-14 17:30:25 -03:00
parent bece881609
commit 758ca5eeca
3 changed files with 6 additions and 2 deletions
+1
View File
@@ -19,6 +19,7 @@
"url": "https://github.com/auth0/node-jsonwebtoken/issues"
},
"dependencies": {
"cb": "~0.1.0",
"joi": "~6.10.1",
"jws": "^3.0.0",
"ms": "^0.7.1",
+3
View File
@@ -2,6 +2,7 @@ var Joi = require('joi');
var timespan = require('./lib/timespan');
var xtend = require('xtend');
var jws = require('jws');
var cb = require('cb');
var sign_options_schema = Joi.object().keys({
expiresIn: [Joi.number().integer(), Joi.string()],
@@ -124,6 +125,8 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
var encoding = options.encoding || 'utf8';
if (typeof callback === 'function') {
callback = callback && cb(callback).once();
jws.createSign({
header: header,
privateKey: secretOrPrivateKey,
+2 -2
View File
@@ -20,8 +20,8 @@ describe('signing a token asynchronously', function() {
it('should work', function (done) {
jwt.sign({abc: 1}, "secret", {}, function (err, res) {
expect(err).to.not.exist();
done();
expect(err).to.be.null();
done();
});
});