matrix-react-sdk
Version:
SDK for matrix.org using React
115 lines (114 loc) • 4.05 kB
TypeScript
import React from "react";
import { BackupTrustInfo, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api";
declare enum Phase {
Loading = "loading",
LoadError = "load_error",
ChooseKeyPassphrase = "choose_key_passphrase",
Migrate = "migrate",
Passphrase = "passphrase",
PassphraseConfirm = "passphrase_confirm",
ShowKey = "show_key",
Storing = "storing",
Stored = "stored",
ConfirmSkip = "confirm_skip"
}
interface IProps {
hasCancel?: boolean;
accountPassword?: string;
forceReset?: boolean;
onFinished(ok?: boolean): void;
}
interface IState {
phase: Phase;
passPhrase: string;
passPhraseValid: boolean;
passPhraseConfirm: string;
copied: boolean;
downloaded: boolean;
setPassphrase: boolean;
/** Information on the current key backup version, as returned by the server.
*
* `null` could mean any of:
* * we haven't yet requested the data from the server.
* * we were unable to reach the server.
* * the server returned key backup version data we didn't understand or was malformed.
* * there is actually no backup on the server.
*/
backupInfo: KeyBackupInfo | null;
/**
* Information on whether the backup in `backupInfo` is correctly signed, and whether we have the right key to
* decrypt it.
*
* `undefined` if `backupInfo` is null, or if crypto is not enabled in the client.
*/
backupTrustInfo: BackupTrustInfo | undefined;
canUploadKeysWithPasswordOnly: boolean | null;
accountPassword: string;
accountPasswordCorrect: boolean | null;
canSkip: boolean;
passPhraseKeySelected: string;
error?: boolean;
}
/**
* Walks the user through the process of creating a 4S passphrase and bootstrapping secret storage.
*
* If the user already has a key backup, follows a "migration" flow (aka "Upgrade your encryption") which
* prompts the user to enter their backup decryption password (a Curve25519 private key, possibly derived
* from a passphrase), and uses that as the (AES) 4S encryption key.
*/
export default class CreateSecretStorageDialog extends React.PureComponent<IProps, IState> {
static defaultProps: Partial<IProps>;
private recoveryKey?;
private recoveryKeyNode;
private passphraseField;
constructor(props: IProps);
componentWillUnmount(): void;
private getInitialPhase;
/**
* Attempt to get information on the current backup from the server, and update the state.
*
* Updates {@link IState.backupInfo} and {@link IState.backupTrustInfo}, and picks an appropriate phase for
* {@link IState.phase}.
*
* @returns If the backup data was retrieved successfully, the trust info for the backup. Otherwise, undefined.
*/
private fetchBackupInfo;
private queryKeyUploadAuth;
private onKeyBackupStatusChange;
private onKeyPassphraseChange;
private onChooseKeyPassphraseFormSubmit;
private onMigrateFormSubmit;
private onCopyClick;
private onDownloadClick;
private doBootstrapUIAuth;
private bootstrapSecretStorage;
private onCancel;
private restoreBackup;
private onLoadRetryClick;
private onShowKeyContinueClick;
private onCancelClick;
private onGoBackClick;
private onPassPhraseNextClick;
private onPassPhraseConfirmNextClick;
private onSetAgainClick;
private onPassPhraseValidate;
private onPassPhraseChange;
private onPassPhraseConfirmChange;
private onAccountPasswordChange;
private renderOptionKey;
private renderOptionPassphrase;
private renderPhaseChooseKeyPassphrase;
private renderPhaseMigrate;
private renderPhasePassPhrase;
private renderPhasePassPhraseConfirm;
private renderPhaseShowKey;
private renderBusyPhase;
private renderStoredPhase;
private renderPhaseLoadError;
private renderPhaseSkipConfirm;
private titleForPhase;
private get topComponent();
private get classNames();
render(): React.ReactNode;
}
export {};