OpenAgentID documentation
Source referencesRust module referencearsenal-core

arsenal-core · identity

Declared module signatures, types, configuration, and source documentation.

Source: arsenal/crates/arsenal-core/src/identity.rs. SHA-256: ca80b7b23505b8d44b0fac716fa7e24e1f8ae1e1cdba46ec112dccb14014b8ea.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

identity::TenantId

Tenant identifier - represents an organization or customer

#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct TenantId(String);

Source line: 21.

identity::TenantId::new

Create a new tenant ID with validation

Errors

Returns an error if the ID is empty, too long, or contains invalid characters

pub fn new(id: impl Into<String>) -> ArsenalResult<Self>;

Source line: 28.

identity::TenantId::generate

Create a new random tenant ID

#[must_use]
pub fn generate() -> Self;

Source line: 36.

identity::TenantId::as_str

Get the inner string value

#[must_use]
pub fn as_str(&self) -> &str;

Source line: 42.

identity::PrincipalId

Principal identifier - represents a user, service account, or system principal

#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PrincipalId(String);

Source line: 101.

identity::PrincipalId::new

Create a new principal ID with validation

Errors

Returns an error if the ID is empty, too long, or contains invalid characters

pub fn new(id: impl Into<String>) -> ArsenalResult<Self>;

Source line: 108.

identity::PrincipalId::generate

Create a new random principal ID

#[must_use]
pub fn generate() -> Self;

Source line: 116.

identity::PrincipalId::system

Create a system principal

#[must_use]
pub fn system() -> Self;

Source line: 122.

identity::PrincipalId::is_system

Check if this is the system principal

#[must_use]
pub fn is_system(&self) -> bool;

Source line: 128.

identity::PrincipalId::as_str

Get the inner string value

#[must_use]
pub fn as_str(&self) -> &str;

Source line: 134.

identity::AgentIdentity

Agent identity - the cryptographic identity of an agent

This contains the agent's public key fingerprint and associated metadata. The actual private key is never stored here - only the public identity.

Two identifiers, two purposes

[AgentIdentity::did] is the agent's identity: an OAS DID, assigned by OAS genesis under a human or organizational root, resolvable by any party, and the value that appears as sub in a capability token. Arsenal does not mint DIDs; it requires one as input, because a capability granted to an identity nobody can resolve is not auditable.

[AgentIdentity::id] is a local surrogate key. It orders records and keys storage rows. It is deliberately never used as the subject of a token.

#[derive(Clone, Serialize, Deserialize)]
pub struct AgentIdentity {

}

Source line: 204.

identity::AgentIdentity::new

Create a new agent identity

did must be an OAS DID of kind agent. Arsenal issues capability tokens to agents, so a DID naming a human root, an organization, or a tool is rejected here rather than producing a token whose subject cannot exercise it.

Errors

Returns an error if the name length is invalid, or if did is not of entity kind agent.

pub fn new(
        did: OasDid,
        tenant_id: TenantId,
        name: impl Into<String>,
        public_key_fingerprint: KeyFingerprint,
    ) -> ArsenalResult<Self>;

Source line: 237.

identity::AgentIdentity::did

Get the agent's OAS DID

This is the identity to use as a token subject or in an audit record.

#[must_use]
pub fn did(&self) -> &OasDid;

Source line: 272.

identity::AgentIdentity::id

Get the local surrogate key

For storage and ordering only. Use [AgentIdentity::did] when naming this agent to anything outside Arsenal.

#[must_use]
pub fn id(&self) -> &AgentId;

Source line: 281.

identity::AgentIdentity::public_key_fingerprint

Get the public key fingerprint

#[must_use]
pub fn public_key_fingerprint(&self) -> &KeyFingerprint;

Source line: 287.

identity::AgentIdentity::tenant_id

Get the tenant ID

#[must_use]
pub fn tenant_id(&self) -> &TenantId;

Source line: 293.

identity::AgentIdentity::name

Get the agent name

#[must_use]
pub fn name(&self) -> &str;

Source line: 299.

identity::AgentIdentity::is_valid

Check if the agent is currently valid (active and not expired)

#[must_use]
pub fn is_valid(&self) -> bool;

Source line: 305.

identity::AgentIdentity::is_active

Check if the agent is active

#[must_use]
pub fn is_active(&self) -> bool;

Source line: 319.

identity::AgentIdentity::deactivate

Deactivate this agent

pub fn deactivate(&mut self);

Source line: 324.

identity::AgentIdentity::set_expires_at

Set expiration time

pub fn set_expires_at(&mut self, expires_at: chrono::DateTime<chrono::Utc>);

Source line: 329.

identity::AgentIdentity::add_tag

Add a tag

pub fn add_tag(&mut self, tag: impl Into<String>);

Source line: 334.

identity::AgentIdentity::tags

Get tags

#[must_use]
pub fn tags(&self) -> &[String];

Source line: 343.

identity::AgentId

Agent identifier

#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AgentId(Uuid);

Source line: 362.

identity::AgentId::from_uuid

Create a new agent ID from a UUID

#[must_use]
pub const fn from_uuid(uuid: Uuid) -> Self;

Source line: 367.

identity::AgentId::generate

Generate a new random agent ID

#[must_use]
pub fn generate() -> Self;

Source line: 373.

identity::AgentId::as_uuid

Get the inner UUID

#[must_use]
pub const fn as_uuid(&self) -> &Uuid;

Source line: 379.

identity::KeyFingerprint

Public key fingerprint - BLAKE3 hash of the public key bytes

#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Zeroize)]
#[zeroize(drop)]
pub struct KeyFingerprint([u8; 32]);

Source line: 409.

identity::KeyFingerprint::from_bytes

Create a fingerprint from raw bytes

#[must_use]
pub const fn from_bytes(bytes: [u8; 32]) -> Self;

Source line: 414.

identity::KeyFingerprint::from_public_key

Create a fingerprint from a public key

#[must_use]
pub fn from_public_key(public_key: &[u8]) -> Self;

Source line: 420.

identity::KeyFingerprint::as_bytes

Get the raw bytes

#[must_use]
pub const fn as_bytes(&self) -> &[u8; 32];

Source line: 427.

identity::KeyFingerprint::to_hex

Encode as hex string

#[must_use]
pub fn to_hex(&self) -> String;

Source line: 433.

identity::KeyFingerprint::from_hex

Parse from hex string

Errors

Returns an error if the hex string is invalid

pub fn from_hex(hex_str: &str) -> ArsenalResult<Self>;

Source line: 441.

identity::KeyFingerprint::ct_eq

Constant-time comparison

#[must_use]
pub fn ct_eq(&self, other: &Self) -> bool;

Source line: 457.

identity::DeviceId

Device identifier for device binding

#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct DeviceId(String);

Source line: 482.

identity::DeviceId::new

Create a new device ID

Errors

Returns an error if validation fails

pub fn new(id: impl Into<String>) -> ArsenalResult<Self>;

Source line: 489.

identity::DeviceId::as_str

Get the inner string

#[must_use]
pub fn as_str(&self) -> &str;

Source line: 511.

On this page