Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Pass new secret storage key to bootstrap path
Browse files Browse the repository at this point in the history
This passes the newly created secret storage key down to the bootstrap path for
temporary caching to avoid prompting the user for it again in the later stages
of bootstrapping.

Fixes element-hq/element-web#12867
  • Loading branch information
jryans committed Mar 30, 2020
1 parent 4e8cec3 commit 690b594
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {

this._keyInfo = null;
this._encodedRecoveryKey = null;
this._recoveryKey = null;
this._recoveryKeyNode = null;
this._setZxcvbnResultTimeout = null;

Expand Down Expand Up @@ -234,14 +235,22 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
if (force) {
await cli.bootstrapSecretStorage({
authUploadDeviceSigningKeys: this._doBootstrapUIAuth,
createSecretStorageKey: async () => this._keyInfo,
createSecretStorageKey: async () => [
this._keyInfo,
this._encodedRecoveryKey,
this._recoveryKey,
],
setupNewKeyBackup: true,
setupNewSecretStorage: true,
});
} else {
await cli.bootstrapSecretStorage({
authUploadDeviceSigningKeys: this._doBootstrapUIAuth,
createSecretStorageKey: async () => this._keyInfo,
createSecretStorageKey: async () => [
this._keyInfo,
this._encodedRecoveryKey,
this._recoveryKey,
],
keyBackupInfo: this.state.backupInfo,
setupNewKeyBackup: !this.state.backupInfo && this.state.useKeyBackup,
getKeyBackupPassphrase: promptForBackupPassphrase,
Expand Down Expand Up @@ -299,10 +308,11 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
}

_onSkipPassPhraseClick = async () => {
const [keyInfo, encodedRecoveryKey] =
const [keyInfo, encodedRecoveryKey, recoveryKey] =
await MatrixClientPeg.get().createRecoveryKeyFromPassphrase();
this._keyInfo = keyInfo;
this._encodedRecoveryKey = encodedRecoveryKey;
this._recoveryKey = recoveryKey;
this.setState({
copied: false,
downloaded: false,
Expand Down Expand Up @@ -335,10 +345,11 @@ export default class CreateSecretStorageDialog extends React.PureComponent {

if (this.state.passPhrase !== this.state.passPhraseConfirm) return;

const [keyInfo, encodedRecoveryKey] =
const [keyInfo, encodedRecoveryKey, recoveryKey] =
await MatrixClientPeg.get().createRecoveryKeyFromPassphrase(this.state.passPhrase);
this._keyInfo = keyInfo;
this._encodedRecoveryKey = encodedRecoveryKey;
this._recoveryKey = recoveryKey;
this.setState({
copied: false,
downloaded: false,
Expand Down

0 comments on commit 690b594

Please sign in to comment.