@@ -60,13 +60,13 @@ library ZKEmailUtils {
60
60
EmailAuthMsg memory emailAuthMsg ,
61
61
IDKIMRegistry dkimregistry ,
62
62
IVerifier verifier
63
- ) internal view returns (bool , EmailProofError) {
63
+ ) internal view returns (EmailProofError) {
64
64
if (! dkimregistry.isDKIMPublicKeyHashValid (emailAuthMsg.proof.domainName, emailAuthMsg.proof.publicKeyHash)) {
65
- return ( false , EmailProofError.DKIMPublicKeyHash) ;
65
+ return EmailProofError.DKIMPublicKeyHash;
66
66
} else if (bytes (emailAuthMsg.proof.maskedCommand).length > verifier.commandBytes ()) {
67
- return ( false , EmailProofError.MaskedCommandLength) ;
67
+ return EmailProofError.MaskedCommandLength;
68
68
} else if (emailAuthMsg.skippedCommandPrefix >= verifier.commandBytes ()) {
69
- return ( false , EmailProofError.SkippedCommandPrefixSize) ;
69
+ return EmailProofError.SkippedCommandPrefixSize;
70
70
} else {
71
71
string [] memory signHashTemplate = new string [](2 );
72
72
signHashTemplate[0 ] = "signHash " ;
@@ -77,17 +77,19 @@ library ZKEmailUtils {
77
77
emailAuthMsg.proof.maskedCommand,
78
78
emailAuthMsg.skippedCommandPrefix
79
79
);
80
- for (uint256 stringCase = 0 ; stringCase < 2 ; stringCase++ ) {
80
+ for (uint256 stringCase = 0 ; stringCase < 3 ; stringCase++ ) {
81
81
if (
82
82
CommandUtils.computeExpectedCommand (emailAuthMsg.commandParams, signHashTemplate, stringCase).equal (
83
83
trimmedMaskedCommand
84
84
)
85
85
) {
86
- if (verifier.verifyEmailProof (emailAuthMsg.proof)) return (true , EmailProofError.NoError);
87
- else return (false , EmailProofError.EmailProof);
86
+ return
87
+ verifier.verifyEmailProof (emailAuthMsg.proof)
88
+ ? EmailProofError.NoError
89
+ : EmailProofError.EmailProof;
88
90
}
89
91
}
90
- return ( false , EmailProofError.Command) ;
92
+ return EmailProofError.Command;
91
93
}
92
94
}
93
95
}
0 commit comments