1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Clarify cross-signing reset variable

This commit is contained in:
J. Ryan Stinnett
2019-11-29 15:15:18 +00:00
parent fda7a2cf13
commit 2bfc157e64

View File

@@ -338,7 +338,7 @@ Crypto.prototype.bootstrapSecretStorage = async function({
// key with the cross-signing master key. The cross-signing master key is also used // key with the cross-signing master key. The cross-signing master key is also used
// to verify the signature on the SSSS default key when adding secrets, so we // to verify the signature on the SSSS default key when adding secrets, so we
// effectively need it for both reading and writing secrets. // effectively need it for both reading and writing secrets.
let crossSigningKeysChanged = false; let crossSigningKeysReset = false;
if (!this._crossSigningInfo.getId()) { if (!this._crossSigningInfo.getId()) {
logger.log( logger.log(
"Cross-signing public keys not found on device, " + "Cross-signing public keys not found on device, " +
@@ -356,7 +356,7 @@ Crypto.prototype.bootstrapSecretStorage = async function({
CrossSigningLevel.MASTER, CrossSigningLevel.MASTER,
{ doInteractiveAuthFlow }, { doInteractiveAuthFlow },
); );
crossSigningKeysChanged = true; crossSigningKeysReset = true;
} }
} }
@@ -370,8 +370,10 @@ Crypto.prototype.bootstrapSecretStorage = async function({
await this.setDefaultSecretStorageKeyId(newKeyId); await this.setDefaultSecretStorageKeyId(newKeyId);
} }
// If cross-signing keys changed, store them in Secure Secret Storage. // If cross-signing keys were reset, store them in Secure Secret Storage.
if (crossSigningKeysChanged) { // This is done in a separate step so we can ensure secret storage has its
// own key first.
if (crossSigningKeysReset) {
logger.log("Storing cross-signing private keys in secret storage"); logger.log("Storing cross-signing private keys in secret storage");
// XXX: We need to think about how to re-do this step if it fails. // XXX: We need to think about how to re-do this step if it fails.
await this._crossSigningInfo.storeInSecretStorage(this._secretStorage); await this._crossSigningInfo.storeInSecretStorage(this._secretStorage);