HttpClientLink(String _conn, String dsIdPrefix, PrivateKey privateKey, { NodeProvider nodeProvider, bool isRequester: true, bool isResponder: true, Requester overrideRequester, Responder overrideResponder, bool strictTls: false, String home, String token, Map linkData, List formats })

Source

HttpClientLink(this._conn, String dsIdPrefix, PrivateKey privateKey, {
  NodeProvider nodeProvider,
  bool isRequester: true,
  bool isResponder: true,
  Requester overrideRequester,
  Responder overrideResponder,
  this.strictTls: false,
  this.home,
  this.token,
  this.linkData,
  List formats
}) : privateKey = privateKey,
      dsId = '${Path.escapeName(dsIdPrefix)}${privateKey.publicKey.qHash64}' {
  if (isRequester) {
    if (overrideRequester != null) {
      requester = overrideRequester;
    } else {
      requester = new Requester();
    }
  }

  if (formats == null &&
    const String.fromEnvironment("dsa.codec.formats") != null) {
    var formatString = const String.fromEnvironment("dsa.codec.formats");
    formats = formatString.split(",");
  }

  if (formats != null) {
    this.formats = formats;
  }

  if (isResponder) {
    if (overrideResponder != null) {
      responder = overrideResponder;
    } else if (nodeProvider != null) {
      responder = new Responder(nodeProvider);
    }
  }

  if (token != null && token.length > 16) {
    // pre-generate tokenHash
    String tokenId = token.substring(0, 16);
    String hashStr = CryptoProvider.sha256(
        toUTF8('$dsId$token'));
    tokenHash = '&token=$tokenId$hashStr';
  }
}