Struct lite_session::LiteSessionToken [−][src]
The token strucuture that performs token operations
use tai64::TAI64N; use lite_session::{LiteSessionData, ConfidentialityMode, LiteSessionMode}; use blake3::Hash; pub struct LiteSessionToken { identifier: String, issued: TAI64N, expiry: TAI64N, hmac_data: LiteSessionData, confidentiality: ConfidentialityMode, hmac: blake3::Hash, mode: LiteSessionMode, }
Implementations
impl LiteSessionToken
[src]
pub fn identifier(&mut self, identifier: &str) -> &mut Self
[src]
Add an custom identifier for the token
pub fn expiry(&mut self, expiry_in_secs: u64) -> &mut Self
[src]
Add a custom expiry time for the token. Default exipry is 24 hours
pub fn hmac_data(&mut self, data: LiteSessionData) -> &mut Self
[src]
The data contained here describes the token and its capabilities
as provided by LiteSessionData
struct
pub fn confidential(&mut self, bool_choice: bool) -> &mut Self
[src]
Choose the security mode. Choosing true
makes the token authenticate
in high confidentiality mode by setting the field to ConfidentialityMode::High
setting it to false sets the security mode to ConfidentialityMode::Low
pub fn mode(&mut self, mode: LiteSessionMode) -> &mut Self
[src]
Set the session mode to either use a SessionID
or not
pub fn build_secure(
&mut self,
server_key: &[u8]
) -> Result<String, LiteSessionError>
[src]
&mut self,
server_key: &[u8]
) -> Result<String, LiteSessionError>
Build the token with High Confidentiality
pub fn from_string(
&mut self,
server_key: &[u8],
token: &str
) -> Result<(TokenOutcome, &Self), LiteSessionError>
[src]
&mut self,
server_key: &[u8],
token: &str
) -> Result<(TokenOutcome, &Self), LiteSessionError>
Destructure and autheticate a token
pub fn immutable(&mut self) -> &Self
[src]
Make a mutable LiteSessionToken
immutable
Trait Implementations
impl Clone for LiteSessionToken
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for LiteSessionToken
[src]
impl Default for LiteSessionToken
[src]
impl PartialEq<LiteSessionToken> for LiteSessionToken
[src]
Auto Trait Implementations
impl RefUnwindSafe for LiteSessionToken
[src]
impl Send for LiteSessionToken
[src]
impl Sync for LiteSessionToken
[src]
impl Unpin for LiteSessionToken
[src]
impl UnwindSafe for LiteSessionToken
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,