Skip to content

v5.0.0

@francisfuzz francisfuzz tagged this 18 Sep 03:55
## 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 <39992+gr2m@users.noreply.github.com>
Assets 2
Loading