1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! The public type surface of `dig-did` (SPEC §2).
//!
//! Two kinds of types live here: the DID/coin types re-exported verbatim from chia-wallet-sdk (the
//! byte-source-of-truth, INV-4 — this crate never re-defines a puzzle-carrying type), and the small
//! `dig-did`-owned types that describe an *unsigned* operation result ([`DidSpend`]) and *who* is
//! authorized to spend a DID ([`Owner`]).
use Spend;
use PublicKey;
// Re-exported from chia-wallet-sdk so consumers of dig-did never need a direct SDK dependency to
// name the DID it produces. These are the canonical Chia types — dig-did adds no shadow copy.
pub use ;
pub use ;
pub use ;
/// The result of building a DID operation: the unsigned coin spends plus the recreated child DID.
///
/// This is the crate's output contract (INV-3). A `DidSpend` carries NO signature — the consumer
/// feeds `coin_spends` to [`crate::required_signatures`], signs the reported messages, assembles a
/// `SpendBundle`, and broadcasts. `child` is the DID as it will exist AFTER the spend confirms
/// (`None` for a terminal operation such as a melt, which leaves no DID successor).
/// Who is authorized to spend a DID — i.e. the p2 ("inner") puzzle that guards it.
///
/// Every DID operation is authorized by spending the DID's inner puzzle. `Owner` lets a caller pick
/// that inner puzzle without dig-did hard-coding one:
///
/// - [`Owner::Standard`] is the common case — the standard single-key p2 puzzle. dig-did builds the
/// `StandardLayer` for you; the resulting spend requires one `AGG_SIG_ME` over the given key.
/// - [`Owner::Custom`] is the escape hatch — the caller supplies an already-built inner [`Spend`]
/// (any p2 puzzle: a custom vault, a multisig, a delegated puzzle). dig-did passes it through
/// unchanged, so the caller owns its signature requirements.
///
/// **Operations that add conditions of their own** (`create_did`, `create_simple_did`,
/// `create_eve_did_only`, `spend_did_with_conditions`) require [`Owner::Standard`] and return
/// [`DidError::UnsupportedOwner`] for [`Owner::Custom`]. A pre-built inner spend emits one fixed
/// condition set and cannot carry the launcher or recreation conditions computed inside those calls.
/// See SPEC §2.4.