initOtpAuth method

Future<TInitOtpAuthResponse> initOtpAuth({
  1. required TInitOtpAuthBody input,
})

Initiate an OTP auth activity.

Sign the provided TInitOtpAuthBody with the client's stamp function and submit the request (POST /public/v1/submit/init_otp_auth).

See also: stampInitOtpAuth.

Implementation

Future<TInitOtpAuthResponse> initOtpAuth({
  required TInitOtpAuthBody input,
}) async {
  final body = packActivityBody(
    bodyJson: input.toJson(),
    fallbackOrganizationId: input.organizationId ??
        config.organizationId ??
        (throw Exception(
            "Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
    activityType: 'ACTIVITY_TYPE_INIT_OTP_AUTH_V2',
  );
  return await request<Map<String, dynamic>, TInitOtpAuthResponse>(
      "/public/v1/submit/init_otp_auth",
      body,
      (json) => TInitOtpAuthResponse.fromJson(
          transformActivityResponse(json, 'InitOtpAuth')));
}