pub struct Identity {
pub aap_version: String,
pub id: String,
pub public_key: String,
pub parent: String,
pub scope: Vec<String>,
pub issued_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub revoked: bool,
pub metadata: HashMap<String, String>,
pub signature: String,
}Expand description
An AI agent’s cryptographic identity. Signed by a human supervisor.
Fields§
§aap_version: String§id: String§public_key: String§parent: String§scope: Vec<String>§issued_at: DateTime<Utc>§expires_at: Option<DateTime<Utc>>§revoked: bool§metadata: HashMap<String, String>§signature: StringImplementations§
Source§impl Identity
impl Identity
Sourcepub fn new(
id: &str,
scope: Vec<String>,
agent_kp: &KeyPair,
parent_kp: &KeyPair,
parent_did: &str,
) -> Result<Self>
pub fn new( id: &str, scope: Vec<String>, agent_kp: &KeyPair, parent_kp: &KeyPair, parent_did: &str, ) -> Result<Self>
Create and sign a new Identity.
parent_kp is the human supervisor’s keypair — they sign the agent’s identity.
Sourcepub fn allows_action(&self, action: &str) -> bool
pub fn allows_action(&self, action: &str) -> bool
Check if action is within this identity’s scope.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true if this identity has passed its expiry.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Identity
impl<'de> Deserialize<'de> for Identity
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 Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnsafeUnpin for Identity
impl UnwindSafe for Identity
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