Skip to content

Commit

Permalink
add pgp remove test eml
Browse files Browse the repository at this point in the history
  • Loading branch information
Metachaser24 committed Mar 27, 2024
1 parent 7d928c8 commit da1bd8b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
25 changes: 16 additions & 9 deletions packages/circuits/tests/test.eml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kKhuE5byXTQp33gguA7XPzgZSjri6T33WTIDBGZl1vI=; b=AKGfZHblJQeG0ltVB3xTRU5CfViO9sj6hiKBl2ywQ5STwvZOSJJuUacYTxdVjGz5ud7LwV/UJcz7JGtJ5rtxiyvJyYdrMHMpaktO5eNEes4iMeQjUtTACmcEtE2lXx8jO/KqTYYh0yyav68atRbO7OGz/ZA5bclu4OZZ44UC1htg0KYPfaoYt2T5ScUmOITGJRcfJOu9Xx40VTqEW7YiIvY0jtPVoUHVKKX8Zn3DsgaKIg91xHz/a0dR8AP5J9IslBwL9QTGY0PXQT/TS2aCez4Li9/alCG7C7InkRVnUufbZKfsOKoMq9AkkwDsyS+WRyALtlL5Kh1GayaeFRj/bQ==
From: gideon mukoro <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1693038337; bh=7xQMDuoVVU4m0W0WRVSrVXMeGSIASsnucK9dJsrc+vU=; h=from:Content-Type:Mime-Version:Subject:Message-Id:Date:to; b=EhLyVPpKD7d2/+h1nrnu+iEEBDfh6UWiAf9Y5UK+aPNLt3fAyEKw6Ic46v32NOcZD
M/zhXWucN0FXNiS0pz/QVIEy8Bcdy7eBZA0QA1fp8x5x5SugDELSRobQNbkOjBg7Mx
VXy7h4pKZMm/hKyhvMZXK4AX9fSoXZt4VGlAFymFNavfdAeKgg/SHXLds4lOPJV1wR
2E21g853iz5m/INq3uK6SQKzTnz/wDkdyiq90gC0tHQe8HpDRhPIqgL5KSEpuvUYmJ
wjEOwwHqP6L3JfEeROOt6wyuB1ah7wgRvoABOJ81+qLYRn3bxF+y1BC+PwFd5yFWH5
Ry43lwp1/3+sA==
from: [email protected]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\))
Subject: Hello
Message-Id: <MN2PR13MB38235B94DD6A0CE0C071941ED3312@MN2PR13MB3823.namprd13.prod.outlook.com>
Date: Fri, 22 Mar 2024 09:13:55 +0000
to: "zkemailverify@gmail.com" <[email protected]>
Message-Id: <8F819D32-B6AC-489D-977F-438BBC4CAB27@me.com>
Date: Sat, 26 Aug 2023 12:25:22 +0400
to: zkewtest@gmail.com

Testing testing 123...
Hello,

How are you?
12 changes: 12 additions & 0 deletions packages/helpers/src/dkim/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ export async function verifyDKIMSignature(
tryRevertARCChanges: boolean = true
): Promise<DKIMVerificationResult> {

const emailStr = email.toString();

const pgpMarkers = [
"BEGIN PGP MESSAGE",
"BEGIN PGP SIGNED MESSAGE",
];

const isPGPEncoded = pgpMarkers.some(marker => emailStr.includes(marker));

if (isPGPEncoded) {
throw new Error("PGP encoded emails are not supported.");
}
let dkimResult = await tryVerifyDKIM(email, domain);

if (dkimResult.status.result !== "pass" && tryRevertARCChanges) {
Expand Down

0 comments on commit da1bd8b

Please sign in to comment.