pub struct RelayAuthenticator { /* private fields */ }Expand description
ML-DSA-65 authenticator with anti-replay protection
Implementations§
Source§impl RelayAuthenticator
impl RelayAuthenticator
Sourcepub fn new() -> RelayResult<Self>
pub fn new() -> RelayResult<Self>
Create a new authenticator with a random key pair
§Errors
Returns an error if ML-DSA-65 key generation fails.
Sourcepub fn with_keypair(
public_key: MlDsaPublicKey,
secret_key: MlDsaSecretKey,
) -> Self
pub fn with_keypair( public_key: MlDsaPublicKey, secret_key: MlDsaSecretKey, ) -> Self
Create an authenticator with a specific keypair
Sourcepub fn public_key(&self) -> &MlDsaPublicKey
pub fn public_key(&self) -> &MlDsaPublicKey
Get the public key
Sourcepub fn create_token(
&self,
bandwidth_limit: u32,
timeout_seconds: u32,
) -> RelayResult<AuthToken>
pub fn create_token( &self, bandwidth_limit: u32, timeout_seconds: u32, ) -> RelayResult<AuthToken>
Create a new authentication token
Sourcepub fn verify_token(
&self,
token: &AuthToken,
peer_public_key: &MlDsaPublicKey,
) -> RelayResult<()>
pub fn verify_token( &self, token: &AuthToken, peer_public_key: &MlDsaPublicKey, ) -> RelayResult<()>
Verify an authentication token with anti-replay protection
Sourcepub fn set_max_token_age(&mut self, max_age_seconds: u64)
pub fn set_max_token_age(&mut self, max_age_seconds: u64)
Set maximum token age
Sourcepub fn max_token_age(&self) -> u64
pub fn max_token_age(&self) -> u64
Get maximum token age
Sourcepub fn clear_nonces(&self)
pub fn clear_nonces(&self)
Clear all used nonces (for testing)
Sourcepub fn nonce_count(&self) -> usize
pub fn nonce_count(&self) -> usize
Get number of used nonces (for testing)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RelayAuthenticator
impl RefUnwindSafe for RelayAuthenticator
impl Send for RelayAuthenticator
impl Sync for RelayAuthenticator
impl Unpin for RelayAuthenticator
impl UnwindSafe for RelayAuthenticator
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