Skip to content

Commit

Permalink
Merge pull request #1323 from matrix-org/dbkr/fix_ssss_reset_rel
Browse files Browse the repository at this point in the history
Fix cross-signing/SSSS reset
  • Loading branch information
jryans authored Apr 17, 2020
2 parents 78c734d + 149f59e commit fe3e87a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/crypto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,16 @@ Crypto.prototype.bootstrapSecretStorage = async function({

await resetCrossSigning();

if (!oldKeyInfo || oldKeyInfo.algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES) {
// if we already have a usable default SSSS key, just use it.
if (
setupNewSecretStorage ||
!oldKeyInfo ||
oldKeyInfo.algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES
) {
// if we already have a usable default SSSS key and aren't resetting SSSS just use it.
// otherwise, create a new one
// Note: we leave the old SSSS key in place: there could be other secrets using it, in theory.
// We could move them to the new key but a) that would mean we'd need to prompt for the old
// passphrase, and b) it's not clear that would be the right thing to do anyway.
const { keyInfo, privateKey } = await createSecretStorageKey();
newKeyId = await createSSSS(keyInfo, privateKey);
}
Expand Down

0 comments on commit fe3e87a

Please sign in to comment.