-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow building ucans without
nbf
set & fix builder's timestamps to …
…be second-based, not millisecond-based. (#45) * Allow building UCANs without `nbf` * JWTs use seconds as timestamp units! * Make tests use second-based timestamps
- Loading branch information
Showing
5 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ describe("Builder", () => { | |
const fact2 = { preimage: "abc", hash: "sth" } | ||
const cap1 = { email: "[email protected]", cap: "SEND" } | ||
const cap2 = { wnfs: "alice.fission.name/public/", cap: "SUPER_USER" } | ||
const expiration = Date.now() + 30 * 1000 | ||
const notBefore = Date.now() - 30 * 1000 | ||
const expiration = Math.floor(Date.now() / 1000) + 30 | ||
const notBefore = Math.floor(Date.now() / 1000) - 30 | ||
|
||
const ucan = await Builder.create() | ||
.issuedBy(alice) | ||
|
@@ -40,7 +40,7 @@ describe("Builder", () => { | |
.withLifetimeInSeconds(300) | ||
.buildParts() | ||
|
||
expect(parts.payload.exp).toBeGreaterThan(Date.now() + 290 * 1000) | ||
expect(parts.payload.exp).toBeGreaterThan(Date.now() / 1000 + 290) | ||
}) | ||
|
||
it("prevents duplicate proofs", async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters