Skip to content

Commit f29e494

Browse files
authored
fix: adjust iat and nbf for id token signing (#625)
1 parent 45a1293 commit f29e494

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.changeset/young-forks-jog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@blockchain-lab-um/masca": patch
3+
---
4+
5+
Adjust nbf and iat for idtoken signing

packages/snap/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"./files/circuits/credentialAtomicQuerySigV2/circuit_final.zkey",
2727
"./files/circuits/credentialAtomicQuerySigV2/verification_key.json"
2828
],
29-
"shasum": "BOsLk3unGah8h8EbmeUV37papTKym1Tlb+sYI/sK1wg="
29+
"shasum": "BxBaqzALa1v9aL1XW5mcXd/ppZOisCN+LmrEjpifQ4E="
3030
},
3131
"initialPermissions": {
3232
"endowment:ethereum-provider": {},

packages/snap/src/utils/sign.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export const sign = async (signArgs: SignArgs, signOptions: SignOptions) => {
2626

2727
const jwtPayload = {
2828
...signArgs.payload,
29-
exp: Math.floor(Date.now() / 1000) + 60 * 60,
30-
iat: Math.floor(Date.now() / 1000),
31-
nbf: Math.floor(Date.now() / 1000),
29+
exp: Math.floor(new Date().getTime() / 1000) + 60 * 60, // 1 hour in the future
30+
iat: Math.floor(new Date().getTime() / 1000) - 60, // 1 minute in the past
31+
nbf: Math.floor(new Date().getTime() / 1000) - 60, // 1 minute in the past
3232
iss: did,
3333
sub: did,
3434
};

0 commit comments

Comments
 (0)