Skip to content

Commit

Permalink
Receive private key for caching from the app layer
Browse files Browse the repository at this point in the history
This passes through the new secret storage key as well as the key info so that
bootstrap can use it immediately without triggering an immediate prompt.

Part of element-hq/element-web#12867
  • Loading branch information
jryans committed Mar 30, 2020
1 parent d2ba303 commit 9a1d624
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crypto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,13 @@ Crypto.prototype.bootstrapSecretStorage = async function({
} else {
if (!newKeyId) {
logger.log("Secret storage default key not found, creating new key");
const keyOptions = await createSecretStorageKey();
const [keyOptions, , key] = await createSecretStorageKey();
newKeyId = await this.addSecretStorageKey(
SECRET_STORAGE_ALGORITHM_V1_AES,
keyOptions,
);
await this.setDefaultSecretStorageKeyId(newKeyId);
ssssKeys[newKeyId] = key;
}
if (await this.isSecretStored("m.megolm_backup.v1")) {
// we created a new SSSS, and we previously encrypted the
Expand Down

0 comments on commit 9a1d624

Please sign in to comment.