Skip to main content

Crate aap_protocol

Crate aap_protocol 

Source
Expand description

§AAP — Agent Accountability Protocol

The accountability layer MCP and A2A don’t have.

use aap_protocol::{KeyPair, Identity, Authorization, Level, Provenance, AuditChain, AuditResult};

let supervisor = KeyPair::generate();
let agent      = KeyPair::generate();

let identity = Identity::new(
    "aap://acme/worker/bot@1.0.0",
    vec!["write:files".into()],
    &agent, &supervisor,
    "did:key:z6MkSupervisor",
)?;

let auth = Authorization::new(
    &identity.id,
    Level::Supervised,
    vec!["write:files".into()],
    false, // not physical
    &supervisor,
    "did:key:z6MkSupervisor",
)?;

assert!(auth.is_valid());

§Physical World Rule

let result = Authorization::new(
    "aap://factory/robot/arm@1.0.0",
    Level::Autonomous,   // Level 4
    vec!["move:arm".into()],
    true,                // physical = true
    &supervisor,
    "did:key:z6Mk",
);
assert!(matches!(result, Err(AAPError::PhysicalWorldViolation { .. })));

Structs§

AuditChain
Tamper-evident append-only audit log.
AuditEntry
A single tamper-evident entry in the audit chain.
Authorization
Authorization token granting an agent permission to act.
Identity
An AI agent’s cryptographic identity. Signed by a human supervisor.
KeyPair
An Ed25519 keypair for signing AAP documents.
Provenance
Provenance records the immutable origin of an agent-produced artifact.

Enums§

AAPError
All AAP errors implement this trait.
AuditResult
The result of an agent action.
Level
AAP authorization levels.

Functions§

sha256_of
Compute "sha256:<hex>" of data.
verify_signature
Verify an Ed25519 AAP signature.

Type Aliases§

Result