fromDomain method

Future<WebAuth> fromDomain (
  1. String domain,
  2. Network network
)

Creates a WebAuth instance by loading the needed data from the stellar.toml file hosted on the given domain. e.g. fromDomain("soneso.com", Network.TESTNET)

  • Parameter domain: The domain from which to get the stellar information
  • Parameter network: The network used.

Implementation

static Future<WebAuth> fromDomain(String domain, Network network) async {
  String vDomain = checkNotNull(domain, "domain can not be null");
  Network vNetwork = checkNotNull(network, "network can not be null");

  final StellarToml toml = await StellarToml.fromDomain(vDomain);

  if (toml.generalInformation.webAuthEndpoint == null) {
    throw Exception("No WEB_AUTH_ENDPOINT found in stellar.toml");
  }
  if (toml.generalInformation.signingKey == null) {
    throw Exception("No auth server SIGNING_KEY found in stellar.toml");
  }

  return new WebAuth(toml.generalInformation.webAuthEndpoint, vNetwork,
      toml.generalInformation.signingKey, vDomain);
}