anp
Rust SDK for the Agent Network Protocol (ANP).
This crate provides the core Rust implementation for DID WBA authentication, proof generation and verification, strict Appendix-B object proof helpers, and WNS helpers used by ANP-compatible agents and services.
Installation
Features
- DID WBA document creation and verification
- HTTP authentication helpers
- Proof generation and verification
- Appendix-B object proof helpers for
group_receipt,prekey_bundle, anddid_wba_binding - RFC 9421 origin proof helpers for ANP request objects
- WNS models, validation, and resolver helpers
anp::group_e2ee::operationsone-shot group E2EE APIs for ANP-P6 real OpenMLS KeyPackage generation, group create/add/remove prepare, local leave terminal-state handling, commit notice processing, pending commit finalize/abort, welcome processing, message encrypt/decrypt, and local status operations. MLS state is kept behindanp::group_e2ee::storagestore implementations rather than a subprocess or CLI JSON command surface.
Compatibility Notes
create_did_wba_document_with_key_bindingis deprecated. Usecreate_did_wba_documentwithDidDocumentOptions::with_profile(DidProfile::K1)when you need ak1_DID.- Group MLS operations are library calls, not
anp-mlssubprocess calls. UseCompatDataDirStorefor the legacystate.dblayout orImCoreSqliteGroupMlsStorefor owner/device-scoped MLS state managed from an im-core local-state root. - MLS private material, KeyPackage state, group bindings, pending commits, and OpenMLS
persistence stay local to the selected
GroupMlsStoreand are not emitted to service-facing P6 payloads. - Message encrypt/decrypt rejects incoming group-state or cipher claims whose
crypto_group_id_b64u/openmls_group_id_b64uor epoch does not match the local SQLite group binding before invoking OpenMLS. - Decrypted plaintext is returned only as the typed
DecryptOutputfor the active library call; callers must not persist plaintext in diagnostics or operation logs. remove_member_preparecreates a durable OpenMLS pending commit and returns opaque commit, ratchet-tree/group-info-compatible public artifacts, from/to epochs, andpending_commit_id; local epoch remains unchanged untilfinalize_commit, whileabort_commitclears the pending commit after deterministic service rejection.leave_preparerecords a local terminal pending artifact because OpenMLS 0.8 rejects same-member self-remove commits; finalizing it marks the local bindingleftwithout advancing the local epoch. PR-B1 service/CLI integrations should use the hiddengroup.e2ee.leave_requestcontrol plane and process it through an authorized epoch-advancing remove commit for remaining members.
Message Payload Notes
Plain text, ordinary JSON, and attachments use the same ANP message operations
defined by the protocol profiles. This crate does not add separate REST APIs or
high-level base-message senders for JSON. If a product constructs direct.send or
group.send requests for text/plain at the application layer, it should construct
ordinary JSON messages at the same layer by setting meta.content_type to
application/json and placing the JSON object directly in body.payload.
For Direct E2EE, use the existing plaintext model:
use ApplicationPlaintext;
use json;
let plaintext = new_json;
The SDK treats the JSON object as an opaque application payload; command, status, task, result, or other business meanings are defined by the caller above the ANP SDK layer.