ego-token-middleware
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -24,2 +24,7 @@ "use strict"; | ||
egoURL = _ref$egoURL === void 0 ? process.env.EGO_API : _ref$egoURL; | ||
if (!egoURL) { | ||
throw new Error('must provide ego url with either the `EGO_API` env variable or egoURL argument'); | ||
} | ||
return ( | ||
@@ -80,2 +85,2 @@ /*#__PURE__*/ | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJyZXF1aXJlZCIsImVnb1VSTCIsInByb2Nlc3MiLCJlbnYiLCJFR09fQVBJIiwicmVxIiwicmVzIiwibmV4dCIsImF1dGhvcml6YXRpb24iLCJoZWFkZXJzIiwidG9rZW4iLCJzcGxpdCIsInF1ZXJ5Iiwia2V5IiwidmFsaWQiLCJzdGF0dXMiLCJzZW5kIiwiand0IiwiZGVjb2RlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7O0FBQ0E7Ozs7Ozs7Ozs7QUFFZSx3QkFBcUQ7QUFBQSxNQUExQ0EsUUFBMEMsUUFBMUNBLFFBQTBDO0FBQUEseUJBQWhDQyxNQUFnQztBQUFBLE1BQWhDQSxNQUFnQyw0QkFBdkJDLFFBQVFDLEdBQVIsQ0FBWUMsT0FBVztBQUNsRTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsOEJBQU8saUJBQU9DLEdBQVAsRUFBWUMsR0FBWixFQUFpQkMsSUFBakI7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0dDLDZCQURILEdBQ3FCSCxJQUFJSSxPQUR6QixDQUNHRCxhQURIO0FBRUNFLHFCQUZELEdBRVNGLGdCQUFnQkEsY0FBY0csS0FBZCxDQUFvQixHQUFwQixFQUF5QixDQUF6QixDQUFoQixHQUE4Q04sSUFBSU8sS0FBSixDQUFVQyxHQUZqRTtBQUFBLDhCQUdTS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CB7IGF1dGhvcml6YXRpb24gfSA9IHJlcS5oZWFkZXJzO1xuICAgIGNvbnN0IHRva2VuID0gYXV0aG9yaXphdGlvbiA/IGF1dGhvcml6YXRpb24uc3BsaXQoJyAnKVsxXSA6IHJlcS5xdWVyeS5rZXk7XG4gICAgY29uc3QgdmFsaWQgPSB0b2tlbiAmJiAoYXdhaXQgdmVyaWZ5SldUKHsgdG9rZW4sIGVnb1VSTCB9KSk7XG5cbiAgICBpZiAoIXZhbGlkICYmIHJlcXVpcmVkKSB7XG4gICAgICByZXMuc3RhdHVzKDQwMSkuc2VuZCgndW5hdXRob3JpemVkJyk7XG4gICAgfSBlbHNlIHtcbiAgICAgIHJlcS5qd3QgPSB7IC4uLmp3dC5kZWNvZGUodG9rZW4pLCB2YWxpZCB9O1xuICAgICAgbmV4dCgpO1xuICAgIH1cbiAgfTtcbn1cbiJdfQ== |
{ | ||
"name": "ego-token-middleware", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
"main": "dist", | ||
"scripts": { | ||
"prepare": "rm -rf dist && mkdir dist && babel src --out-dir dist --copy-files", | ||
"watch": "babel src --out-dir dist --copy-files --watch" | ||
"build": "babel src --out-dir dist --copy-files", | ||
"prepare": "rm -rf dist && mkdir dist && npm run build", | ||
"watch": "npm run build -- --watch" | ||
}, | ||
@@ -10,0 +11,0 @@ "keywords": [], |
@@ -5,2 +5,8 @@ import jwt from 'jsonwebtoken'; | ||
export default function({ required, egoURL = process.env.EGO_API }) { | ||
if (!egoURL) { | ||
throw new Error( | ||
'must provide ego url with either the `EGO_API` env variable or egoURL argument', | ||
); | ||
} | ||
return async (req, res, next) => { | ||
@@ -7,0 +13,0 @@ const { authorization } = req.headers; |
13098
184