ratify-protocol 1.0.0-alpha.19

Delegated-authority proofs for human-agent and agent-agent interactions — Rust reference SDK for the Ratify Protocol.
Documentation
//! Ratify Protocol v1 — Rust reference SDK.
//!
//! Delegated-authority proofs for human-agent and agent-agent interactions.
//! Every signature is hybrid Ed25519 + ML-DSA-65 (FIPS 204): quantum-safe
//! by design.
//!
//! See docs/EXPLAINED.md and docs/AGENT_TO_AGENT.md in the repository for
//! architecture, threat model, and agent-to-agent patterns.
//!
//! # `no_std` support
//!
//! Disable the default `std` feature to use this crate without the standard
//! library. An `alloc` crate is required. I/O, `SystemTime`, and `serde_json`
//! support are only available with `std`.

#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;

pub mod canonical;
pub mod challenge_store;
pub mod constraints;
pub mod operation_context;
pub mod crypto;
pub mod receipts;
pub mod resource_path;
pub mod scope;
pub mod types;
pub mod verify;
pub mod wire;

pub use canonical::{base64_std_decode, base64_std_encode, hex_decode, hex_encode};
#[cfg(feature = "std")]
pub use canonical::canonical_json;
pub use challenge_store::{ChallengeStore, UNKNOWN_CHALLENGE};
pub use operation_context::{
    build_session_context, operation_context_bytes, operation_context_hash,
    session_context_bytes, OperationContext, SessionContextInputs,
};
#[cfg(feature = "std")]
pub use challenge_store::MemoryChallengeStore;
pub use crypto::{
    chain_hash, challenge_sign_bytes, challenge_sign_bytes_with_session_context,
    challenge_sign_bytes_with_stream, delegation_sign_bytes, derive_id, generate_challenge,
    generate_hybrid_keypair, hybrid_keypair_from_seeds, issue_delegation, issue_key_rotation_statement, issue_revocation_list,
    issue_revocation_push, issue_session_token, issue_witness_entry, key_rotation_sign_bytes,
    revocation_push_sign_bytes, revocation_sign_bytes, session_token_sign_bytes, sign_both,
    sign_challenge, sign_challenge_with_session_context, sign_challenge_with_stream,
    sign_transaction_receipt_party, transaction_receipt_sign_bytes, verify_both,
    verify_challenge_signature, verify_challenge_signature_with_session_context,
    verify_challenge_signature_with_stream, verify_delegation_signature,
    verify_delegation_signature_e, verify_key_rotation_statement, verify_revocation_list,
    verify_revocation_push, verify_session_token, verify_session_token_e, verify_witness_entry,
    witness_entry_sign_bytes,
};
#[cfg(feature = "std")]
pub use crypto::{generate_agent, generate_human_root};
pub use scope::{
    expand_scopes, has_scope, intersect_scopes, is_sensitive, scope_wildcards, validate_scopes,
    vocabulary, CUSTOM_SCOPE_PREFIX,
    SCOPE_COMMS_CALENDAR_READ, SCOPE_COMMS_CALENDAR_WRITE, SCOPE_COMMS_EMAIL_DELETE,
    SCOPE_COMMS_EMAIL_READ, SCOPE_COMMS_EMAIL_SEND, SCOPE_COMMS_MESSAGE_DELETE,
    SCOPE_COMMS_MESSAGE_READ, SCOPE_COMMS_MESSAGE_SEND, SCOPE_CONTRACT_READ, SCOPE_CONTRACT_SIGN,
    SCOPE_DATA_DELETE, SCOPE_DATA_EXPORT, SCOPE_DATA_READ, SCOPE_DATA_SHARE, SCOPE_DATA_WRITE,
    SCOPE_EXECUTE_CODE, SCOPE_EXECUTE_TOOL, SCOPE_FILES_READ, SCOPE_FILES_WRITE,
    SCOPE_GENERATE_CONTENT, SCOPE_GENERATE_DEEPFAKE, SCOPE_IDENTITY_DELEGATE, SCOPE_IDENTITY_PROVE,
    SCOPE_MEETING_ATTEND, SCOPE_MEETING_CHAT, SCOPE_MEETING_RECORD, SCOPE_MEETING_SHARE_SCREEN,
    SCOPE_MEETING_SPEAK, SCOPE_MEETING_VIDEO, SCOPE_PAYMENTS_AUTHORIZE, SCOPE_PAYMENTS_RECEIVE,
    SCOPE_PAYMENTS_SEND, SCOPE_PRESENCE_REPRESENT, SCOPE_TRANSACT_PURCHASE, SCOPE_TRANSACT_SELL,
};
pub use receipts::{
    bundle_hash, issue_policy_verdict, issue_verification_receipt,
    policy_verdict_sign_bytes_buf, receipt_hash, verification_receipt_sign_bytes_buf,
    verifier_context_hash, verify_policy_verdict, verify_verification_receipt,
};
pub use resource_path::{
    normalize_resource_path, resource_path_matches, validate_constraint_params,
    validate_params_value, validate_resource_constraints,
};
pub use wire::{
    check_json_nesting_depth, check_receipt_structure, encode_verification_receipt,
};
#[cfg(feature = "std")]
pub use wire::{decode_delegation_cert, decode_proof_bundle, decode_verification_receipt};
pub use types::{
    is_canonical_constraint_type, AgentIdentity, Anchor, AnchorResolver, AuditProvider, Constraint,
    ConstraintEvaluator, DelegationCert, HumanRoot, HybridPrivateKey, HybridPublicKey,
    HybridSignature, IdentityStatus, KeyRotationStatement, ParamsValue, PolicyProvider,
    PolicyVerdict, ProofBundle, ReceiptParty, ReceiptPartySignature, RevocationList,
    RevocationProvider, RevocationPush, SessionToken, StreamContext, TransactionReceipt,
    TransactionReceiptResult, VerificationReceipt, InvocationCounter, VerifierContext,
    VerifyOptions, VerifyResult, WitnessEntry, CHALLENGE_WINDOW_SECONDS, ED25519_PUBLIC_KEY_SIZE,
    ED25519_SIGNATURE_SIZE, MAX_AGENT_NAME_LENGTH_BYTES, MAX_CONSTRAINTS_PER_CERT,
    MAX_DELEGATION_CHAIN_DEPTH, MAX_IDENTIFIER_LENGTH_BYTES, MAX_JSON_NESTING_DEPTH,
    MAX_PROOF_BUNDLE_BYTES, MAX_SCOPES_PER_CERT, MAX_SCOPE_LENGTH_BYTES, MLDSA65_PUBLIC_KEY_SIZE,
    MLDSA65_SIGNATURE_SIZE, NO_EXPIRY_SENTINEL, PROTOCOL_VERSION,
};
#[allow(deprecated)]
pub use verify::verify_streamed_turn;
pub use verify::{
    verify_bundle, verify_streamed_turn_with_options, verify_transaction_receipt, StreamedTurn,
    StreamedVerifyOptions,
};