async (recoveryKey) => { const decodedRecoveryKey = decodeRecoveryKey(recoveryKey); const match = await mx.secretStorage.checkKey(decodedRecoveryKey, keyContent as any); if (!match) { throw new Error('Invalid recovery key.'); } return decodedRecoveryKey; }, [mx, keyContent] ) ); const drivingKey = driveKeyState.status === AsyncStatus.Loading; const loading = drivingKey || processing; const handleSubmit: FormEventHandler = (evt) => { evt.preventDefault(); const target = evt.target as HTMLFormElement | undefined; const recoveryKeyInput = target?.recoveryKeyInput as HTMLInputElement | undefined; if (!recoveryKeyInput) return; const recoveryKey = recoveryKeyInput.value.trim(); if (!recoveryKey) return; submitRecoveryKey(recoveryKey).then((decodedRecoveryKey) => { if (alive()) { recoveryKeyInput.value = ''; onDecodedRecoveryKey(decodedRecoveryKey); } }); }; return ( Recovery Key {driveKeyState.status === AsyncStatus.Error && ( {driveKeyState.error.message} )} ); }