Skip to content

Commit

Permalink
Merge pull request #122 from zkemail/dkim-interface
Browse files Browse the repository at this point in the history
Add DKIMRegistry interface
  • Loading branch information
Divide-By-0 authored Oct 21, 2023
2 parents 52ed1fb + a63e918 commit 1d65a2d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/contracts/DKIMRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IDKIMRegistry.sol";

/**
A Registry that store the hash(dkim_public_key) for each domain
The hash is calculated by taking Poseidon of DKIM key split into 9 chunks of 242 bits each
*/
contract DKIMRegistry is Ownable {
contract DKIMRegistry is IDKIMRegistry, Ownable {
// Mapping from domain name to DKIM public key hash
mapping(string => bytes32) public dkimPublicKeyHashes;

Expand All @@ -33,7 +34,7 @@ contract DKIMRegistry is Ownable {
function setDKIMPublicKeyHash(
string memory domainName,
bytes32 publicKeyHash
) public onlyOwner {
) public virtual onlyOwner {
dkimPublicKeyHashes[domainName] = publicKeyHash;
}
}
4 changes: 4 additions & 0 deletions packages/contracts/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[profile.default]
src = './'
out = 'out'
allow_paths = ['../../node_modules']
8 changes: 8 additions & 0 deletions packages/contracts/interfaces/IDKIMRegistry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IDKIMRegistry {
function getDKIMPublicKeyHash(
string memory domainName
) external view returns (bytes32);
}
3 changes: 2 additions & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@zk-email/contracts",
"version": "3.0.0",
"version": "3.1.3",
"scripts": {
"build": "forge build",
"publish": "yarn npm publish --access=public"
},
"dependencies": {
Expand Down
3 changes: 3 additions & 0 deletions packages/contracts/remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@openzeppelin=../../node_modules/@openzeppelin/contracts
@openzeppelin/contracts=../../node_modules/@openzeppelin/contracts
@openzeppelin/contracts-upgradeable=../../node_modules/@openzeppelin/contracts-upgradeable

0 comments on commit 1d65a2d

Please sign in to comment.