Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust iat and nbf for id token signing #625

Merged
merged 1 commit into from
Apr 12, 2024
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
5 changes: 5 additions & 0 deletions .changeset/young-forks-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blockchain-lab-um/masca": patch
---

Adjust nbf and iat for idtoken signing
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"./files/circuits/credentialAtomicQuerySigV2/circuit_final.zkey",
"./files/circuits/credentialAtomicQuerySigV2/verification_key.json"
],
"shasum": "BOsLk3unGah8h8EbmeUV37papTKym1Tlb+sYI/sK1wg="
"shasum": "BxBaqzALa1v9aL1XW5mcXd/ppZOisCN+LmrEjpifQ4E="
},
"initialPermissions": {
"endowment:ethereum-provider": {},
Expand Down
6 changes: 3 additions & 3 deletions packages/snap/src/utils/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const sign = async (signArgs: SignArgs, signOptions: SignOptions) => {

const jwtPayload = {
...signArgs.payload,
exp: Math.floor(Date.now() / 1000) + 60 * 60,
iat: Math.floor(Date.now() / 1000),
nbf: Math.floor(Date.now() / 1000),
exp: Math.floor(new Date().getTime() / 1000) + 60 * 60, // 1 hour in the future
iat: Math.floor(new Date().getTime() / 1000) - 60, // 1 minute in the past
nbf: Math.floor(new Date().getTime() / 1000) - 60, // 1 minute in the past
iss: did,
sub: did,
};
Expand Down
Loading