Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3449692
D12340.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12340.diff
View Options
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<String>) -> 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 {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 13, 1:27 PM (20 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2650857
Default Alt Text
D12340.diff (1 KB)
Attached To
Mode
D12340: [commtest] Add default impl for ClientPublicKeys
Attached
Detach File
Event Timeline
Log In to Comment