File tree Expand file tree Collapse file tree 2 files changed +21
-27
lines changed
crates/matrix-sdk-crypto/src/olm Expand file tree Collapse file tree 2 files changed +21
-27
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments