Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #952 fixed rename decode function unsafe_decode #953

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
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
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
@@ -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