Skip to content

Commit

Permalink
fix: accept when sender email is different
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersuweijie committed Nov 8, 2024
1 parent 29b3c4f commit 5b669f7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@rainbow-me/rainbowkit": "^2.1.3",
"@tanstack/react-query": "^5.51.15",
"@zk-email/circuits": "6.1.1",
"@zk-email/helpers": "6.1.1",
"@zk-email/helpers": "6.2.0",
"@zk-email/zk-email-sdk": "^1.0.6",
"@zk-email/relayer-utils": "^0.4.2",
"archiver": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/app/submit/email/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function processEmail(values: z.infer<typeof formSchema>, email: st
let headerString;

try {
result = await verifyDKIMSignature(email)
result = await verifyDKIMSignature(email, values.parameters.senderDomain)
} catch (e: any) {
return {
error: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export async function generateCircuitInputs(rawEmail, inputs) {
maxBodyLength: <%- ignoreBodyHashCheck ? 0 : emailBodyMaxLength %>,
maxHeadersLength: <%- emailHeaderMaxLength || 1024 %>,
shaPrecomputeSelector: "<%- shaPrecomputeSelector.replaceAll('"', '\\\"') %>",
},
{
domain: "<%- senderDomain %>",
});

const emailBodyString = circuitInputs.emailBody ? Buffer.from(circuitInputs.emailBody.map(Number)).toString('ascii') : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@types/node-forge": "^1.3.11",
"@zk-email/circuits": "6.1.1",
"@zk-email/helpers": "6.1.1",
"@zk-email/helpers": "6.2.0",
"node-forge": "^1.3.1",
"snarkjs": "^0.7.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export async function generateCircuitInputs(rawEmail, inputs) {
shaPrecomputeSelector: "<%- shaPrecomputeSelector %>",
enableBodyMasking: true,
mask: JSON.parse(inputs["mask"]) || Array.apply(null, {length: <%- emailBodyMaxLength %> }).map(() => 0)
},
{
domain: "<%- senderDomain %>",
});

const emailBodyString = circuitInputs.emailBody ? Buffer.from(circuitInputs.emailBody.map(Number)).toString('ascii') : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"dependencies": {
"@types/node-forge": "^1.3.11",
"@zk-email/circuits": "6.1.5",
"@zk-email/helpers": "6.1.5",
"@zk-email/circuits": "6.2.0",
"@zk-email/helpers": "6.2.0",
"node-forge": "^1.3.1",
"snarkjs": "^0.7.4"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2516,10 +2516,10 @@
"@zk-email/zk-regex-circom" "^2.1.0"
circomlib "^2.0.5"

"@zk-email/helpers@6.1.1":
version "6.1.1"
resolved "https://registry.yarnpkg.com/@zk-email/helpers/-/helpers-6.1.1.tgz#3172d07c7fd1ce56a2957dc9ff32b0bc7d1592a3"
integrity sha512-u3LYa8rLdLCvy4FpgXOfQNJPOIrj26CwxLDEYOwyDwYpdSdvEgqE/FL1h2Rwkr1TdbneWaCeSVQC4jhtQaXswg==
"@zk-email/helpers@6.2.0":
version "6.2.0"
resolved "https://registry.yarnpkg.com/@zk-email/helpers/-/helpers-6.2.0.tgz#be0fd0f4626b3b8d1f8e16cafa4936bd6e138bb0"
integrity sha512-BRrVjRKxfcz8waPIVYLn3D2y9dCBafdBCEtjgzbz9Jh8WyJZJNKMJ3MVjm28V5He+H6YyOcatSItO+VIuQ1Nrw==
dependencies:
addressparser "^1.0.1"
atob "^2.1.2"
Expand Down

0 comments on commit 5b669f7

Please sign in to comment.