getChallenge method

Future<String> getChallenge (
  1. String clientAccountId,
  2. [String homeDomain,
  3. String clientDomain]
)

Get challenge transaction from the web auth server. Returns base64 xdr transaction envelope received from the web auth server.

  • Parameter clientAccountId: The account id of the client/user that requests the challenge.
  • Parameter homeDomain: optional, used for requesting the challenge depending on the home domain if needed. The web auth server may serve multiple home domains.

Implementation

Future<String> getChallenge(String clientAccountId,
    [String homeDomain, String clientDomain]) async {
  ChallengeResponse challengeResponse =
      await getChallengeResponse(clientAccountId, homeDomain);

  String transaction = challengeResponse.transaction;
  if (transaction == null) {
    throw Exception("Error parsing challenge response");
  }
  return transaction;
}