Skip to content

Commit

Permalink
chore: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
nvtaveras committed Jul 31, 2024
1 parent 898f51c commit e6ff887
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/validate-request-origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ export async function isFromQuicknode(req: Request): Promise<boolean> {
const contentHash = req.headers["x-qn-content-hash"];
const timestamp = req.headers["x-qn-timestamp"];

if (!nonce || typeof nonce !== "string") {
return false;
}

if (!contentHash || typeof contentHash !== "string") {
return false;
}

if (!timestamp || typeof timestamp !== "string") {
return false;
}

const hmac = crypto.createHmac("sha256", quicknodeSecurityToken);
hmac.update(`${nonce}${contentHash}${timestamp}`);

Expand Down
2 changes: 1 addition & 1 deletion test-deployed-function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ auth_token=$(gcloud secrets versions access latest --secret x-auth-token)

curl "${function_url}" \
-H "Content-Type: application/json" \
-H "X-AUTH-TOKEN: $auth_token" \
-H "X-AUTH-TOKEN: ${auth_token}" \
-d @src/proposal-created.fixture.json

0 comments on commit e6ff887

Please sign in to comment.