Skip to content

Commit f38695e

Browse files
committed
crypto: inline PrivateCrossSigningIdentity::with_account
This was now only used in one place, and I think it makes more sense to inline it into olm::Account than leave it in `PrivateCrossSigningIdentity`.
1 parent cf202bb commit f38695e

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

crates/matrix-sdk-crypto/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
66

77
## [Unreleased] - ReleaseDate
88

9+
### Refactor
10+
11+
- [**breaking**] Remove `matrix_sdk_crypto::olm::PrivateCrossSigningIdentity::with_account`. Applications should instead use `matrix_sdk_crypto::olm::Account::bootstrap_cross_signing` which has identical behaviour.
12+
`PrivateCrossSigningIdentity::for_account` is added for test situations where the upload requests are not required.
13+
([#5654](https://github.com/matrix-org/matrix-rust-sdk/pull/5654))
14+
915
## [0.14.0] - 2025-09-04
1016

1117
### Features

crates/matrix-sdk-crypto/src/olm/account.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,11 +806,30 @@ impl Account {
806806
device_keys
807807
}
808808

809-
/// Bootstrap Cross-Signing
809+
/// Bootstraps cross-signing, generating new cross-signing keys and creating
810+
/// the necessary upload and signature requests.
811+
///
812+
/// # Returns
813+
/// A tuple containing:
814+
/// - [`PrivateCrossSigningIdentity`]: The newly-generated cross-signing
815+
/// identity (including a signature from this device).
816+
/// - [`UploadSigningKeysRequest`]: The request to upload the
817+
/// newly-generated cross-signing keys to the server.
818+
/// - [`SignatureUploadRequest`]: The request to upload the signature of
819+
/// this device to the server.
810820
pub async fn bootstrap_cross_signing(
811821
&self,
812822
) -> (PrivateCrossSigningIdentity, UploadSigningKeysRequest, SignatureUploadRequest) {
813-
PrivateCrossSigningIdentity::with_account(self).await
823+
let identity = PrivateCrossSigningIdentity::for_account(self);
824+
825+
let signature_request = identity
826+
.sign_account(self.static_data())
827+
.await
828+
.expect("Can't sign own device with new cross signing keys");
829+
830+
let upload_request = identity.as_upload_request().await;
831+
832+
(identity, upload_request, signature_request)
814833
}
815834

816835
/// Sign the given CrossSigning Key in place

crates/matrix-sdk-crypto/src/olm/signing/mod.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -499,31 +499,6 @@ impl PrivateCrossSigningIdentity {
499499
.sign(message))
500500
}
501501

502-
/// Create a new identity for the given Olm Account.
503-
///
504-
/// Returns the new identity, the upload signing keys request and a
505-
/// signature upload request that contains the signature of the account
506-
/// signed by the self signing key.
507-
///
508-
/// # Arguments
509-
///
510-
/// * `account` - The Olm account that is creating the new identity. The
511-
/// account will sign the master key and the self signing key will sign
512-
/// the account.
513-
pub(crate) async fn with_account(
514-
account: &Account,
515-
) -> (Self, UploadSigningKeysRequest, SignatureUploadRequest) {
516-
let identity = Self::for_account(account);
517-
let signature_request = identity
518-
.sign_account(account.static_data())
519-
.await
520-
.expect("Can't sign own device with new cross signing keys");
521-
522-
let request = identity.as_upload_request().await;
523-
524-
(identity, request, signature_request)
525-
}
526-
527502
fn new_helper(user_id: &UserId, master: MasterSigning) -> Self {
528503
let (user, self_signing) = master.new_subkeys();
529504

0 commit comments

Comments
 (0)