diff --git a/src/client.js b/src/client.js index da7d5218a..cd236aedb 100644 --- a/src/client.js +++ b/src/client.js @@ -1013,7 +1013,7 @@ MatrixClient.prototype.restoreKeyBackupWithPassword = async function( ) { const backupInfo = await this.getKeyBackupVersion(); - const privKey = keyForExistingBackup(backupInfo, password); + const privKey = await keyForExistingBackup(backupInfo, password); return this._restoreKeyBackup( privKey, targetRoomId, targetSessionId, version, ); @@ -1041,7 +1041,7 @@ MatrixClient.prototype._restoreKeyBackup = function( const decryption = new global.Olm.PkDecryption(); try { - decryption.init_with_private_key(privkey); + decryption.init_with_private_key(privKey); } catch(e) { decryption.free(); throw e; diff --git a/src/crypto/backup_password.js b/src/crypto/backup_password.js index 946b99681..1a6d1f284 100644 --- a/src/crypto/backup_password.js +++ b/src/crypto/backup_password.js @@ -33,8 +33,8 @@ export async function keyForExistingBackup(backupData, password) { } return await deriveKey( - password, backupData.private_key_salt, - backupData.private_key_iterations, + password, backupData.auth_data.private_key_salt, + backupData.auth_data.private_key_iterations, ); }