getOTP method

  1. @override
Future<AtResponse> getOTP()
override

Returns an OTP (One-Time Password) from the secondary server.

Example usage:

AtResponse otpResponse = await atClient.getOTP();

Implementation

@override
Future<AtResponse> getOTP() async {
  String? otpVerbResponse;
  try {
    otpVerbResponse =
        await _remoteSecondary?.executeCommand('otp:get\n', auth: true);
  } on AtLookUpException catch (e) {
    throw AtClientException(e.errorCode, e.errorMessage);
  } on AtException catch (e) {
    throw AtClientException.message(e.message);
  }
  otpVerbResponse = otpVerbResponse?.replaceAll('data:', '');
  return AtResponse()..response = otpVerbResponse!;
}