mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-02-16 02:22:31 -05:00
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:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user