initMultiFactorInfo static method

MultiFactorInfo? initMultiFactorInfo(
  1. GoogleCloudIdentitytoolkitV1MfaEnrollment response
)

Initializes the MultiFactorInfo associated subclass using the server side. If no MultiFactorInfo is associated with the response, null is returned.

@param response - The server side response. @internal

Implementation

static MultiFactorInfo? initMultiFactorInfo(
  auth1.GoogleCloudIdentitytoolkitV1MfaEnrollment response,
) {
  // PhoneMultiFactorInfo, TotpMultiFactorInfo currently available.
  try {
    final phoneInfo = response.phoneInfo;
    // TODO Support TotpMultiFactorInfo

    if (phoneInfo != null) {
      return PhoneMultiFactorInfo.fromResponse(response);
    }
    // Ignore the other SDK unsupported MFA factors to prevent blocking developers using the current SDK.
  } catch (e) {
    // Ignore error.
  }

  return null;
}