-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optional generic types for
Payload
(#84)
- Loading branch information
Showing
9 changed files
with
61 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * as base64url from "https://deno.land/std@0.204.0/encoding/base64url.ts"; | ||
export * as base64url from "https://deno.land/std@0.205.0/encoding/base64url.ts"; |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
export { serve } from "https://deno.land/[email protected]/http/server.ts"; | ||
export * as base64 from "https://deno.land/[email protected]/encoding/base64.ts"; | ||
export * as base64 from "https://deno.land/[email protected]/encoding/base64.ts"; |
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 |
---|---|---|
|
@@ -174,6 +174,13 @@ Deno.test({ | |
Error, | ||
"The jwt's alg 'HS256' does not match the key's algorithm.", | ||
); | ||
await assertRejects( | ||
async () => { | ||
await create(header, "invalid payload" as unknown as Payload, keyHS512); | ||
}, | ||
Error, | ||
"The jwt claims set is not a JSON object.", | ||
); | ||
}, | ||
}); | ||
|
||
|
@@ -222,6 +229,19 @@ Deno.test({ | |
{ exp: 0 }, | ||
); | ||
|
||
await assertEquals( | ||
(await verify<{ email: string }>( | ||
await create( | ||
{ alg: "HS512", typ: "JWT" }, | ||
{ email: "[email protected]" }, | ||
keyHS512, | ||
), | ||
keyHS512, | ||
{ ignoreExp: true }, | ||
)).email, | ||
"[email protected]", | ||
); | ||
|
||
await assertEquals( | ||
await verify( | ||
await create( | ||
|
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