Skip to content

Commit

Permalink
Merge pull request #135 from zkemail/dkim-reg-script
Browse files Browse the repository at this point in the history
Script for DKIM Reg
  • Loading branch information
Divide-By-0 authored Nov 9, 2023
2 parents 941ab0f + 9162562 commit 907f950
Show file tree
Hide file tree
Showing 13 changed files with 2,904 additions and 383 deletions.
32 changes: 9 additions & 23 deletions packages/contracts/DKIMRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,6 @@ contract DKIMRegistry is IDKIMRegistry, Ownable {
// DKIM public that are revoked (eg: in case of private key compromise)
mapping(bytes32 => bool) public revokedDKIMPublicKeyHashes;

constructor() {
// Set values for popular domains
dkimPublicKeyHashes["gmail.com"][
bytes32(uint256(21238126716164910617487233347059218993958564577330259377744533585136010170208))
] = true;

dkimPublicKeyHashes["hotmail.com"][
bytes32(uint256(2431254542644577945126644490189743659677343436440304264654087065353925216026))
] = true;

dkimPublicKeyHashes["twitter.com"][
bytes32(uint256(5857406240302475676709141738935898448223932090884766940073913110146444539372))
] = true;

dkimPublicKeyHashes["ethereum.org"][
bytes32(uint256(1064717399289379939765004128465682276424933518837235377976999291216925329691))
] = true;

dkimPublicKeyHashes["skiff.com"][
bytes32(uint256(7901875575997183258695482461141301358756276811120772965768802311294654527542))
] = true;
}

function _stringEq(
string memory a,
string memory b
Expand Down Expand Up @@ -81,6 +58,15 @@ contract DKIMRegistry is IDKIMRegistry, Ownable {
emit DKIMPublicKeyHashRegistered(domainName, publicKeyHash);
}

function setDKIMPublicKeyHashes(
string memory domainName,
bytes32[] memory publicKeyHashes
) public onlyOwner {
for (uint256 i = 0; i < publicKeyHashes.length; i++) {
setDKIMPublicKeyHash(domainName, publicKeyHashes[i]);
}
}

function revokeDKIMPublicKeyHash(bytes32 publicKeyHash) public onlyOwner {
revokedDKIMPublicKeyHashes[publicKeyHash] = true;

Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@zk-email/contracts",
"version": "4.0.2",
"version": "5.0.0",
"scripts": {
"build": "forge build",
"publish": "yarn npm publish --access=public"
},
"dependencies": {
"@openzeppelin/contracts": "^4.9.3"
"@openzeppelin/contracts": "^4.9.3",
"dotenv": "^16.3.1"
}
}
141 changes: 0 additions & 141 deletions packages/contracts/utils/MailServer.sol

This file was deleted.

70 changes: 0 additions & 70 deletions packages/helpers/src/dkim/pull-and-format-dkim-key.ts

This file was deleted.

Loading

0 comments on commit 907f950

Please sign in to comment.