fix: more resilient priv key selection
This commit is contained in:
parent
e6b30975cc
commit
8ba25d511e
1 changed files with 3 additions and 7 deletions
|
@ -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)
|
let Some(model::user::Model{ private_key: Some(key), .. }) = model::user::Entity::find_by_id(&delivery.actor)
|
||||||
.select_only()
|
.one(&db).await?
|
||||||
.select_column(model::user::Column::PrivateKey)
|
|
||||||
.into_tuple::<String>()
|
|
||||||
.one(&db)
|
|
||||||
.await?
|
|
||||||
else {
|
else {
|
||||||
tracing::error!("can not dispatch activity for user without private key: {}", delivery.actor);
|
tracing::error!("can not dispatch activity for user without private key: {}", delivery.actor);
|
||||||
continue;
|
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 {
|
else {
|
||||||
tracing::error!("failed parsing private key for user {}", delivery.actor);
|
tracing::error!("failed parsing private key for user {}", delivery.actor);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue