Skip to content

Commit

Permalink
docs: update fetchVerificationKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
francisfuzz committed Sep 16, 2024
1 parent 6322126 commit 693ca29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,25 @@ await verifyRequestByKeyId(request.body, signature, key, { request });
#### `async fetchVerificationKeys(options)`

Fetches public keys for verifying copilot extension requests [from GitHub's API](https://api.github.com/meta/public_keys/copilot_api)
and returns them as an array. The request can be made without authentication, with a token, or with a custom [octokit request](https://github.com/octokit/request.js) instance.
and returns them as an array. The request can be made without authentication, with a token, with a custom [octokit request](https://github.com/octokit/request.js) instance, or with a cache.

```js
import { fetchVerificationKeys } from "@copilot-extensions/preview-sdk";

// fetch without authentication
const [current] = await fetchVerificationKeys();
const { id, keys } = await fetchVerificationKeys();

// with token
const [current] = await fetchVerificationKeys({ token: "ghp_1234" });
const { id, keys } = await fetchVerificationKeys({ token: "ghp_1234" });

// with custom octokit request instance
const [current] = await fetchVerificationKeys({ request });)
const { id, keys } = await fetchVerificationKeys({ request });

// with cache
const cache = { id: "etag_value", keys: [{ key_identifier: "key1", key: "public_key1" }] };
const { id, keys } = await fetchVerificationKeys({ cache });
```
````
#### `async verifyRequestPayload(rawBody, signature, keyId)`
Expand Down
1 change: 0 additions & 1 deletion lib/verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export async function fetchVerificationKeys(

throw error;
}

}

/** @type {import('..').VerifyRequestByKeyIdInterface} */
Expand Down

0 comments on commit 693ca29

Please sign in to comment.