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_pubkey": getPublicKey().toDer(),
      "sender_sig": await sign(blobFromBuffer(
          u8aConcat([domainSeparator, requestId.buffer]).buffer)),
    },
  };
}