You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Make backup restore work
This commit is contained in:
@@ -1013,7 +1013,7 @@ MatrixClient.prototype.restoreKeyBackupWithPassword = async function(
|
|||||||
) {
|
) {
|
||||||
const backupInfo = await this.getKeyBackupVersion();
|
const backupInfo = await this.getKeyBackupVersion();
|
||||||
|
|
||||||
const privKey = keyForExistingBackup(backupInfo, password);
|
const privKey = await keyForExistingBackup(backupInfo, password);
|
||||||
return this._restoreKeyBackup(
|
return this._restoreKeyBackup(
|
||||||
privKey, targetRoomId, targetSessionId, version,
|
privKey, targetRoomId, targetSessionId, version,
|
||||||
);
|
);
|
||||||
@@ -1041,7 +1041,7 @@ MatrixClient.prototype._restoreKeyBackup = function(
|
|||||||
|
|
||||||
const decryption = new global.Olm.PkDecryption();
|
const decryption = new global.Olm.PkDecryption();
|
||||||
try {
|
try {
|
||||||
decryption.init_with_private_key(privkey);
|
decryption.init_with_private_key(privKey);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
decryption.free();
|
decryption.free();
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ export async function keyForExistingBackup(backupData, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return await deriveKey(
|
return await deriveKey(
|
||||||
password, backupData.private_key_salt,
|
password, backupData.auth_data.private_key_salt,
|
||||||
backupData.private_key_iterations,
|
backupData.auth_data.private_key_iterations,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user