pub struct NonceCredential {
pub timestamp: u64,
pub nonce: String,
pub signature: String,
}Expand description
A self-contained cryptographic credential used to authenticate a request.
This structure is generated by a CredentialBuilder and verified by a CredentialVerifier.
It is designed to be serialized and sent alongside your application’s request data.
§Fields
timestamp: Unix timestamp indicating when the credential was created.nonce: A unique, single-use value to prevent replay attacks.signature: An HMAC-SHA256 signature covering the timestamp, nonce, and user-defined payload.
§Example
use nonce_auth::CredentialBuilder;
let credential = CredentialBuilder::new(b"secret")
.sign(b"data")?;
// Serialize for transmission
let json = serde_json::to_string(&credential)?;Fields§
§timestamp: u64§nonce: String§signature: StringTrait Implementations§
Source§impl Clone for NonceCredential
impl Clone for NonceCredential
Source§fn clone(&self) -> NonceCredential
fn clone(&self) -> NonceCredential
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NonceCredential
impl Debug for NonceCredential
Source§impl<'de> Deserialize<'de> for NonceCredential
impl<'de> Deserialize<'de> for NonceCredential
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for NonceCredential
impl RefUnwindSafe for NonceCredential
impl Send for NonceCredential
impl Sync for NonceCredential
impl Unpin for NonceCredential
impl UnwindSafe for NonceCredential
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