@@ -783,9 +783,13 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
783783 await this . addSecretStorageKeyToSecretStorage ( recoveryKey ) ;
784784 }
785785
786- const crossSigningStatus : RustSdkCryptoJs . CrossSigningStatus = await this . olmMachine . crossSigningStatus ( ) ;
786+ const crossSigningPrivateKeys : RustSdkCryptoJs . CrossSigningKeyExport | undefined =
787+ await this . olmMachine . exportCrossSigningKeys ( ) ;
787788 const hasPrivateKeys =
788- crossSigningStatus . hasMaster && crossSigningStatus . hasSelfSigning && crossSigningStatus . hasUserSigning ;
789+ crossSigningPrivateKeys &&
790+ crossSigningPrivateKeys . masterKey !== undefined &&
791+ crossSigningPrivateKeys . self_signing_key !== undefined &&
792+ crossSigningPrivateKeys . userSigningKey !== undefined ;
789793
790794 // If we have cross-signing private keys cached, store them in secret
791795 // storage if they are not there already.
@@ -795,21 +799,6 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
795799 ) {
796800 this . logger . info ( "bootstrapSecretStorage: cross-signing keys not yet exported; doing so now." ) ;
797801
798- const crossSigningPrivateKeys : RustSdkCryptoJs . CrossSigningKeyExport =
799- await this . olmMachine . exportCrossSigningKeys ( ) ;
800-
801- if ( ! crossSigningPrivateKeys . masterKey ) {
802- throw new Error ( "missing master key in cross signing private keys" ) ;
803- }
804-
805- if ( ! crossSigningPrivateKeys . userSigningKey ) {
806- throw new Error ( "missing user signing key in cross signing private keys" ) ;
807- }
808-
809- if ( ! crossSigningPrivateKeys . self_signing_key ) {
810- throw new Error ( "missing self signing key in cross signing private keys" ) ;
811- }
812-
813802 await this . secretStorage . store ( "m.cross_signing.master" , crossSigningPrivateKeys . masterKey ) ;
814803 await this . secretStorage . store ( "m.cross_signing.user_signing" , crossSigningPrivateKeys . userSigningKey ) ;
815804 await this . secretStorage . store ( "m.cross_signing.self_signing" , crossSigningPrivateKeys . self_signing_key ) ;
@@ -1819,7 +1808,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
18191808 * @param name - The name of the secret received.
18201809 */
18211810 public async checkSecrets ( name : string ) : Promise < void > {
1822- const pendingValues : string [ ] = await this . olmMachine . getSecretsFromInbox ( name ) ;
1811+ const pendingValues : Set < string > = await this . olmMachine . getSecretsFromInbox ( name ) ;
18231812 for ( const value of pendingValues ) {
18241813 if ( await this . handleSecretReceived ( name , value ) ) {
18251814 // If we have a valid secret for that name there is no point of processing the other secrets values.
0 commit comments