Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jwt-simple

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwt-simple - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

14

lib/jwt.js

@@ -46,3 +46,3 @@ /*

*/
jwt.version = '0.5.0';
jwt.version = '0.5.1';

@@ -86,2 +86,8 @@ /**

// verify signature. `sign` will return base64 string.
var signingInput = [headerSeg, payloadSeg].join('.');
if (!verify(signingInput, key, signingMethod, signingType, signatureSeg)) {
throw new Error('Signature verification failed');
}
// Support for nbf and exp claims.

@@ -96,8 +102,2 @@ // According to the RFC, they should be in seconds.

}
// verify signature. `sign` will return base64 string.
var signingInput = [headerSeg, payloadSeg].join('.');
if (!verify(signingInput, key, signingMethod, signingType, signatureSeg)) {
throw new Error('Signature verification failed');
}
}

@@ -104,0 +104,0 @@

{
"name": "jwt-simple",
"description": "JWT(JSON Web Token) encode and decode module",
"version": "0.5.0",
"version": "0.5.1",
"author": "Kazuhito Hokamura <k.hokamura@gmail.com>",

@@ -6,0 +6,0 @@ "repository": {

@@ -16,2 +16,5 @@ # node-jwt-simple

// HS256 secrets are typically 128-bit random strings, for example hex-encoded:
// var secret = Buffer.from('fe1a1915a379f3be5394b64d14794932', 'hex)
// encode

@@ -25,2 +28,24 @@ var token = jwt.encode(payload, secret);

### decode params
```javascript
/*
* jwt.decode(token, key, noVerify, algorithm)
*/
// decode, by default the signature of the token is verified
var decoded = jwt.decode(token, secret);
console.log(decoded); //=> { foo: 'bar' }
// decode without verify the signature of the token,
// be sure to KNOW WHAT ARE YOU DOING because not verify the signature
// means you can't be sure that someone hasn't modified the token payload
var decoded = jwt.decode(token, secret, true);
console.log(decoded); //=> { foo: 'bar' }
// decode with a specific algorithm (not using the algorithm described in the token payload)
var decoded = jwt.decode(token, secret, false, 'HS256');
console.log(decoded); //=> { foo: 'bar' }
```
### Algorithms

@@ -27,0 +52,0 @@

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