pub struct Server { /* private fields */ }Expand description
A server configured for one static recipient key.
Implementations§
Source§impl Server
impl Server
Sourcepub fn new(
recipient_private_key: &[u8],
recipient_key_id: Vec<u8>,
limits: Limits,
) -> Result<Self, Error>
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.
Sourcepub fn with_compression(self) -> Self
pub fn with_compression(self) -> Self
Accept the authenticated gzip/zstd body-coding extension and compress a response only when its client advertised a supported coding.
Sourcepub fn preparse(&self, envelope: &[u8]) -> Result<PreparsedRequest, Error>
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.
Sourcepub fn preparse_owned(
&self,
envelope: Vec<u8>,
) -> Result<PreparsedRequest, Error>
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.
Sourcepub fn authenticate(
&self,
token: StartToken,
psk: &[u8],
) -> Result<AuthenticatedRequest, Error>
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.
Sourcepub fn authenticate_at(
&self,
token: StartToken,
psk: &[u8],
now_unix_s: u64,
) -> Result<AuthenticatedRequest, Error>
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.