requestOTP method

Future<RequestOTPResponse> requestOTP({
  1. required String recipient,
  2. required DeliveryMethod deliveryMethod,
  3. int? codeLength,
  4. int? ttlSeconds,
  5. Map<String, String>? context,
})

Request an OTP to be sent via email or SMS

Implementation

Future<RequestOTPResponse> requestOTP({
  required String recipient,
  required DeliveryMethod deliveryMethod,
  int? codeLength,
  int? ttlSeconds,
  Map<String, String>? context,
}) async {
  final mergedContext = await DeviceMetadata.mergeWithContext(context);

  final request = RequestOTPRequest(
    tenantId: tenantId,
    recipient: recipient,
    deliveryMethod: deliveryMethod,
    codeLength: codeLength ?? 0,
    ttlSeconds: ttlSeconds ?? 0,
    context: mergedContext,
  );

  return await _client.requestOTP(request);
}