Have Troll Patrol generate new negative report key if necessary
This commit is contained in:
parent
c3b1908120
commit
d32c352ccc
|
@ -199,10 +199,6 @@ pub async fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
// Have Troll Patrol run its update process so we have a negative
|
||||
// report key for tomorrow
|
||||
tp_net_test.request("/update".to_string(), vec![]).await;
|
||||
|
||||
// Advance LA's time to tomorrow
|
||||
la_net_test
|
||||
.request(
|
||||
|
|
|
@ -33,7 +33,14 @@ pub async fn handle(db: &Db, req: Request<Body>) -> Result<Response<Body>, Infal
|
|||
return Ok(prepare_header(val));
|
||||
}
|
||||
};
|
||||
let pubkey = get_negative_report_public_key(&db, date);
|
||||
// Get the current key or generate a new one. Note that
|
||||
// this code is only called in simulation. In
|
||||
// production, users should not be able to induce Troll
|
||||
// Patrol to generate new keys.
|
||||
let pubkey = match get_negative_report_public_key(&db, date) {
|
||||
Some(k) => Some(k),
|
||||
None => new_negative_report_key(&db, date),
|
||||
};
|
||||
prepare_header(serde_json::to_string(&pubkey).unwrap())
|
||||
}),
|
||||
(&Method::POST, "/negativereport") => Ok::<_, Infallible>({
|
||||
|
|
Loading…
Reference in New Issue