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`.
This commit is contained in:
Richard van der Hoff
2025-09-10 17:25:28 +01:00
parent bb46dc74d0
commit 0002ea46ab
2 changed files with 21 additions and 27 deletions

View File

@@ -806,11 +806,30 @@ impl Account {
device_keys
}
/// Bootstrap Cross-Signing
/// Bootstraps cross-signing, generating new cross-signing keys and creating
/// the necessary upload and signature requests.
///
/// # Returns
/// A tuple containing:
/// - [`PrivateCrossSigningIdentity`]: The newly-generated cross-signing
/// identity (including a signature from this device).
/// - [`UploadSigningKeysRequest`]: The request to upload the
/// newly-generated cross-signing keys to the server.
/// - [`SignatureUploadRequest`]: The request to upload the signature of
/// this device to the server.
pub async fn bootstrap_cross_signing(
&self,
) -> (PrivateCrossSigningIdentity, UploadSigningKeysRequest, SignatureUploadRequest) {
PrivateCrossSigningIdentity::with_account(self).await
let identity = PrivateCrossSigningIdentity::for_account(self);
let signature_request = identity
.sign_account(self.static_data())
.await
.expect("Can't sign own device with new cross signing keys");
let upload_request = identity.as_upload_request().await;
(identity, upload_request, signature_request)
}
/// Sign the given CrossSigning Key in place

View File

@@ -499,31 +499,6 @@ impl PrivateCrossSigningIdentity {
.sign(message))
}
/// Create a new identity for the given Olm Account.
///
/// Returns the new identity, the upload signing keys request and a
/// signature upload request that contains the signature of the account
/// signed by the self signing key.
///
/// # Arguments
///
/// * `account` - The Olm account that is creating the new identity. The
/// account will sign the master key and the self signing key will sign
/// the account.
pub(crate) async fn with_account(
account: &Account,
) -> (Self, UploadSigningKeysRequest, SignatureUploadRequest) {
let identity = Self::for_account(account);
let signature_request = identity
.sign_account(account.static_data())
.await
.expect("Can't sign own device with new cross signing keys");
let request = identity.as_upload_request().await;
(identity, request, signature_request)
}
fn new_helper(user_id: &UserId, master: MasterSigning) -> Self {
let (user, self_signing) = master.new_subkeys();