A Rust library for DID- and message-oriented identity primitives used by the ma actor stack.
- DID parsing/validation (
did:ma:*) with root and fragment handling - DID document model (
Document,VerificationMethod,Proof,MaFields) - Signing/encryption key helpers (
SigningKey,EncryptionKey) using Ed25519 and X25519 - Multiformat encoding pipeline (multibase + multicodec) for public keys and signatures
- Envelope/message primitives with replay protection (
Message,Envelope,ReplayGuard) - Proof type:
MultiformatSignature2023(BLAKE3 + Ed25519 over CBOR-serialized documents) - Serialization helpers owned by the crate:
Document::marshal()/Document::unmarshal()for JSONDocument::to_cbor()/Document::from_cbor()for CBOR
src/constants.rs: method name, version, BLAKE3 labelssrc/did.rs: DID model and validationsrc/doc.rs: DID document, proof, and verification method modelsrc/error.rs: crate error typessrc/key.rs: key generation, multibase encoding, Ed25519/X25519 key typessrc/lib.rs: public exportssrc/msg.rs: message, headers, envelope, and replay guardsrc/multiformat.rs: multibase/multicodec encoding and decoding pipeline
Use the Makefile:
make build
make clean
make distcleanEquivalent cargo commands:
cargo build
cargo testAdd as dependency:
[dependencies]
ma-did = "0.1"Local path dependency during development:
[dependencies]
ma-did = { path = "../did" }Example flow:
- Create a root DID and method DIDs.
- Generate signing/encryption keys.
- Build a
Documentand add verification methods. - Sign document proof.
- Marshal/unmarshal via crate APIs.
- This is a library crate; consumer crates compile it transitively.
- Direct document formatting should remain inside
ma-didAPIs. - See ma-spec for the formal DID method specification intended for W3C registration.