-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support caching of verification kys (#81)
## Summary Closes #9 Previously, clients who fetched verification keys from the server had no way to cache those keys and reuse them for other requests. This PR proposes a change using the GitHub API's [conditional requests](https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#use-conditional-requests-if-appropriate) feature: clients can optionally specify a cache for their keys and only fetch new ones if the cache is outdated. BREAKING CHANGE: `verifyRequestByKeyId() now returns an object with a `isValid` property and a`cache` property. Before ```js const isValid = await verifyRequestByKeyId(); ``` After ```js const { isValid, cache } = await verifyRequestByKeyId(); ``` BREAKING CHANGE: `fetchVerificationKeys()` now returns an object with a `keys` property and a`cache` property. Before ```js const keys = await fetchVerificationKeys(); ``` After ```js const { keys, cache } = await fetchVerificationKeys(); ``` --------- Co-authored-by: Gregor Martynus <[email protected]>
- Loading branch information
1 parent
38e210f
commit 1f56d8e
Showing
9 changed files
with
4,448 additions
and
4,242 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
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
Oops, something went wrong.