pub struct StatefulEncryptedQueryBuilder<T, S> { /* private fields */ }Expand description
Route builder carrying shared state S and VEIL-encrypted query parameters of
type T.
Obtained from EncryptedQueryBuilder::state or
StatefulSocketBuilder::encrypted_query. On each matching request the
?data=<base64url> parameter is base64-decoded then VEIL-decrypted and a fresh
clone of S is prepared before the handler is called. Any decode or decryption
failure returns 403 Forbidden without ever invoking the handler.
Finalise with onconnect.
Implementations§
Source§impl<T, S> StatefulEncryptedQueryBuilder<T, S>
impl<T, S> StatefulEncryptedQueryBuilder<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, query: T).
On each request the ?data=<base64url> query parameter is base64-decoded then
VEIL-decrypted using the configured SerializationKey and a fresh clone of S
is prepared — both are handed to the handler together. If any step fails (missing
parameter, bad encoding, wrong key, or corrupt data) 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.