We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e37ef0e commit cec3f92Copy full SHA for cec3f92
lib/shc.js
@@ -9,17 +9,19 @@ const URI_SCHEMA = 'shc';
9
* I am not sure if I should build this by hand.
10
*/
11
export async function makeJWT(payload, monthsToExpire, issuer, notBeforeDate) {
12
- let iss = new Date();
13
- let exp = new Date(iss);
+ let today = new Date();
+ let exp = new Date(today);
14
exp.setMonth(exp.getMonth()+monthsToExpire);
15
16
let jwt = {
17
iss: issuer,
18
- iat: Math.round(iss.getTime()/1000),
19
- exp: Math.round(exp.getTime()/1000),
20
vc: payload
21
};
22
+ if (monthsToExpire) {
+ jwt['exp'] = Math.round(exp.getTime()/1000)
23
+ }
24
+
25
if (notBeforeDate)
26
jwt['nbf'] = Math.round(notBeforeDate.getTime()/1000);
27
0 commit comments