/// <inheritdoc />
        public async Task ForwardAsync(IEnvelopeMessage envelope, AgentEndpoint endpoint)
        {
            _logger.LogInformation(LoggingEvents.Forward, "Envelope {0}, Endpoint {1}", envelope.Type, endpoint.Uri);

            var encrypted = await _messageSerializer.PackAsync(envelope, endpoint.Verkey);

            var request = new HttpRequestMessage
            {
                RequestUri = new Uri(endpoint.Uri),
                Method     = HttpMethod.Post,
                Content    = new ByteArrayContent(encrypted)
            };

            request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

            var response = await _httpClient.SendAsync(request);

            response.EnsureSuccessStatusCode();
        }
Exemplo n.º 2
0
 private static IContentMessage GetContentMessage(IEnvelopeMessage message)
 => JsonConvert.DeserializeObject <IContentMessage>(message.Content);