Skip to main content

Crate ratify_protocol

Crate ratify_protocol 

Source
Expand description

Ratify Protocol — Rust reference SDK (2.x line).

The v2 module is the Protocol v2 API. The crate-root items are the Protocol v1 API, retained so one dependency can verify both during the migration window; v1-only consumers stay on the 1.0.0-alpha.x releases.

Delegated-authority proofs for human-agent and agent-agent interactions. Every signature is a post-quantum hybrid of Ed25519 and ML-DSA-65 (NIST FIPS 204), and it verifies only when both components verify.

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.

Re-exports§

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

Modules§

canonical
Canonical JSON serialization per Ratify Protocol SPEC §6.
challenge_store
ChallengeStore — single-use tracking for verifier-issued challenges (SPEC §10).
constraints
Constraint evaluation — mirrors Go’s constraints.go exactly.
crypto
Ratify Protocol v1 — hybrid (Ed25519 + ML-DSA-65) crypto primitives.
crypto_v2
Protocol v2 delegation signature primitives.
operation_context
Operation-context and session-context canonical constructions (SPEC §6.4.9).
receipts
Receipts and verdicts — SPEC §17.5–§17.6.
resource_path
Resource-bound authority — the resource_path constraint’s path model, segment-boundary matching, and the extension-constraint params value model (SPEC §5.7.1, §5.7.3). Mirrors Go’s resource_path.go byte-for-byte.
scope
Canonical scope vocabulary for Ratify Protocol v1.
types
Ratify Protocol v1 types.
v2
Ratify Protocol v2 (SPEC-v2): strict wire codecs and canonical encodings for all nine signed object codes, typed hybrid signing, the status reducer and security journal, rotation journal, witness and receipt logs, transaction and verification receipts, the ordered live verifier, and the committed-outcome release path.
verify
Verify — the core verifier. Mirrors the Go reference verify.go exactly.
wire
Wire decoders and the VerificationReceipt codec pair (SPEC §17.5, §5.1).