Skip to content

Commit

Permalink
style: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Sep 18, 2024
1 parent 659a108 commit 47c473e
Show file tree
Hide file tree
Showing 4 changed files with 4,192 additions and 4,187 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,27 @@ const { isValid, cache } = await verifyRequestByKeyId(
request.body,
signature,
keyId,
{ token: "ghp_1234" }
{ token: "ghp_1234" },
);

// with custom octokit request instance
const { isValid, cache } = await verifyRequestByKeyId(
request.body,
signature,
keyId,
{ request }
{ request },
);

// with cache
const previousCache = { id: "etag_value", keys: [{ key_identifier: "key1", key: "public_key1", is_current: true }] };
const previousCache = {
id: "etag_value",
keys: [{ key_identifier: "key1", key: "public_key1", is_current: true }],
};
const { isValid, cache } = await verifyRequestByKeyId(
request.body,
signature,
keyId,
{ cache: previousCache }
{ cache: previousCache },
);
```

Expand All @@ -135,7 +138,10 @@ const { id, keys } = await fetchVerificationKeys({ token: "ghp_1234" });
const { id, keys } = await fetchVerificationKeys({ request });

// with cache
const cache = { id: "etag_value", keys: [{ key_identifier: "key1", key: "public_key1" }] };
const cache = {
id: "etag_value",
keys: [{ key_identifier: "key1", key: "public_key1" }],
};
const { id, keys } = await fetchVerificationKeys({ cache });
```

Expand All @@ -146,11 +152,7 @@ Verify the request payload using the provided signature and key. Note that the r
```js
import { verify } from "@copilot-extensions/preview-sdk";

const payloadIsVerified = await verifyRequest(
request.body,
signature,
key,
);
const payloadIsVerified = await verifyRequest(request.body, signature, key);
// true or false
```

Expand Down Expand Up @@ -307,7 +309,7 @@ const { isValidRequest, payload, cache } = await verifyAndParseRequest(
keyId,
{
token: process.env.GITHUB_TOKEN,
}
},
);

if (!isValidRequest) {
Expand Down
Loading

0 comments on commit 47c473e

Please sign in to comment.