@kofile/jwt-client
Advanced tools
Comparing version 2.0.1 to 2.1.0
15
index.js
const jsonwebtoken = require('jsonwebtoken') | ||
const clone = require('clone') | ||
const JwtError = require('./JwtError') | ||
@@ -24,2 +25,3 @@ | ||
}) | ||
return payload | ||
@@ -36,2 +38,3 @@ } | ||
} | ||
return jwt | ||
@@ -42,5 +45,7 @@ } | ||
const payload = jsonwebtoken.decode(jwt) | ||
if (!payload) { | ||
throw new JwtError('Invalid JWT') | ||
} | ||
return payload | ||
@@ -50,15 +55,15 @@ } | ||
get userId () { | ||
return this._userId | ||
return clone(this._userId) | ||
} | ||
get tenantId () { | ||
return this._tenantId | ||
return clone(this._tenantId) | ||
} | ||
get ort () { | ||
return this._ort | ||
return clone(this._ort) | ||
} | ||
get encoded () { | ||
return this._jwt | ||
return clone(this._jwt) | ||
} | ||
@@ -74,3 +79,3 @@ | ||
return this._payload.tenants[tenantId].authorization | ||
return clone(this._payload.tenants[tenantId].authorization) | ||
} | ||
@@ -77,0 +82,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"name":"@kofile/jwt-client","version":"2.0.1","description":"A simple JWT reader","repository":"https://github.com/kofile/jwt-client","author":"Evan Sherwood <evan@sherwood.io>","license":"MIT","main":"index.js","files":["index.js","JwtError.js"],"dependencies":{"jsonwebtoken":"^8.0.1"},"devDependencies":{"@whizark/cz-cli":"^0.4.0","ava":"^0.22.0","commitizen":"^2.9.6","coveralls":"^2.13.1","cz-conventional-changelog":"^2.0.0","husky":"^0.13.4","lint-staged":"^3.6.0","nyc":"^11.1.0","prettier-standard":"^6.0.0","ramda":"^0.25.0","semantic-release":"^8.0.3","snazzy":"^7.0.0","standard":"^10.0.3"},"lint-staged":{"*.js":["prettier-standard","git add"]},"scripts":{"precommit":"lint-staged","commit":"git-cz","lint":"standard | snazzy","test":"nyc ava","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"config":{"commitizen":{"path":"node_modules/cz-conventional-changelog"}},"nyc":{"include":["index.js","JwtError.js"]}} | ||
{"name":"@kofile/jwt-client","version":"2.1.0","description":"A simple JWT reader","repository":"https://github.com/kofile/jwt-client","author":"Evan Sherwood <evan@sherwood.io>","license":"MIT","main":"index.js","files":["index.js","JwtError.js"],"dependencies":{"clone":"^2.1.1","jsonwebtoken":"^8.0.1"},"devDependencies":{"@whizark/cz-cli":"^0.4.0","ava":"^0.22.0","commitizen":"^2.9.6","coveralls":"^2.13.1","cz-conventional-changelog":"^2.0.0","husky":"^0.13.4","lint-staged":"^3.6.0","nyc":"^11.1.0","prettier-standard":"^6.0.0","ramda":"^0.25.0","semantic-release":"^8.0.3","snazzy":"^7.0.0","standard":"^10.0.3"},"lint-staged":{"*.js":["prettier-standard","git add"]},"scripts":{"precommit":"lint-staged","commit":"git-cz","lint":"standard | snazzy","test":"nyc ava","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"config":{"commitizen":{"path":"node_modules/cz-conventional-changelog"}},"nyc":{"include":["index.js","JwtError.js"]}} |
4848
85
2
+ Addedclone@^2.1.1
+ Addedclone@2.1.2(transitive)