pub struct AuthToken {
pub nonce: u64,
pub timestamp: u64,
pub bandwidth_limit: u32,
pub timeout_seconds: u32,
pub signature: [u8; 64],
}Expand description
Cryptographic authentication token for relay operations
Fields§
§nonce: u64Unique nonce to prevent replay attacks
timestamp: u64Timestamp when token was created (Unix timestamp)
bandwidth_limit: u32Requested bandwidth limit in bytes per second
timeout_seconds: u32Session timeout in seconds
signature: [u8; 64]Ed25519 signature over the token data
Implementations§
Source§impl AuthToken
impl AuthToken
Sourcepub fn new(
bandwidth_limit: u32,
timeout_seconds: u32,
signing_key: &SigningKey,
) -> RelayResult<Self>
pub fn new( bandwidth_limit: u32, timeout_seconds: u32, signing_key: &SigningKey, ) -> RelayResult<Self>
Create a new authentication token
Sourcepub fn verify(&self, verifying_key: &VerifyingKey) -> RelayResult<()>
pub fn verify(&self, verifying_key: &VerifyingKey) -> RelayResult<()>
Verify the token signature
Sourcepub fn is_expired(&self, max_age_seconds: u64) -> RelayResult<bool>
pub fn is_expired(&self, max_age_seconds: u64) -> RelayResult<bool>
Check if the token has expired
Trait Implementations§
impl Eq for AuthToken
impl StructuralPartialEq for AuthToken
Auto Trait Implementations§
impl Freeze for AuthToken
impl RefUnwindSafe for AuthToken
impl Send for AuthToken
impl Sync for AuthToken
impl Unpin for AuthToken
impl UnwindSafe for AuthToken
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.