@@ -783,9 +783,13 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
783
783
await this . addSecretStorageKeyToSecretStorage ( recoveryKey ) ;
784
784
}
785
785
786
- const crossSigningStatus : RustSdkCryptoJs . CrossSigningStatus = await this . olmMachine . crossSigningStatus ( ) ;
786
+ const crossSigningPrivateKeys : RustSdkCryptoJs . CrossSigningKeyExport | undefined =
787
+ await this . olmMachine . exportCrossSigningKeys ( ) ;
787
788
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 ;
789
793
790
794
// If we have cross-signing private keys cached, store them in secret
791
795
// storage if they are not there already.
@@ -795,21 +799,6 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
795
799
) {
796
800
this . logger . info ( "bootstrapSecretStorage: cross-signing keys not yet exported; doing so now." ) ;
797
801
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
-
813
802
await this . secretStorage . store ( "m.cross_signing.master" , crossSigningPrivateKeys . masterKey ) ;
814
803
await this . secretStorage . store ( "m.cross_signing.user_signing" , crossSigningPrivateKeys . userSigningKey ) ;
815
804
await this . secretStorage . store ( "m.cross_signing.self_signing" , crossSigningPrivateKeys . self_signing_key ) ;
@@ -1819,7 +1808,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
1819
1808
* @param name - The name of the secret received.
1820
1809
*/
1821
1810
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 ) ;
1823
1812
for ( const value of pendingValues ) {
1824
1813
if ( await this . handleSecretReceived ( name , value ) ) {
1825
1814
// If we have a valid secret for that name there is no point of processing the other secrets values.
0 commit comments