chore: add bulk set to dkim registry

This commit is contained in:
Saleel
2023-11-06 17:40:36 +03:00
parent 941ab0f828
commit 43927dfcd9
2 changed files with 12 additions and 25 deletions

View File

@@ -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
@@ -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;

View File

@@ -1,11 +1,12 @@
{
"name": "@zk-email/contracts",
"version": "4.0.2",
"version": "4.1.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"
}
}