diff --git a/Cargo.toml b/Cargo.toml index 85c6706..961a203 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "icarus-models" description = "models used for the icarus project" license = "MIT" -version = "0.1.0" +version = "0.1.1" edition = "2024" [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 0a704dc..e3bcb75 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ pub mod access_level; pub mod login_result; +pub mod token; pub mod user; pub fn add(left: u64, right: u64) -> u64 { diff --git a/src/token.rs b/src/token.rs new file mode 100644 index 0000000..fde3d9a --- /dev/null +++ b/src/token.rs @@ -0,0 +1,40 @@ +use std::default::Default; + +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Token { + pub scope: String, + pub expiration: i32, + pub audience: String, + pub issuer: String, + pub issued: i32, +} + +impl Default for Token { + fn default() -> Self { + Token { + scope: String::new(), + expiration: -1, + audience: String::new(), + issuer: String::new(), + issued: -1, + } + } +} + +impl Token { + pub fn _to_json(&self) -> Result { + return serde_json::to_string_pretty(&self); + } + + // TODO: Implement + pub fn token_expired(&self) -> bool { + return false; + } + + // TODO: Implement + pub fn contains_scope(&self, des_scope: String) -> bool { + return false; + } +}