1 parent
0421994fe6
commit
425ea7449b
138 files changed
+5705
-1012
No files matched your search
+18
-13
@@ -205,10 +205,10 @@ pub async fn process_message(
|
||||
let mut result = tokio::task::spawn_blocking(move || {
|
||||
let mut secrets = Vec::new();
|
||||
for key in secret_rows {
|
||||
if let Some(path) = key.secret_key_path {
|
||||
if let Ok(armor) = crate::pgp::read_secret_key(&path) {
|
||||
secrets.push(armor);
|
||||
}
|
||||
if let Some(path) = key.secret_key_path
|
||||
&& let Ok(armor) = crate::pgp::read_secret_key(&path)
|
||||
{
|
||||
secrets.push(armor);
|
||||
}
|
||||
}
|
||||
crate::pgp::process_message(&raw, &secrets, &passphrase, &public_keys)
|
||||
@@ -478,11 +478,17 @@ pub async fn delete_key(
|
||||
};
|
||||
|
||||
let delete_fp = normalized.clone();
|
||||
database.run(move |conn| {
|
||||
conn.execute("UPDATE identities SET pgp_fingerprint=NULL,pgp_sign_default=0,pgp_encrypt_default=0,pgp_inline_default=0 WHERE replace(upper(COALESCE(pgp_fingerprint,'')),' ','')=?1", rusqlite::params![delete_fp])
|
||||
database
|
||||
.run(move |conn| {
|
||||
conn.execute(
|
||||
crate::queries::sqlite::queries::routes_pgp::Q_001,
|
||||
rusqlite::params![delete_fp],
|
||||
)
|
||||
.map_err(|e| format!("Failed to detach OpenPGP key from identities: {e}"))?;
|
||||
db::pgp::delete_key(conn, &normalized)
|
||||
}).await.map_err(AppError::InternalError)?;
|
||||
db::pgp::delete_key(conn, &normalized)
|
||||
})
|
||||
.await
|
||||
.map_err(AppError::InternalError)?;
|
||||
|
||||
if let Some(path) = key.secret_key_path {
|
||||
tokio::task::spawn_blocking(move || crate::pgp::delete_secret_key(&path))
|
||||
@@ -837,11 +843,10 @@ async fn store_material_raw(
|
||||
.run(move |conn| db::pgp::upsert_key(conn, &stored, path.as_deref()))
|
||||
.await
|
||||
{
|
||||
if let Some((path, existed)) = secret_store {
|
||||
if !existed {
|
||||
let _ =
|
||||
tokio::task::spawn_blocking(move || crate::pgp::delete_secret_key(&path)).await;
|
||||
}
|
||||
if let Some((path, existed)) = secret_store
|
||||
&& !existed
|
||||
{
|
||||
let _ = tokio::task::spawn_blocking(move || crate::pgp::delete_secret_key(&path)).await;
|
||||
}
|
||||
return Err(AppError::InternalError(error));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user