You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-05 17:02:07 +03:00
Restore key backup from stored key
This commit is contained in:
@@ -53,7 +53,7 @@ import { isCryptoAvailable } from './crypto';
|
|||||||
import { decodeRecoveryKey } from './crypto/recoverykey';
|
import { decodeRecoveryKey } from './crypto/recoverykey';
|
||||||
import { keyFromAuthData } from './crypto/key_passphrase';
|
import { keyFromAuthData } from './crypto/key_passphrase';
|
||||||
import { randomString } from './randomstring';
|
import { randomString } from './randomstring';
|
||||||
import { encodeBase64 } from '../lib/crypto/olmlib';
|
import { encodeBase64, decodeBase64 } from '../lib/crypto/olmlib';
|
||||||
|
|
||||||
const SCROLLBACK_DELAY_MS = 3000;
|
const SCROLLBACK_DELAY_MS = 3000;
|
||||||
const CRYPTO_ENABLED = isCryptoAvailable();
|
const CRYPTO_ENABLED = isCryptoAvailable();
|
||||||
@@ -1634,6 +1634,15 @@ MatrixClient.prototype.restoreKeyBackupWithPassword = async function(
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MatrixClient.prototype.restoreKeyBackupWithSecretStorage = async function(
|
||||||
|
backupInfo, targetRoomId, targetSessionId,
|
||||||
|
) {
|
||||||
|
const privKey = decodeBase64(await this.getSecret("m.megolm_backup.v1"));
|
||||||
|
return this._restoreKeyBackup(
|
||||||
|
privKey, targetRoomId, targetSessionId, backupInfo,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
MatrixClient.prototype.restoreKeyBackupWithRecoveryKey = function(
|
MatrixClient.prototype.restoreKeyBackupWithRecoveryKey = function(
|
||||||
recoveryKey, targetRoomId, targetSessionId, backupInfo,
|
recoveryKey, targetRoomId, targetSessionId, backupInfo,
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user