mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 05:46:29 +03:00
Let save_self_keypair() also remove a previously used key
The imex code was deleting the key if it was already used. Turns out none of the callers would not want this behaviour, so let's just handle this case generally.
This commit is contained in:
committed by
Floris Bruynooghe
parent
5c3a8819a4
commit
81ff5d1224
@@ -315,13 +315,6 @@ fn set_self_key(
|
||||
ensure!(self_addr.is_some(), "Missing self addr");
|
||||
let addr = EmailAddress::new(&self_addr.unwrap_or_default())?;
|
||||
|
||||
// XXX maybe better make dc_key_save_self_keypair delete things
|
||||
sql::execute(
|
||||
context,
|
||||
&context.sql,
|
||||
"DELETE FROM keypairs WHERE public_key=? OR private_key=?;",
|
||||
params![public_key.to_bytes(), private_key.to_bytes()],
|
||||
)?;
|
||||
let (public, secret) = match (public_key, private_key) {
|
||||
(Key::Public(p), Key::Secret(s)) => (p, s),
|
||||
_ => bail!("wrong keys unpacked"),
|
||||
|
||||
Reference in New Issue
Block a user