transformRequest method

  1. @override
Future transformRequest(
  1. HttpAgentRequest request
)
override

Transform a request into a signed version of the request. This is done last after the transforms on the body of a request. The returned object can be anything, but must be serializable to CBOR. @param request - internet computer request to transform

Implementation

@override
Future<dynamic> transformRequest(HttpAgentRequest request) async {
  var body = request.body;
  var requestId = requestIdOf(body.toJson());

  return {
    ...request.toJson(),
    "body": {
      "content": request.body.toJson(),
      "sender_sig":
          await sign(u8aConcat([requestDomainSeparator, requestId])),
      "sender_delegation":
          _delegation.delegations.map((e) => e.toMap()).toList(),
      "sender_pubkey": _delegation.publicKey,
    },
  };
}