Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ jwt.verify(token, getKey, options, function(err, decoded) {
<details>
<summary><em></em>Need to peek into a JWT without verifying it? (Click to expand)</summary>

### jwt.decode(token [, options])
### jwt.unsafe_decode(token [, options])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aalu-love Could you make it camelCase? So it can match javascript default case


(Synchronous) Returns the decoded payload without verifying if the signature is valid.

Expand All @@ -263,10 +263,10 @@ Example

```js
// get the decoded payload ignoring signature, no secretOrPrivateKey needed
var decoded = jwt.decode(token);
var decoded = jwt.unsafe_decode(token);

// get the decoded payload and header
var decoded = jwt.decode(token, {complete: true});
var decoded = jwt.unsafe_decode(token, {complete: true});
console.log(decoded.header);
console.log(decoded.payload)
```
Expand Down
2 changes: 1 addition & 1 deletion decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var jws = require('jws');

module.exports = function (jwt, options) {
options = options || {};
var decoded = jws.decode(jwt, options);
var decoded = jws.unsafe_decode(jwt, options);
if (!decoded) { return null; }
var payload = decoded.payload;

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
decode: require('./decode'),
unsafe_decode: require('./decode'),
verify: require('./verify'),
sign: require('./sign'),
JsonWebTokenError: require('./lib/JsonWebTokenError'),
Expand Down
Loading