diff --git a/services/commtest/src/identity/olm_account_infos.rs b/services/commtest/src/identity/olm_account_infos.rs --- a/services/commtest/src/identity/olm_account_infos.rs +++ b/services/commtest/src/identity/olm_account_infos.rs @@ -16,11 +16,32 @@ } impl ClientPublicKeys { + /// Generates random keys with given `ed25519` primary account + /// signing public key. Use [`ClientPublicKeys::default`] for random key. + pub fn new(primary_signing_public_key: impl Into) -> Self { + Self { + primary_identity_public_keys: IdentityPublicKeys { + ed25519: primary_signing_public_key.into(), + curve25519: generate_random_olm_key(), + }, + notification_identity_public_keys: IdentityPublicKeys { + ed25519: generate_random_olm_key(), + curve25519: generate_random_olm_key(), + }, + } + } + pub fn device_id(&self) -> String { self.primary_identity_public_keys.ed25519.clone() } } +impl Default for ClientPublicKeys { + fn default() -> Self { + Self::new(generate_random_olm_key()) + } +} + lazy_static! { pub static ref DEFAULT_CLIENT_KEYS: ClientPublicKeys = ClientPublicKeys { primary_identity_public_keys: IdentityPublicKeys {