pub struct StatefulEncryptedBodyBuilder<T, S> { /* private fields */ }Expand description
Route builder carrying shared state S and a VEIL-encrypted request body of type T.
Obtained from EncryptedBodyBuilder::state or StatefulSocketBuilder::encryption.
On each matching request the body is VEIL-decrypted and a fresh clone of S is
prepared before the handler is called. A wrong key or corrupt body returns
403 Forbidden without ever invoking the handler.
Finalise with onconnect.
Implementations§
Source§impl<T, S> StatefulEncryptedBodyBuilder<T, S>
impl<T, S> StatefulEncryptedBodyBuilder<T, S>
Sourcepub fn onconnect<F, Fut, Re>(self, handler: F) -> SocketType
pub fn onconnect<F, Fut, Re>(self, handler: F) -> SocketType
Finalises this route with an async handler that receives (state: S, body: T).
On each request the raw body bytes are VEIL-decrypted using the configured
SerializationKey and a fresh clone of S is prepared — both are handed to the
handler together. If decryption fails (wrong key or corrupt body) the route returns
403 Forbidden and the handler is never invoked. The T the closure receives is
always a trusted, fully-decrypted value ready to use.
The handler must return Result<impl Reply, Rejection>.
Returns a SocketType ready to be passed to Server::mechanism.