fetchOhttpKeys function

Future<OhttpKeys> fetchOhttpKeys({
  1. required Url ohttpRelay,
  2. required Url payjoinDirectory,
})

Fetch the ohttp keys from the specified payjoin directory via proxy.

  • ohttpRelay: The http CONNNECT method proxy to request the ohttp keys from a payjoin directory. Proxying requests for ohttp keys ensures a client IP address is never revealed to the payjoin directory.

  • payjoinDirectory: The payjoin directory from which to fetch the ohttp keys. This directory stores and forwards payjoin client payloads.

  • certDer (optional): The DER-encoded certificate to use for local HTTPS connections. This parameter is only available when the "danger-local-https" feature is enabled.

Implementation

Future<OhttpKeys> fetchOhttpKeys({
  required Url ohttpRelay,
  required Url payjoinDirectory,
}) async {
  try {
    final res = await io.fetchOhttpKeys(
      ohttpRelay: ohttpRelay,
      payjoinDirectory: payjoinDirectory,
    );
    return OhttpKeys._(field0: res.field0);
  } on error.PayjoinError catch (e) {
    throw mapPayjoinError(e);
  }
}