Skip to content

Commit fa8b58b

Browse files
committed
Remove _commandMatch
1 parent 34aa505 commit fa8b58b

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

contracts/utils/cryptography/ZKEmailUtils.sol

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,18 @@ library ZKEmailUtils {
9393
return EmailProofError.MaskedCommandLength;
9494
} else if (emailAuthMsg.skippedCommandPrefix >= verifier.commandBytes()) {
9595
return EmailProofError.SkippedCommandPrefixSize;
96-
} else if (!_commandMatch(emailAuthMsg, template, stringCase)) {
97-
return EmailProofError.MismatchedCommand;
98-
} else {
99-
return verifier.verifyEmailProof(emailAuthMsg.proof) ? EmailProofError.NoError : EmailProofError.EmailProof;
100-
}
101-
}
102-
103-
function _commandMatch(
104-
EmailAuthMsg memory emailAuthMsg,
105-
string[] memory template,
106-
Case stringCase
107-
) private pure returns (bool) {
108-
return
96+
} else if (
10997
stringCase == Case.ANY
11098
? _matchAnyCase(emailAuthMsg, template)
111-
: _matchCase(emailAuthMsg, template, stringCase);
99+
: _matchCase(emailAuthMsg, template, stringCase)
100+
) {
101+
return verifier.verifyEmailProof(emailAuthMsg.proof) ? EmailProofError.NoError : EmailProofError.EmailProof;
102+
} else {
103+
return EmailProofError.MismatchedCommand;
104+
}
112105
}
113106

107+
/// @dev Checks if the command matches the expected command for any string case.
114108
function _matchAnyCase(EmailAuthMsg memory emailAuthMsg, string[] memory template) private pure returns (bool) {
115109
return
116110
_matchCase(emailAuthMsg, template, Case.LOWERCASE) ||

0 commit comments

Comments
 (0)