-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
The Jwt.prototype.setIssuedAt() and .setExpiration() functions are both time-related, but take in three separate arguments of inconsistent types. IssuedAt only takes in an integer representing seconds, while Expiration can take an integer representing milliseconds, or a Date object. Can you make these arguments consistent?
njwt.create(...)
.setIssuedAt(seconds)
.setExpiration(date or milliseconds);
IssuedAt:
Lines 182 to 185 in ce98cd4
Jwt.prototype.setIssuedAt = function setIssuedAt(iat) { | |
this.body.iat = iat; | |
return this; | |
}; |
Lines 155 to 157 in ce98cd4
if (!this.body.iat) { | |
this.setIssuedAt(nowEpochSeconds()); | |
} |
Lines 38 to 40 in ce98cd4
function nowEpochSeconds(){ | |
return Math.floor(new Date().getTime()/1000); | |
} |
Expiration:
Line 188 in ce98cd4
this.body.exp = Math.floor((exp instanceof Date ? exp : new Date(exp)).getTime() / 1000); |
Metadata
Metadata
Assignees
Labels
No labels