New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kofile/jwt-client

Package Overview
Dependencies
Maintainers
35
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kofile/jwt-client - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

27

index.js

@@ -9,5 +9,2 @@ const jsonwebtoken = require('jsonwebtoken')

this._payload = this._decode(this._jwt)
this._assertShape(this._payload)
this._userId = this._payload.id

@@ -18,14 +15,2 @@ this._tenantId = this._payload.tenantId

_assertShape (payload) {
const requiredFields = ['id', 'ort', 'tenantId', 'tenants']
requiredFields.forEach(fieldName => {
if (!payload.hasOwnProperty(fieldName)) {
throw new JwtError(`No "${fieldName}" in JWT Payload`)
}
})
return payload
}
_split (jwt) {

@@ -88,2 +73,14 @@ if (jwt) {

}
validate (propsToValidate = []) {
const dump = this.dump()
propsToValidate.forEach(prop => {
if (dump[prop] === null || dump[prop] === undefined) {
throw new JwtError(`jwt.${prop} is not set!`)
}
})
return true
}
}

@@ -90,0 +87,0 @@

@@ -1,1 +0,1 @@

{"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"]}}
{"name":"@kofile/jwt-client","version":"3.0.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"]}}

@@ -30,2 +30,4 @@ # @kofile/jwt-client

client.validate()
## Usage Example

@@ -68,2 +70,8 @@ ```js

makeClient.isAJwtError(myError)
// validate that `id` and `ort` are not null or undefined
//
// - throws a custom JwtError if a key is null or undefined
// - returns true if validations pass
client.validate(['id', 'ort'])
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc