From 8ba25d511e37dab05c063ac297a4cd9b2a73a978 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 26 Mar 2024 03:21:00 +0100 Subject: [PATCH] fix: more resilient priv key selection --- src/dispatcher.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/dispatcher.rs b/src/dispatcher.rs index de957796..74b1211c 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -65,18 +65,14 @@ async fn worker(db: DatabaseConnection, domain: String, poll_interval: u64) -> R }, }; - let Some(key_pem) = model::user::Entity::find_by_id(&delivery.actor) - .select_only() - .select_column(model::user::Column::PrivateKey) - .into_tuple::() - .one(&db) - .await? + let Some(model::user::Model{ private_key: Some(key), .. }) = model::user::Entity::find_by_id(&delivery.actor) + .one(&db).await? else { tracing::error!("can not dispatch activity for user without private key: {}", delivery.actor); continue; }; - let Ok(key) = PKey::private_key_from_pem(key_pem.as_bytes()) + let Ok(key) = PKey::private_key_from_pem(key.as_bytes()) else { tracing::error!("failed parsing private key for user {}", delivery.actor); continue;