Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
};

private validateRecoveryKeyOnChange = debounce(async (): Promise<void> => {
await this.validateRecoveryKey();
await this.validateRecoveryKey(this.state.recoveryKey);
}, VALIDATION_THROTTLE_MS);

private async validateRecoveryKey(): Promise<void> {
if (this.state.recoveryKey === "") {
private async validateRecoveryKey(recoveryKey: string): Promise<void> {
if (recoveryKey === "") {
this.setState({
recoveryKeyValid: null,
recoveryKeyCorrect: null,
Expand All @@ -100,7 +100,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp

try {
const cli = MatrixClientPeg.safeGet();
const decodedKey = decodeRecoveryKey(this.state.recoveryKey);
const decodedKey = decodeRecoveryKey(recoveryKey);
const correct = await cli.secretStorage.checkKey(decodedKey, this.props.keyInfo);
this.setState({
recoveryKeyValid: true,
Expand Down Expand Up @@ -148,11 +148,12 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
// right number of characters, but it's really just to make sure that what we're reading is
// text because we'll put it in the text field.
if (/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\s]+$/.test(contents)) {
const recoveryKey = contents.trim();
this.setState({
recoveryKeyFileError: null,
recoveryKey: contents.trim(),
recoveryKey,
});
await this.validateRecoveryKey();
await this.validateRecoveryKey(recoveryKey);
} else {
this.setState({
recoveryKeyFileError: true,
Expand Down
Loading