Skip to content

Commit

Permalink
Inherit IVerifier
Browse files Browse the repository at this point in the history
  • Loading branch information
wshino committed Oct 11, 2024
1 parent dcceed2 commit a8ff317
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
31 changes: 31 additions & 0 deletions packages/contracts/src/interfaces/IVerifier.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

struct EmailProof {
string domainName; // Domain name of the sender's email
bytes32 publicKeyHash; // Hash of the DKIM public key used in email/proof
uint timestamp; // Timestamp of the email
string maskedCommand; // Masked command of the email
bytes32 emailNullifier; // Nullifier of the email to prevent its reuse.
bytes32 accountSalt; // Create2 salt of the account
bool isCodeExist; // Check if the account code is exist
bytes proof; // ZK Proof of Email
}

interface IVerifier {

/**
* @notice Verifies the provided email proof.
* @param proof The email proof to be verified.
* @return bool indicating whether the proof is valid.
*/
function verifyEmailProof(
EmailProof memory proof
) external view returns (bool);

/**
* @notice Returns a constant value representing command bytes.
* @return uint256 The constant value of command bytes.
*/
function getCommandBytes() external pure returns (uint256);
}
14 changes: 2 additions & 12 deletions packages/contracts/src/utils/JwtVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@ import "../interfaces/IJwtGroth16Verifier.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { strings } from "solidity-stringutils/src/strings.sol";
import {IVerifier, EmailProof} from "../interfaces/IVerifier.sol";

struct EmailProof {
string domainName; // Domain name of the sender's email
bytes32 publicKeyHash; // Hash of the DKIM public key used in email/proof
uint timestamp; // Timestamp of the email
string maskedCommand; // Masked command of the email
bytes32 emailNullifier; // Nullifier of the email to prevent its reuse.
bytes32 accountSalt; // Create2 salt of the account
bool isCodeExist; // Check if the account code is exist
bytes proof; // ZK Proof of Email
}

contract JwtVerifier is OwnableUpgradeable, UUPSUpgradeable {
contract JwtVerifier is IVerifier, OwnableUpgradeable, UUPSUpgradeable {
using strings for *;

IJwtGroth16Verifier groth16Verifier;
Expand Down

0 comments on commit a8ff317

Please sign in to comment.