@@ -86,11 +86,11 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
86
86
} ;
87
87
88
88
private validateRecoveryKeyOnChange = debounce ( async ( ) : Promise < void > => {
89
- await this . validateRecoveryKey ( ) ;
89
+ await this . validateRecoveryKey ( this . state . recoveryKey ) ;
90
90
} , VALIDATION_THROTTLE_MS ) ;
91
91
92
- private async validateRecoveryKey ( ) : Promise < void > {
93
- if ( this . state . recoveryKey === "" ) {
92
+ private async validateRecoveryKey ( recoveryKey : string ) : Promise < void > {
93
+ if ( recoveryKey === "" ) {
94
94
this . setState ( {
95
95
recoveryKeyValid : null ,
96
96
recoveryKeyCorrect : null ,
@@ -100,7 +100,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
100
100
101
101
try {
102
102
const cli = MatrixClientPeg . safeGet ( ) ;
103
- const decodedKey = decodeRecoveryKey ( this . state . recoveryKey ) ;
103
+ const decodedKey = decodeRecoveryKey ( recoveryKey ) ;
104
104
const correct = await cli . secretStorage . checkKey ( decodedKey , this . props . keyInfo ) ;
105
105
this . setState ( {
106
106
recoveryKeyValid : true ,
@@ -148,11 +148,12 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
148
148
// right number of characters, but it's really just to make sure that what we're reading is
149
149
// text because we'll put it in the text field.
150
150
if ( / ^ [ 1 2 3 4 5 6 7 8 9 A B C D E F G H J K L M N P Q R S T U V W X Y Z a b c d e f g h i j k m n o p q r s t u v w x y z \s ] + $ / . test ( contents ) ) {
151
+ const recoveryKey = contents . trim ( ) ;
151
152
this . setState ( {
152
153
recoveryKeyFileError : null ,
153
- recoveryKey : contents . trim ( ) ,
154
+ recoveryKey,
154
155
} ) ;
155
- await this . validateRecoveryKey ( ) ;
156
+ await this . validateRecoveryKey ( recoveryKey ) ;
156
157
} else {
157
158
this . setState ( {
158
159
recoveryKeyFileError : true ,
0 commit comments