stampOtpLogin method

Future<TSignedRequest> stampOtpLogin({
  1. required TOtpLoginBody input,
})

Produce a SignedRequest from TOtpLoginBody by using the client's stamp function.

See also: OtpLogin.

Implementation

Future<TSignedRequest> stampOtpLogin({
  required TOtpLoginBody input,
}) async {
  final fullUrl = '${config.baseUrl}/public/v1/submit/otp_login';
  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_OTP_LOGIN',
  );
  final bodyJson = jsonEncode(body);
  final stamp = await stamper.stamp(bodyJson);

  return TSignedRequest(
    body: bodyJson,
    stamp: stamp,
    url: fullUrl,
  );
}