Skip to main content

Server

Struct Server 

Source
pub struct Server { /* private fields */ }
Expand description

A server with one advertised recipient key and other accepted keys.

Implementations§

Source§

impl Server

Source

pub fn new( recipient_private_key: &[u8], recipient_key_id: Vec<u8>, limits: Limits, ) -> Result<Self, Error>

Validate and create a server for one static recipient key.

§Errors

Returns Error::InvalidConfiguration for invalid key material, identifiers, or limits.

Source

pub fn with_accepted_keys( recipient_private_key: &[u8], recipient_key_id: Vec<u8>, accepted: Vec<(Vec<u8>, Vec<u8>)>, limits: Limits, ) -> Result<Self, Error>

Create a server that advertises one key and also accepts other keys.

Each accepted pair holds a private key followed by its public key ID.

§Errors

Returns Error::InvalidConfiguration for invalid or duplicate IDs, invalid private keys, or invalid limits.

Source

pub fn public_key(&self) -> Vec<u8> ⓘ

Return the encoded public key for this server’s private key.

Source

pub fn max_complete_envelope_len(&self) -> Result<usize, Error>

Return the largest complete request envelope accepted by preparse.

Bindings use this limit before they copy a complete envelope.

§Errors

Returns Error::LimitExceeded if the size cannot fit in usize.

Source

pub fn preparse(&self, envelope: &[u8]) -> Result<PreparsedRequest, Error>

Parse bounded public fields without accepting credentials or plaintext.

§Errors

Returns a stable parse, limit, version, suite, or recipient-key error.

Source

pub fn preparse_owned( &self, envelope: Vec<u8>, ) -> Result<PreparsedRequest, Error>

Parse an owned envelope without cloning its complete ciphertext.

Bindings which already own their input can move it into the one-shot credential-resolution token. The same bounded public checks run before the token is created.

§Errors

Returns a stable parse, limit, version, suite, or recipient-key error.

Source

pub fn authenticate( &self, token: StartToken, psk: &[u8], ) -> Result<AuthenticatedRequest, Error>

Authenticate and parse the full request, then pause before replay admission.

Plaintext stays inside the returned opaque token until admission.

§Errors

Returns a credential, recipient-key, parse, authentication, request-time, or clock error.

Source

pub fn authenticate_at( &self, token: StartToken, psk: &[u8], now_unix_s: u64, ) -> Result<AuthenticatedRequest, Error>

Authenticate at an injected Unix time, then pause before replay admission.

§Errors

Returns a credential, recipient-key, parse, authentication, or request-time error.

Source§

impl Server

Source

pub fn stream_start_length(&self, input: &[u8]) -> Result<Option<usize>, Error>

Return the START boundary once its bounded frame length is known.

§Errors

Returns a parse, version, suite, or size error.

Source

pub fn preparse_stream( &self, first: &[u8], ) -> Result<PreparsedStreamRequest, Error>

Read the exact public prefix and START frame before credential lookup.

§Errors

Returns a parse, limit, or recipient-key error.

Source

pub fn authenticate_stream( &self, token: StreamStartToken, psk: &[u8], ) -> Result<AuthenticatedStreamRequest, Error>

Authenticate START, then pause before replay admission.

§Errors

Returns a credential, time, authentication, or parse error.

Source

pub fn authenticate_stream_at( &self, token: StreamStartToken, psk: &[u8], now_unix_s: u64, ) -> Result<AuthenticatedStreamRequest, Error>

Authenticate START at a caller-supplied trusted Unix time.

§Errors

Returns a credential, time, authentication, or parse error.

Trait Implementations§

Source§

impl Debug for Server

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V