pub struct Authorization {
pub aap_version: String,
pub agent_id: String,
pub level: u8,
pub level_name: String,
pub scope: Vec<String>,
pub physical: bool,
pub granted_by: String,
pub granted_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub session_id: String,
pub signature: String,
/* private fields */
}Expand description
Authorization token granting an agent permission to act.
Fields§
§aap_version: String§agent_id: String§level: u8§level_name: String§scope: Vec<String>§physical: bool§granted_by: String§granted_at: DateTime<Utc>§expires_at: Option<DateTime<Utc>>§session_id: String§signature: StringImplementations§
Source§impl Authorization
impl Authorization
Sourcepub fn new(
agent_id: &str,
level: Level,
scope: Vec<String>,
physical: bool,
supervisor_kp: &KeyPair,
supervisor_did: &str,
) -> Result<Self>
pub fn new( agent_id: &str, level: Level, scope: Vec<String>, physical: bool, supervisor_kp: &KeyPair, supervisor_did: &str, ) -> Result<Self>
Create and sign a new Authorization.
Enforces the Physical World Rule — returns Err(PhysicalWorldViolation) if violated.
pub fn revoke(&mut self)
pub fn is_revoked(&self) -> bool
pub fn is_expired(&self) -> bool
pub fn is_valid(&self) -> bool
pub fn check(&self) -> Result<()>
pub fn verify(&self, supervisor_public_key_b64: &str) -> Result<()>
Trait Implementations§
Source§impl Clone for Authorization
impl Clone for Authorization
Source§fn clone(&self) -> Authorization
fn clone(&self) -> Authorization
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 Authorization
impl Debug for Authorization
Source§impl<'de> Deserialize<'de> for Authorization
impl<'de> Deserialize<'de> for Authorization
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 Authorization
impl RefUnwindSafe for Authorization
impl Send for Authorization
impl Sync for Authorization
impl Unpin for Authorization
impl UnsafeUnpin for Authorization
impl UnwindSafe for Authorization
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