Skip to main content

Crate ma_core

Crate ma_core 

Source
Expand description

§ma-core

A lean DIDComm service library for the ma ecosystem.

ma-core provides the building blocks for ma-capable endpoints:

  • DID documents — create, validate, resolve, and publish did:ma: documents to IPFS/IPNS (via Kubo or custom backends).
  • Service inboxes — bounded, TTL-aware FIFO queues (Inbox / TtlQueue) for receiving messages on named protocol services.
  • Outbox sending — fire-and-forget delivery to remote endpoints on any registered protocol ([Outbox]).
  • Endpoint abstraction — the MaEndpoint trait with an iroh-backed implementation ([IrohEndpoint], behind the iroh feature).
  • Transport parsing — extract endpoint IDs and protocols from DID document service strings (/iroh/<id>/<protocol>).
  • Identity bootstrap — secure secret key generation and persistence.

§Services

Every endpoint must provide ma/inbox/0.0.1 (the default inbox). Endpoints may optionally provide ma/ipfs/0.0.1 to publish DID documents on behalf of others.

§Feature flags

  • kubo (default) — enables Kubo RPC client for IPFS publishing.
  • iroh — enables the iroh QUIC transport backend ([IrohEndpoint], [Channel], [Outbox]).

§Platform support

Core types (Inbox, TtlQueue, Service, transport parsing, validation) compile on all targets including wasm32-unknown-unknown. Kubo, DID resolution, and iroh require a native target.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use service::Service;
pub use service::BROADCAST_PROTOCOL;
pub use service::BROADCAST_TOPIC;
pub use service::CONTENT_TYPE_BROADCAST;
pub use service::CONTENT_TYPE_CHAT;
pub use service::CONTENT_TYPE_EVENT;
pub use service::CONTENT_TYPE_MESSAGE;
pub use service::CONTENT_TYPE_PRESENCE;
pub use service::CONTENT_TYPE_WHISPER;
pub use service::CONTENT_TYPE_WORLD;
pub use service::DEFAULT_CONTENT_TYPE;
pub use service::INBOX_PROTOCOL;
pub use service::IPFS_PROTOCOL;
pub use ttl_queue::TtlQueue;
pub use inbox::Inbox;
pub use endpoint::MaEndpoint;
pub use endpoint::DEFAULT_DELIVERY_PROTOCOL_ID;
pub use transport::endpoint_id_from_transport;
pub use transport::endpoint_id_from_transport_value;
pub use transport::normalize_endpoint_id;
pub use transport::protocol_from_transport;
pub use transport::resolve_endpoint_for_protocol;
pub use transport::resolve_inbox_endpoint_id;
pub use transport::transport_string;
pub use identity::generate_secret_key_file;
pub use identity::load_secret_key_bytes;
pub use identity::socket_addr_to_multiaddr;
pub use resolve::DidResolver;
pub use resolve::GatewayResolver;
pub use interfaces::DidPublisher;
pub use interfaces::IpfsPublisher;
pub use ipfs_publish::KuboDidPublisher;
pub use ipfs_publish::handle_ipfs_publish;
pub use ipfs_publish::publish_did_document_to_kubo;
pub use ipfs_publish::validate_ipfs_publish_request;
pub use ipfs_publish::IpfsPublishDidRequest;
pub use ipfs_publish::IpfsPublishDidResponse;
pub use ipfs_publish::ValidatedIpfsPublish;
pub use ipfs_publish::CONTENT_TYPE_DOC;
pub use kubo::KuboKey;
pub use pinning::pin_update_add_rm;
pub use pinning::PinUpdateOutcome;

Modules§

endpoint
Endpoint trait.
error
Error types for ma-core.
identity
Secure secret key bootstrap helpers.
inbox
Service inbox — a bounded FIFO receive queue with a default TTL.
interfaces
Trait interfaces for pluggable DID and IPFS publishing backends.
ipfs_publish
DID document publishing to IPFS/IPNS.
kubo
Kubo RPC client for IPFS operations.
pinning
Safe pin lifecycle management.
resolve
DID document resolution traits and implementations.
service
Service trait for ma endpoint protocol handlers.
transport
Transport string parsing and endpoint resolution from DID documents.
ttl_queue
A bounded FIFO queue with per-item TTL and lazy eviction.

Structs§

Did
A parsed did:ma: identifier.
Document
A did:ma: DID document.
EncryptionKey
X25519 encryption key for envelope key agreement.
Headers
Signed message headers (without content body).
Message
A signed actor-to-actor message.
Proof
ReplayGuard
Sliding-window replay guard for message deduplication.
SigningKey
Ed25519 signing key for document proofs and message signatures.
VerificationMethod

Enums§

MaError

Constants§

DEFAULT_MAX_CLOCK_SKEW_SECS
DEFAULT_MESSAGE_TTL_SECS
DEFAULT_REPLAY_WINDOW_SECS