pub trait Format: 'static + Send {
    const TOKEN_LEN: usize;

    fn generate_new_token(
        &mut self,
        context: &mut Context<'_>,
        source_connection_id: &LocalId,
        output_buffer: &mut [u8]
    ) -> Option<()>; fn generate_retry_token(
        &mut self,
        context: &mut Context<'_>,
        original_destination_connection_id: &InitialId,
        output_buffer: &mut [u8]
    ) -> Option<()>; fn validate_token(
        &mut self,
        context: &mut Context<'_>,
        token: &[u8]
    ) -> Option<InitialId>; }

Required Associated Constants

Required Methods

Generate a signed token to be delivered in a NEW_TOKEN frame. This function will only be called if the provider support NEW_TOKEN frames.

Generate a signed token to be delivered in a Retry Packet

Return the original destination connection id of a valid token. If the token is invalid, return None. Callers should detect duplicate tokens and treat them as invalid.

Implementors