Skip to content

Commit

Permalink
Update README, using code fence for syntax highlight.
Browse files Browse the repository at this point in the history
  • Loading branch information
hokaccha committed Jun 24, 2014
1 parent 1d21afb commit a2a14d0
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@

## Usage

var jwt = require('jwt-simple');
var payload = { foo: 'bar' };
var secret = 'xxx';
```javascript
var jwt = require('jwt-simple');
var payload = { foo: 'bar' };
var secret = 'xxx';

// encode
var token = jwt.encode(payload, secret);
// encode
var token = jwt.encode(payload, secret);

// decode
var decoded = jwt.decode(token, secret);
console.log(decoded); //=> { foo: 'bar' }
// decode
var decoded = jwt.decode(token, secret);
console.log(decoded); //=> { foo: 'bar' }
```

### Algorithms

By default the algorithm to encode is `HS256`.

The supported algorithms for encoding and decoding are `HS256`, `HS384`, `HS512` and `RS256`.

// encode using HS512
jwt.encode(payload, secret, 'HS512')
```javascript
// encode using HS512
jwt.encode(payload, secret, 'HS512')
```

0 comments on commit a2a14d0

Please sign in to comment.