Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
jwt-generate
Advanced tools
Generate a JSON Web Token - JWT
npm install -g jwt-generate
jwt-generate <command>
Commands:
jwt-generate generate Generates a JWT.
jwt-generate decode <jwt> Decodes a JWT.
Options:
--version Show version number [boolean]
--help Show help [boolean]
jwt-generate generate
Generates a JWT. Either 'secret' or 'secretFile' must be supplied.
Options:
--version Show version number [boolean]
--help Show help [boolean]
--secret, -s JWT secret string.
--secretFile, -f File path containing the JWT Secret.
--algorithm, -a Choices: "RS256", "HS256". [string] [default: "HS256"]
--expire, --exp How long in seconds until the JWT should expire. [number]
--claims JWT claims.
jwt-generate decode <jwt>
Decodes a JWT.
Options:
--version Show version number [boolean]
--help Show help [boolean]
Generates a JWT signed with the secret 'my-secret' using the HS256 algorithm.
jwt-generate generate --secret my-secret
{
"headers": {
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzOTIsImV4cCI6MTUyMDAyOTk5Mn0.5TkR3nHlPA2LJhe8jGxE26AnkeCkfFeVrJN5FdOUPew"
},
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzOTIsImV4cCI6MTUyMDAyOTk5Mn0.5TkR3nHlPA2LJhe8jGxE26AnkeCkfFeVrJN5FdOUPew"
}
Generates a JWT signed with private key file 'private_key.pem' using the HS256 algorithm.
jwt-generate generate --secretFile private_key.pem
{
"headers": {
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzODAsImV4cCI6MTUyMDAyOTk4MH0.19sUG-ncAycxdosaZJDGpkeSfuugmEH_fCPRJtTsOI4"
},
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzODAsImV4cCI6MTUyMDAyOTk4MH0.19sUG-ncAycxdosaZJDGpkeSfuugmEH_fCPRJtTsOI4"
}
Generates a JWT signed with private key file 'private_key.pem' using the RS256 algorithm.
jwt-generate generate -f private_key.pem -a RS256
{
"headers": {
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzNTIsImV4cCI6MTUyMDAyOTk1Mn0.AkPpR5BASPD4qY-y_RIkVuaRNTnnA4VCyq7qRPd7nwsbdRGifDlRVJi0RoxyzFAWBkgskTJJK3Zb8v_AF16yp8QkNx00SvTMGOYueFjk2cWxCOneJyJ14K4huflTvqmky5VTpI6Bv5l6ezrpZaWVM9bmpbqI-_QC6A74mFkC5T45WRPXx0K14YCL2lW8UelnRFb8b3y9CdOA088wU4fShLHQvzPS0lzH-WXjfHl5_Dt7AjV8Bwim1sJS1yZudebKV3qEnO9nd4OhMlTeFH2vxevPumtlmmqCf6e5K59x27KcIu7tfkRK81WjX1HP-UiD-p0rpcney3oBDMHcjwIqZQ"
},
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzNTIsImV4cCI6MTUyMDAyOTk1Mn0.AkPpR5BASPD4qY-y_RIkVuaRNTnnA4VCyq7qRPd7nwsbdRGifDlRVJi0RoxyzFAWBkgskTJJK3Zb8v_AF16yp8QkNx00SvTMGOYueFjk2cWxCOneJyJ14K4huflTvqmky5VTpI6Bv5l6ezrpZaWVM9bmpbqI-_QC6A74mFkC5T45WRPXx0K14YCL2lW8UelnRFb8b3y9CdOA088wU4fShLHQvzPS0lzH-WXjfHl5_Dt7AjV8Bwim1sJS1yZudebKV3qEnO9nd4OhMlTeFH2vxevPumtlmmqCf6e5K59x27KcIu7tfkRK81WjX1HP-UiD-p0rpcney3oBDMHcjwIqZQ"
}
Outputs the decoded JWT in JSON format.
jwt-generate decode eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYyOTAsImV4cCI6MTUyMDAyOTg5MH0.lUGQ7n3QTWGLrH-KcMkCWsGlMWxO-QodOEdbGSeZF-A
{
"header": {
"typ": "JWT",
"alg": "HS256"
},
"payload": {
"iat": 1520026290,
"exp": 1520029890
},
"signature": "lUGQ7n3QTWGLrH-KcMkCWsGlMWxO-QodOEdbGSeZF-A"
}
FAQs
Generate a 'JSON Web Token' (JWT).
We found that jwt-generate 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.