pub struct EncryptedBodyRequestBuilder<'a, T> { /* private fields */ }Expand description
A request builder that seals the body (ChaCha20-Poly1305) before sending.
Obtained from RequestBuilder::encryption. Finalise with
send (async) or
send_sync (sync).
The expected response is also sealed and is opened transparently.
Implementations§
Source§impl<'a, T: Encode> EncryptedBodyRequestBuilder<'a, T>
impl<'a, T: Encode> EncryptedBodyRequestBuilder<'a, T>
Sourcepub async fn send<R>(self) -> Result<R, ClientError>
pub async fn send<R>(self) -> Result<R, ClientError>
Sends the request asynchronously.
Before the request leaves, the body is sealed using the SerializationKey
supplied to .encryption(). The server receives a
raw application/octet-stream payload. When the response arrives, its bytes are
opened with the same key to produce R. If either sealing or opening fails
the error is wrapped in ClientError::Serialization.
Sourcepub fn send_sync<R>(self) -> Result<R, ClientError>
pub fn send_sync<R>(self) -> Result<R, ClientError>
Sends the request synchronously.
The body is sealed with the configured SerializationKey before the wire
send. The response bytes, once received, are opened with the same key to
produce R. Any cipher failure is wrapped in ClientError::Serialization.