verifyTotp method

Future<StatusResponse> verifyTotp({
  1. required String code,
  2. bool trustDevice = false,
})

Verify TOTP

code The TOTP code trustDevice If true, the device will be trusted for 30 days. It'll be refreshed on every sign in request within this time.

Implementation

Future<StatusResponse> verifyTotp({required String code, bool trustDevice = false}) async {
  try {
    final response = await dio.post(
      "/two-factor/verify-totp",
      data: {"code": code, "trustDevice": trustDevice},
      options: await super.getOptions(),
    );
    return TwoFactorVerifyTotp.fromJson(response.data);
  } catch (e) {
    final message = getErrorMessage(e);
    if (message == null) rethrow;
    throw message;
  }
}