Skip to content

Commit

Permalink
Merge branch 'feat/body-parsing-with-audit-fix' of https://github.com…
Browse files Browse the repository at this point in the history
…/zkemail/ether-email-auth into feat/body-parsing-with-audit-fix
  • Loading branch information
SoraSuegami committed Sep 13, 2024
2 parents 581a845 + 5c21f4b commit 6ed6e87
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/relayer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CHAIN_ID=11155111 # Chain ID of the testnet.

SMTP_SERVER=

PROVER_ADDRESS="https://zkemail--email-auth-prover-body-parsing-v1-0-0-flask-app.modal.run"
PROVER_ADDRESS="https://zkemail--email-auth-prover-v1-3-0-flask-app.modal.run"

DATABASE_URL= "postgres://test@localhost/emailauth_test"
RELAYER_EMAIL_ADDR=
Expand Down
2 changes: 2 additions & 0 deletions packages/relayer/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ pub async fn handle_email(email: String) -> Result<EmailAuthEvent> {
proof: email_proof.clone(),
};

println!("Email Auth Msg: {:?}", email_auth_msg);

match CLIENT
.handle_recovery(
&request.controller_eth_addr,
Expand Down
26 changes: 19 additions & 7 deletions packages/relayer/src/utils/subject_templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ pub fn extract_template_vals(input: &str, templates: Vec<String>) -> Result<Vec<
.unwrap()
.find(input_decomposed[input_idx])
.ok_or(anyhow!("No string found"))?;
if string_match.start() != 0
|| string_match.end() != input_decomposed[input_idx].len()
{
if string_match.start() != 0 {
return Err(anyhow!("String must be the whole word"));
}
let string = string_match.as_str().to_string();
let mut string = string_match.as_str().to_string();
if string.contains("</div>") {
string = string.split("</div>").collect::<Vec<&str>>()[0].to_string();
}
template_vals.push(TemplateValue::String(string));
}
"{uint}" => {
Expand All @@ -119,7 +120,11 @@ pub fn extract_template_vals(input: &str, templates: Vec<String>) -> Result<Vec<
{
return Err(anyhow!("Uint must be the whole word"));
}
let uint = U256::from_dec_str(uint_match.as_str()).unwrap();
let mut uint_match = uint_match.as_str();
if uint_match.contains("</div>") {
uint_match = uint_match.split("</div>").collect::<Vec<&str>>()[0];
}
let uint = U256::from_dec_str(uint_match).unwrap();
template_vals.push(TemplateValue::Uint(uint));
}
"{int}" => {
Expand All @@ -130,7 +135,11 @@ pub fn extract_template_vals(input: &str, templates: Vec<String>) -> Result<Vec<
if int_match.start() != 0 || int_match.end() != input_decomposed[input_idx].len() {
return Err(anyhow!("Int must be the whole word"));
}
let int = I256::from_dec_str(int_match.as_str()).unwrap();
let mut int_match = int_match.as_str();
if int_match.contains("</div>") {
int_match = int_match.split("</div>").collect::<Vec<&str>>()[0];
}
let int = I256::from_dec_str(int_match).unwrap();
template_vals.push(TemplateValue::Int(int));
}
"{decimals}" => {
Expand All @@ -143,7 +152,10 @@ pub fn extract_template_vals(input: &str, templates: Vec<String>) -> Result<Vec<
{
return Err(anyhow!("Decimals must be the whole word"));
}
let decimals = decimals_match.as_str().to_string();
let mut decimals = decimals_match.as_str().to_string();
if decimals.contains("</div>") {
decimals = decimals.split("</div>").collect::<Vec<&str>>()[0].to_string();
}
template_vals.push(TemplateValue::Decimals(decimals));
}
"{ethAddr}" => {
Expand Down

0 comments on commit 6ed6e87

Please sign in to comment.