Skip to content

Commit 0a9888f

Browse files
committed
Merge branch 'Asana-option-no-timestamp'
2 parents 7c13631 + 81e45ae commit 0a9888f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ encoded private key for RSA and ECDSA.
2929
* `audience`
3030
* `subject`
3131
* `issuer`
32+
* `noTimestamp`
3233

3334
If `payload` is not a buffer or a string, it will be coerced into a string
3435
using `JSON.stringify`.
3536

3637
If any `expiresInMinutes`, `audience`, `subject`, `issuer` are not provided, there is no default. The jwt generated won't include those properties in the payload.
3738

39+
Generated jwts will include an `iat` claim by default unless `noTimestamp` is specified.
40+
3841
Example
3942

4043
```js

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ module.exports.sign = function(payload, secretOrPrivateKey, options) {
1616
});
1717
}
1818

19-
payload.iat = Math.floor(Date.now() / 1000);
19+
if (!options.noTimestamp) {
20+
payload.iat = Math.floor(Date.now() / 1000);
21+
}
2022

2123
if (options.expiresInMinutes) {
2224
var ms = options.expiresInMinutes * 60;

0 commit comments

Comments
 (0)