Skip to content
Merged
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
7 changes: 6 additions & 1 deletion sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
}

if (typeof options.notBefore !== 'undefined') {
payload.nbf = timespan(options.notBefore, timestamp);
try {
payload.nbf = timespan(options.notBefore, timestamp);
}
catch (err) {
return failure(err);
}
if (typeof payload.nbf === 'undefined') {
return failure(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
}
Expand Down
Loading