Skip to main content

Crate dig_did

Crate dig_did 

Source
Expand description

§dig-did — the DIG Network canonical Chia DID expert crate

dig-did is a pure, key-free, network-free SpendBundle-builder for Chia Decentralized Identifiers (DIDs). It constructs the exact CoinSpends for every DID lifecycle operation and reports — via required_signatures — the exact signatures a caller must produce. It never holds a secret key, never signs, and never touches the network. The consumer signs the reported messages, assembles the SpendBundle, and broadcasts.

§Invariants

These four invariants hold across the entire crate and are the contract every unit is built to (SPEC §1):

  • INV-1 — No network. dig-did performs NO network or chain I/O. Every function is a pure transform of its inputs; the caller fetches coins and broadcasts bundles.
  • INV-2 — No keys. dig-did never accepts, holds, derives, or logs a secret key. It computes what must be signed (required_signatures); the caller’s signer produces the signatures.
  • INV-3 — Unsigned output. Every operation returns an unsigned DidSpend — coin spends plus the recreated child DID. Signatures are always the caller’s responsibility.
  • INV-4 — SDK byte-source-of-truth. Every puzzle, layer, and coin-spend byte is produced by chia-wallet-sdk (pinned to the 0.30 / chia-protocol 0.26 family). dig-did adds DID-workflow ergonomics on top; it never re-implements a puzzle or hand-rolls a spend bundle.

§Consumer pattern

build an unsigned DidSpend  ->  required_signatures(&spend.coin_spends, &constants)
  ->  caller signs each reported message  ->  assemble SpendBundle  ->  broadcast

§Status

This is the U1 foundation: the type surface, the error taxonomy, the inner-spend helpers, and the signing boundary. The DID operations (create, update, recovery, transfer, launch, melt, attest, hydrate, resolve, did:chia codec) land in their own units against this foundation; their modules are declared below as doc-only stubs so the layout is final.

Re-exports§

pub use error::DidError;
pub use error::DidResult;
pub use sign::required_signatures;
pub use types::DidSpend;
pub use types::Owner;

Modules§

attest
Announce-as-DID / attestation (SPEC §3, unit U8).
create
DID creation (SPEC §3, unit U2).
did_string
The did:chia:1… string codec (SPEC §2 & §9, unit U11).
error
The dig-did error taxonomy (SPEC §6).
hydrate
DID hydration from chain data (SPEC §3 & §5, unit U9).
launch
Launching other singletons authorized BY a DID (SPEC §3, unit U6).
melt
DID melt / termination (SPEC §3, unit U7).
recovery
DID recovery configuration & recovery spends (SPEC §3, unit U4).
resolve
DID resolution to a DID document / current owner (SPEC §3, unit U10).
sign
The signing boundary (SPEC §4) — the load-bearing custody guarantee of dig-did.
transfer
DID ownership transfer (SPEC §3, unit U5).
types
The public type surface of dig-did (SPEC §2).
update
DID metadata update & settle (SPEC §3, unit U3).

Structs§

AggSigConstants
Coin
CoinSpend
DidInfo
Information needed to construct the outer puzzle of a DID. It does not include the inner puzzle, which must be stored separately.
LineageProof

Enums§

Proof
RequiredSignature

Type Aliases§

Bytes32
Did
Contains all information needed to spend the outer puzzles of DID coins. The DidInfo is used to construct the puzzle, but the Proof is needed for the solution.