mirror of
https://github.com/hanzoai/node-jsonwebtoken.git
synced 2026-09-24 17:00:48 +00:00
Fix 'cert' token which isn't a cert (#554)
Certs have pubkeys. We sign things with private keys.
This commit is contained in:
committed by
Eduardo Diaz
parent
d00ab1d8e0
commit
0d33928084
@@ -72,13 +72,13 @@ var token = jwt.sign({ foo: 'bar' }, 'shhhhh');
|
||||
Synchronous Sign with RSA SHA256
|
||||
```js
|
||||
// sign with RSA SHA256
|
||||
var cert = fs.readFileSync('private.key');
|
||||
var token = jwt.sign({ foo: 'bar' }, cert, { algorithm: 'RS256'});
|
||||
var privateKey = fs.readFileSync('private.key');
|
||||
var token = jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256'});
|
||||
```
|
||||
|
||||
Sign asynchronously
|
||||
```js
|
||||
jwt.sign({ foo: 'bar' }, cert, { algorithm: 'RS256' }, function(err, token) {
|
||||
jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256' }, function(err, token) {
|
||||
console.log(token);
|
||||
});
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user