From b60c7a5bb03110777b0c6be4317027c9016139eb Mon Sep 17 00:00:00 2001 From: core Date: Thu, 3 Aug 2023 11:35:46 -0400 Subject: [PATCH] fix constant panics when keystore is weird (pt2) --- trifid-api/src/routes/v1/dnclient.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trifid-api/src/routes/v1/dnclient.rs b/trifid-api/src/routes/v1/dnclient.rs index ac573fa..8f2efaa 100644 --- a/trifid-api/src/routes/v1/dnclient.rs +++ b/trifid-api/src/routes/v1/dnclient.rs @@ -91,15 +91,18 @@ pub async fn dnclient( }; let mut valid = false; + let mut valid_key; if let Some(client_keys) = client_keys { if client_keys.ed_pub.verify(req.message.as_bytes(), &signature).is_ok() { valid = true; + valid_key = client_keys; } } if let Some(client_keys_2) = client_keys_2 { if client_keys_2.ed_pub.verify(req.message.as_bytes(), &signature).is_ok() { valid = true; + valid_key = client_keys_2; } } @@ -114,6 +117,8 @@ pub async fn dnclient( }]); } + let client_keys = valid_key; + // Sig OK // Decode the message from base64