@@ -3863,12 +3863,13 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
38633863 if ( ! backupInfo . version ) {
38643864 throw new Error ( "Backup version must be defined" ) ;
38653865 }
3866+ const backupVersion = backupInfo . version ! ;
38663867
38673868 let totalKeyCount = 0 ;
38683869 let totalFailures = 0 ;
38693870 let totalImported = 0 ;
38703871
3871- const path = this . makeKeyBackupPath ( targetRoomId , targetSessionId , backupInfo . version ) ;
3872+ const path = this . makeKeyBackupPath ( targetRoomId , targetSessionId , backupVersion ) ;
38723873
38733874 const backupDecryptor = await this . cryptoBackend . getBackupDecryptor ( backupInfo , privKey ) ;
38743875
@@ -3882,7 +3883,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
38823883 // Cache the key, if possible.
38833884 // This is async.
38843885 this . cryptoBackend
3885- . storeSessionBackupPrivateKey ( privKey , backupInfo . version )
3886+ . storeSessionBackupPrivateKey ( privKey , backupVersion )
38863887 . catch ( ( e ) => {
38873888 this . logger . warn ( "Error caching session backup key:" , e ) ;
38883889 } )
@@ -3922,7 +3923,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
39223923 async ( chunk ) => {
39233924 // We have a chunk of decrypted keys: import them
39243925 try {
3925- await this . cryptoBackend ! . importBackedUpRoomKeys ( chunk , {
3926+ const backupVersion = backupInfo . version ! ;
3927+ await this . cryptoBackend ! . importBackedUpRoomKeys ( chunk , backupVersion , {
39263928 untrusted,
39273929 } ) ;
39283930 totalImported += chunk . length ;
@@ -3952,7 +3954,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
39523954 for ( const k of keys ) {
39533955 k . room_id = targetRoomId ! ;
39543956 }
3955- await this . cryptoBackend . importBackedUpRoomKeys ( keys , {
3957+ await this . cryptoBackend . importBackedUpRoomKeys ( keys , backupVersion , {
39563958 progressCallback,
39573959 untrusted,
39583960 } ) ;
@@ -3966,7 +3968,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
39663968 key . room_id = targetRoomId ! ;
39673969 key . session_id = targetSessionId ! ;
39683970
3969- await this . cryptoBackend . importBackedUpRoomKeys ( [ key ] , {
3971+ await this . cryptoBackend . importBackedUpRoomKeys ( [ key ] , backupVersion , {
39703972 progressCallback,
39713973 untrusted,
39723974 } ) ;
0 commit comments