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 on native targets).
  • Service inboxes — bounded, TTL-aware FIFO queues (Inbox) for receiving validated messages on named protocol services.
  • Outbox sending — fire-and-forget delivery of validated Message objects to remote endpoints, serialized to CBOR on the wire (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 — enables Kubo RPC client for IPFS publishing (native only).
  • iroh — enables the iroh QUIC transport backend (IrohEndpoint, Channel, Outbox).
  • gossip — enables iroh-gossip broadcast helpers.
  • config — enables Config, SecretBundle, and MaArgs for YAML-based daemon configuration, encrypted secret bundles, and CLI argument parsing.

§Platform support

Core types (Inbox, Service, transport parsing, validation) compile on all targets including wasm32-unknown-unknown. Kubo/IPFS traffic requires a native target.

§wasm vs native

  • ma-core supports both wasm and native targets.
  • All IPFS-related APIs are native-only (not(wasm32) + kubo feature).
  • wasm builds do not expose the ipfs module or Kubo/IPFS helpers.
  • config serialization and SecretBundle crypto work on wasm.
  • config filesystem paths, CLI/env merging, and file I/O are native-only.
  • If your wasm application needs IPFS access, use a wasm-capable IPFS client in the application layer.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use acl::Acl;
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_DOC;
pub use service::CONTENT_TYPE_IPFS_REQUEST;
pub use service::CONTENT_TYPE_MESSAGE;
pub use service::INBOX_PROTOCOL;
pub use service::INBOX_PROTOCOL_ID;
pub use service::IPFS_PROTOCOL;
pub use inbox::Inbox;
pub use topic::topic_id;
pub use topic::Topic;
pub use topic::TopicId;
pub use endpoint::MaEndpoint;
pub use endpoint::DEFAULT_DELIVERY_PROTOCOL_ID;
pub use iroh::channel::Channel;
pub use iroh::IrohEndpoint;
pub use outbox::Outbox;
pub use iroh::gossip::broadcast_topic_id;
pub use iroh::gossip::gossip_send;
pub use iroh::gossip::gossip_send_text;
pub use iroh::gossip::join_broadcast_channel;
pub use iroh::gossip::join_gossip_topic;
pub use iroh::gossip::topic_id_for;
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 config::MaArgs;
pub use config::BrowserIdentityExport;
pub use config::Config;
pub use config::SecretBundle;
pub use resolve::DidResolver;
pub use resolve::GatewayResolver;
pub use interfaces::DidPublisher;
pub use interfaces::IpfsPublisher;
pub use ipfs::*;

Modules§

acl
Access control lists for ma identities and DID URLs.
config
Configuration for ma-core-based daemons.
endpoint
Endpoint trait.
error
Error types for ma-core.
identity
Secure secret key bootstrap helpers.
inbox
Service inbox — a bounded FIFO receive queue with per-message TTL.
interfaces
Trait interfaces for pluggable DID and IPFS publishing backends.
ipfs
Native-only Kubo/IPFS module.
iroh
Iroh transport backend.
outbox
Transport-agnostic send handle to a remote ma service.
presets
Presets allow configuring an endpoint quickly with a chosen set of defaults.
resolve
DID document resolution traits and implementations.
service
Service trait for ma endpoint protocol handlers.
topic
Gossip pub/sub topic primitive.
transport
Transport string parsing and endpoint resolution from DID documents.

Structs§

Connection
A QUIC connection.
Did
A parsed did:ma: identifier.
Document
A did:ma: DID document.
EncryptionKey
X25519 encryption key for envelope key agreement.
Endpoint
Controls an iroh endpoint, establishing connections with other endpoints.
EndpointAddr
Network-level addressing information for an iroh endpoint.
Headers
Signed message headers (without content body).
Message
A signed actor-to-actor message.
Proof
RecvStream
A stream that can only be used to receive data
RelayUrl
A URL identifying a relay server.
ReplayGuard
Sliding-window replay guard for message deduplication.
Router
The built router.
SecretKey
A secret key.
SendStream
A stream that can only be used to send data
SigningKey
Ed25519 signing key for document proofs and message signatures.
VerificationMethod

Enums§

AcceptError
MaError

Constants§

DEFAULT_MAX_CLOCK_SKEW_SECS
DEFAULT_MESSAGE_TTL_SECS
DEFAULT_REPLAY_WINDOW_SECS

Traits§

ProtocolHandler
Handler for incoming connections.

Type Aliases§

EndpointId
The identifier for an endpoint in the (iroh) network.