Struct ncryptf::Authorization
source · [−]pub struct Authorization {
pub token: Token,
pub salt: Vec<u8>,
pub date: DateTime<Utc>,
pub signature: String,
pub hmac: Vec<u8>,
pub version: Option<i8>,
}
Fields
token: Token
salt: Vec<u8>
date: DateTime<Utc>
signature: String
hmac: Vec<u8>
version: Option<i8>
Implementations
sourceimpl Authorization
impl Authorization
sourcepub fn from(
method: String,
uri: String,
token: Token,
date: DateTime<Utc>,
payload: String,
salt: Option<Vec<u8>>,
version: Option<i8>
) -> Result<Self, Error>
pub fn from(
method: String,
uri: String,
token: Token,
date: DateTime<Utc>,
payload: String,
salt: Option<Vec<u8>>,
version: Option<i8>
) -> Result<Self, Error>
Generates an Authorization struct from the given parameters
sourcepub fn get_date_string(&self) -> String
pub fn get_date_string(&self) -> String
Returns the date as a string
sourcepub fn get_encoded_hmac(&self) -> String
pub fn get_encoded_hmac(&self) -> String
Returns the base64 encoded HMAC
sourcepub fn get_encoded_salt(&self) -> String
pub fn get_encoded_salt(&self) -> String
Returns the base64 encoded salt
sourcepub fn get_signature_string(&self) -> String
pub fn get_signature_string(&self) -> String
Returns the signature string
sourcepub fn get_time_drift(date: DateTime<Utc>) -> u32
pub fn get_time_drift(date: DateTime<Utc>) -> u32
Returns the time drift between the current time and the provided time
sourcepub fn verify(&self, hmac: Vec<u8>, drift_allowance: u32) -> bool
pub fn verify(&self, hmac: Vec<u8>, drift_allowance: u32) -> bool
Verifies whether or not a given HMAC is equal to the one on record This comparison occurs in constant time to avoid timing attack
sourcepub fn get_header(&self) -> String
pub fn get_header(&self) -> String
Returns the authorization header as a string
Trait Implementations
sourceimpl Clone for Authorization
impl Clone for Authorization
sourcefn clone(&self) -> Authorization
fn clone(&self) -> Authorization
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl RefUnwindSafe for Authorization
impl Send for Authorization
impl Sync for Authorization
impl Unpin for Authorization
impl UnwindSafe for Authorization
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more