Struct lite_session::LiteSessionToken[][src]

pub struct LiteSessionToken { /* fields omitted */ }

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]

Build the token with High Confidentiality

pub fn from_string(
    &mut self,
    server_key: &[u8],
    token: &str
) -> Result<(TokenOutcome, &Self), LiteSessionError>
[src]

Destructure and autheticate a token

pub fn immutable(&mut self) -> &Self[src]

Make a mutable LiteSessionToken immutable

Trait Implementations

impl Clone for LiteSessionToken[src]

impl Debug for LiteSessionToken[src]

impl Default for LiteSessionToken[src]

impl PartialEq<LiteSessionToken> for LiteSessionToken[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.