Skip to content

Commit

Permalink
Code Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
IanMitchell committed Jun 27, 2023
1 parent 263a38e commit a0e56da
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/discord-verify/src/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ export async function isValid(
publicKey: string,
algorithm?: string
) {
const signature = event.headers["X-Signature-Ed25519"];
const timestamp = event.headers["X-Signature-Timestamp"];
const { body } = event;
if (!signature || !timestamp || !body) return false;
const signature = event?.headers?.["X-Signature-Ed25519"];
const timestamp = event?.headers?.["X-Signature-Timestamp"];

try {
await verify(
event.body,
event?.body,
signature,
timestamp,
publicKey,
Expand All @@ -38,7 +36,7 @@ export async function isValid(
} catch (error: unknown) {
if (error instanceof Error && error.constructor.name === "DOMException") {
return verify(
event.body,
event?.body,
signature,
timestamp,
publicKey,
Expand Down

0 comments on commit a0e56da

Please sign in to comment.