ratify-protocol (Rust)
Rust reference SDK for the Ratify Protocol v1 — a cryptographic trust protocol for human-agent and agent-agent interactions as agents start to transact.
Quantum-safe by design: every signature is hybrid Ed25519 + ML-DSA-65 (NIST FIPS 204). Both must verify.
Byte-identical interoperability with the Go, TypeScript, and Python reference implementations. Validated against the 59 canonical test vectors on every CI run.
What is Ratify Protocol?
Ratify is an open cryptographic protocol that answers the question: "Is this AI agent authorized to act, by whom, for what, and under what constraints?"
A human issues a signed delegation cert to an agent. The agent presents a proof bundle when acting. Any third party can verify the proof — offline, without contacting a server — and get a cryptographically certain answer.
- Full protocol spec: SPEC.md
- Explainer (how it works, threat model): docs/EXPLAINED.md
- Developer docs: docs.identities.ai
Install
[]
= "1.0.0-alpha.9"
Quickstart
use ;
use ;
Key custody
The protocol supports three key-custody modes with different trust tradeoffs. See SPEC.md §15.2 for the full model.
Self-custody (strongest)
The user generates and holds their own keypair. No third party can sign on their behalf.
use ;
// User generates keypair on their own device — private key never leaves
let = generate_human_root;
// User signs delegations locally
issue_delegation;
// Only root.id and root.public_key are shared with registries
Custodial
A registry operator generates and stores the keypair server-side (envelope-encrypted with KMS). The user never touches keys directly. The operator calls the same SDK functions on the user's behalf.
Self-custody upgrade
A user who started in custodial mode can migrate to self-custody at any time using KeyRotationStatement:
use ;
// User generates a NEW keypair on their device
let = generate_human_root;
// Rotation statement signed by BOTH old (custodial) and new (device) keys
let mut stmt = KeyRotationStatement ;
issue_key_rotation_statement;
// From now on, only the user's device key can sign delegations.
// Auditors verify continuity via the rotation statement.
Scope vocabulary
Ratify v1 ships 52 canonical scopes across fourteen domains, plus a custom: extension pattern for application-specific scopes. See SPEC.md §9 for the full table including sensitivity flags and wildcard expansions.
For app-specific needs not covered by the canonical vocabulary, use the custom: prefix:
use ;
assert!;
Custom scopes pass through expand_scopes unchanged and are non-sensitive by default.
Running the conformance tests
The suite loads every fixture from the canonical test vectors and runs it through the Rust implementation. All 59 must pass; any failure means this SDK has drifted from the Go reference.
License
Apache-2.0. See the project-level LICENSE.