Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@abskmj/jwt-utility
Advanced tools
This utility can be used to generate and parse JWTs (JSON Web Tokens).
Method | Arguments | Description |
---|---|---|
getFactory | String | Set algorithm to be used to generate the JWT and returns an instance of Factory |
getParser | Returns an instance of Parser which can be used to parse and verify a JWT |
const JWTUtility = require('@abskmj/jwt-utility');
let jwt = JWTUtility.getFactory('HS256')
.setIssuer('AuthServer')
.setSubject('Login')
.setExpiry(10)
.setClaims({
user: 'testUser',
name: 'Test User'
})
.sign('secret key');
Method | Arguments | Description |
---|---|---|
setIssuer | String | Set iss claim value. |
setSubject | String | Set sub claim value. |
setAudience | String | Set aud claim value. |
setExpiry | Number | Set exp claim value, value will be current epoch time in seconds + seconds passed as argument. |
setClaims | JSON | Set the custom data that will be part of the JWT. |
sign | String | Generate the JWT using the secret key passed |
const JWTUtility = require('@abskmj/jwt-utility');
let data = JWTUtility.getParser()
.validateIssuer('AuthServer')
.validateSubject('Login')
.parse(jwt, 'secret key');
/*
data:
{
headers: {
alg: 'HS256',
typ: 'JWT'
},
claims: {
user: 'testUser',
name: 'Test User',
iat: 1512555172,
iss: 'AuthServer',
sub: 'Login',
exp: 1512555182
}
}
*/
Method | Arguments | Description |
---|---|---|
validateIssuer | String | Validate iss claim value. |
validateSubject | String | Validate sub claim value. |
validateAudience | String | Validate aud claim value. |
validateExpiry | Number | Validate exp claim value, value validated against current epoch time in seconds + seconds passed as argument. |
parse | String, String | Set JWT token and key used to verify the token |
Support for RS256, RS384, RS512 is not planned yet. Please get in touch with the developer, if you wish to request any new functionality or bug fix.
FAQs
JWT Utility for Node.js
We found that @abskmj/jwt-utility demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.