pub struct EncryptedBodyBuilder<T> { /* private fields */ }Expand description
Route builder that expects an authenticated-encrypted request body of type T
(ChaCha20-Poly1305).
Obtained from ServerMechanism::encryption. On each matching request the raw
body bytes are decrypted using the SerializationKey supplied there. If
decryption fails the route immediately returns 403 Forbidden.
Optionally attach shared state via state before
finalising with onconnect /
onconnect_sync.
Implementations§
Source§impl<T> EncryptedBodyBuilder<T>
impl<T> EncryptedBodyBuilder<T>
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 the decrypted body as T.
Sourcepub unsafe fn onconnect_sync<F, Re>(self, handler: F) -> SocketType
pub unsafe fn onconnect_sync<F, Re>(self, handler: F) -> SocketType
Finalises this route with a synchronous handler that receives the decrypted
body as T.
§Safety
See ServerMechanism::onconnect_sync for the thread-pool safety notes.
Sourcepub fn state<S: Clone + Send + Sync + 'static>(
self,
state: S,
) -> StatefulEncryptedBodyBuilder<T, S>
pub fn state<S: Clone + Send + Sync + 'static>( self, state: S, ) -> StatefulEncryptedBodyBuilder<T, S>
Attaches shared state S, transitioning to StatefulEncryptedBodyBuilder.
Auto Trait Implementations§
impl<T> Freeze for EncryptedBodyBuilder<T>
impl<T> RefUnwindSafe for EncryptedBodyBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for EncryptedBodyBuilder<T>where
T: Send,
impl<T> Sync for EncryptedBodyBuilder<T>where
T: Sync,
impl<T> Unpin for EncryptedBodyBuilder<T>where
T: Unpin,
impl<T> UnsafeUnpin for EncryptedBodyBuilder<T>
impl<T> UnwindSafe for EncryptedBodyBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more