1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Merge branch 'develop' into travis/update-qr-code

This commit is contained in:
Travis Ralston
2020-01-29 00:18:15 +00:00

View File

@@ -338,6 +338,9 @@ Crypto.prototype.createRecoveryKeyFromPassphrase = async function(password) {
* called to await a secret storage key creation flow. * called to await a secret storage key creation flow.
* @param {object} [opts.keyBackupInfo] The current key backup object. If passed, * @param {object} [opts.keyBackupInfo] The current key backup object. If passed,
* the passphrase and recovery key from this backup will be used. * the passphrase and recovery key from this backup will be used.
* @param {bool} [opts.setupNewKeyBackup] If true, a new key backup version will be
* created and the private key stored in the new SSSS store. Ignored if keyBackupInfo
* is supplied.
* Returns: * Returns:
* {Promise} A promise which resolves to key creation data for * {Promise} A promise which resolves to key creation data for
* SecretStorage#addKey: an object with `passphrase` and/or `pubkey` fields. * SecretStorage#addKey: an object with `passphrase` and/or `pubkey` fields.
@@ -346,6 +349,7 @@ Crypto.prototype.bootstrapSecretStorage = async function({
authUploadDeviceSigningKeys, authUploadDeviceSigningKeys,
createSecretStorageKey = async () => { }, createSecretStorageKey = async () => { },
keyBackupInfo, keyBackupInfo,
setupNewKeyBackup,
} = {}) { } = {}) {
logger.log("Bootstrapping Secure Secret Storage"); logger.log("Bootstrapping Secure Secret Storage");
@@ -469,6 +473,14 @@ Crypto.prototype.bootstrapSecretStorage = async function({
); );
} }
} }
if (setupNewKeyBackup && !keyBackupInfo) {
const info = await this._baseApis.prepareKeyBackupVersion(
null /* random key */,
{ secureSecretStorage: true },
);
await this._baseApis.createKeyBackupVersion(info);
}
} finally { } finally {
// Restore the original callbacks. NB. we must do this by manipulating // Restore the original callbacks. NB. we must do this by manipulating
// the same object since the CrossSigning class has a reference to the // the same object since the CrossSigning class has a reference to the