diff --git a/lib/authenticate.js b/lib/authenticate.js index 2c859604..9365a107 100644 --- a/lib/authenticate.js +++ b/lib/authenticate.js @@ -13,5 +13,16 @@ module.exports = function(config){ next(); }); }, + check: async function(token){ + return new Promise((resolve, reject) => { + jwt.verify(token, config.masterAuthSecret, function(err, decoded) { + if(err){ + resolve({ok:false, msg:err}) + } else { + resolve({ok:true, msg:"Successfully authenticated"}); + } + }); + }); + } } };