diff --git a/src/olm/account/mod.rs b/src/olm/account/mod.rs index 0360eb6e..e73477a1 100644 --- a/src/olm/account/mod.rs +++ b/src/olm/account/mod.rs @@ -801,6 +801,7 @@ mod dehydrated_device { pub(super) struct Pickle { version: u32, private_curve25519_key: Box<[u8; 32]>, + private_ed25519_key: Box<[u8; 64]>, one_time_keys: Vec, opt_fallback_key: OptFallbackKey, } @@ -822,6 +823,7 @@ mod dehydrated_device { Self { version: PICKLE_VERSION, private_curve25519_key: account.diffie_hellman_key.secret_key().to_bytes(), + private_ed25519_key: account.signing_key.expanded_secret_key(), one_time_keys, opt_fallback_key: OptFallbackKey { fallback_key }, } @@ -848,7 +850,7 @@ mod dehydrated_device { }; Ok(Self { - signing_key: Ed25519Keypair::new(), // random key, just to satisfy the contract + signing_key: Ed25519Keypair::from_expanded_key(&pickle.private_ed25519_key)?, diffie_hellman_key: Curve25519Keypair::from_secret_key( &pickle.private_curve25519_key, ), diff --git a/src/types/ed25519.rs b/src/types/ed25519.rs index 2cb4ad78..08d0d539 100644 --- a/src/types/ed25519.rs +++ b/src/types/ed25519.rs @@ -138,7 +138,6 @@ impl Ed25519Keypair { } } - #[cfg(feature = "libolm-compat")] pub(crate) fn from_expanded_key(secret_key: &[u8; 64]) -> Result { let secret_key = ExpandedSecretKey::from_bytes(secret_key); let public_key = secret_key.public_key(); @@ -146,7 +145,6 @@ impl Ed25519Keypair { Ok(Self { secret_key: secret_key.into(), public_key }) } - #[cfg(feature = "libolm-compat")] pub(crate) fn expanded_secret_key(&self) -> Box<[u8; 64]> { use sha2::Digest;