
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@kofile/jwt-client
Advanced tools
A simple JWT Reader.
const makeClient = require('@kofile/jwt-client')
const client = makeClient(jwt)
client.userId
client.tenantId
client.ort
client.encoded
client.dump()
client.getRoleIdForTenant(tenantId)
client.validate()
const makeClient = require('@kofile/jwt-client')
const payload = {
id: 123,
tenantId: '48121',
ort: 'dsgsgasdgdfhws',
tenant: {
48121: {
authorization: 1
}
}
}
const jwt = jsonwebtoken.sign(payload, 'key')
const client = makeClient(jwt)
// get user id
client.userId //=> 123
// get tenant id
client.tenantId //=> 48121
//get ort
client.ort //=> dsgsgasdgdfhws
// get encoded jwt
client.encoded //=> jsonwebtoken.sign(payload, 'key')
// get the entire payload body
client.dump() //=> payload
// get role id for a tenant
client.getRoleIdForTenant(tenantId) //=> 1
// check if an error is a custom JwtError
makeClient.isAJwtError(myError)
// validate that `userId` and `ort` are not null or undefined
//
// - throws a custom JwtError if a key is null or undefined
// - returns true if validations pass
// - pass in the keys of the public API, **not** internal structure
client.validate(['userId', 'ort'])
FAQs
A simple JWT reader
We found that @kofile/jwt-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 26 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.