Skip to main content

ratify_protocol/
lib.rs

1//! Ratify Protocol v1 — Rust reference SDK.
2//!
3//! A cryptographic trust protocol for human-agent and agent-agent interactions
4//! as agents start to transact. Every signature is hybrid Ed25519 + ML-DSA-65
5//! (FIPS 204): quantum-safe by design.
6//!
7//! See docs/EXPLAINED.md and docs/AGENT_TO_AGENT.md in the repository for
8//! architecture, threat model, and agent-to-agent patterns.
9
10pub mod canonical;
11pub mod constraints;
12pub mod crypto;
13pub mod scope;
14pub mod types;
15pub mod verify;
16
17pub use canonical::{base64_std_decode, base64_std_encode, canonical_json, hex_decode, hex_encode};
18pub use crypto::{
19    chain_hash, challenge_sign_bytes, challenge_sign_bytes_with_session_context,
20    challenge_sign_bytes_with_stream, delegation_sign_bytes, derive_id, generate_agent,
21    generate_challenge, generate_human_root, generate_hybrid_keypair, issue_delegation,
22    issue_key_rotation_statement, issue_revocation_list, issue_revocation_push,
23    issue_session_token, issue_witness_entry, key_rotation_sign_bytes, revocation_push_sign_bytes,
24    revocation_sign_bytes, session_token_sign_bytes, sign_both, sign_challenge,
25    sign_challenge_with_session_context, sign_challenge_with_stream,
26    sign_transaction_receipt_party, transaction_receipt_sign_bytes, verify_both,
27    verify_challenge_signature, verify_challenge_signature_with_session_context,
28    verify_challenge_signature_with_stream, verify_delegation_signature,
29    verify_delegation_signature_e, verify_key_rotation_statement, verify_revocation_list,
30    verify_revocation_push, verify_session_token, verify_session_token_e, verify_witness_entry,
31    witness_entry_sign_bytes,
32};
33pub use scope::{
34    expand_scopes, has_scope, intersect_scopes, is_sensitive, validate_scopes, CUSTOM_SCOPE_PREFIX,
35    SCOPE_COMMS_CALENDAR_READ, SCOPE_COMMS_CALENDAR_WRITE, SCOPE_COMMS_EMAIL_DELETE,
36    SCOPE_COMMS_EMAIL_READ, SCOPE_COMMS_EMAIL_SEND, SCOPE_COMMS_MESSAGE_DELETE,
37    SCOPE_COMMS_MESSAGE_READ, SCOPE_COMMS_MESSAGE_SEND, SCOPE_CONTRACT_READ, SCOPE_CONTRACT_SIGN,
38    SCOPE_DATA_DELETE, SCOPE_DATA_EXPORT, SCOPE_DATA_READ, SCOPE_DATA_SHARE, SCOPE_DATA_WRITE,
39    SCOPE_EXECUTE_CODE, SCOPE_EXECUTE_TOOL, SCOPE_FILES_READ, SCOPE_FILES_WRITE,
40    SCOPE_GENERATE_CONTENT, SCOPE_GENERATE_DEEPFAKE, SCOPE_IDENTITY_DELEGATE, SCOPE_IDENTITY_PROVE,
41    SCOPE_MEETING_ATTEND, SCOPE_MEETING_CHAT, SCOPE_MEETING_RECORD, SCOPE_MEETING_SHARE_SCREEN,
42    SCOPE_MEETING_SPEAK, SCOPE_MEETING_VIDEO, SCOPE_PAYMENTS_AUTHORIZE, SCOPE_PAYMENTS_RECEIVE,
43    SCOPE_PAYMENTS_SEND, SCOPE_TRANSACT_PURCHASE, SCOPE_TRANSACT_SELL,
44};
45pub use types::{
46    AgentIdentity, Anchor, Constraint, DelegationCert, HumanRoot, HybridPrivateKey,
47    HybridPublicKey, HybridSignature, IdentityStatus, KeyRotationStatement, ProofBundle,
48    ReceiptParty, ReceiptPartySignature, RevocationList, RevocationPush, SessionToken,
49    StreamContext, TransactionReceipt, TransactionReceiptResult, VerifierContext, VerifyOptions,
50    VerifyResult, WitnessEntry, CHALLENGE_WINDOW_SECONDS, ED25519_PUBLIC_KEY_SIZE,
51    ED25519_SIGNATURE_SIZE, MAX_DELEGATION_CHAIN_DEPTH, MLDSA65_PUBLIC_KEY_SIZE,
52    MLDSA65_SIGNATURE_SIZE, PROTOCOL_VERSION,
53};
54pub use verify::{verify_bundle, verify_streamed_turn, verify_transaction_receipt};