@hazbase/simplicity 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -6
- package/dist/docs/definitions/strict-verifier-confidential-v1.simf +265 -0
- package/dist/domain/damp.d.ts +3 -1
- package/dist/domain/damp.js +17 -10
- package/dist/domain/dampPolicy.d.ts +39 -2
- package/dist/domain/dampPolicy.js +63 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ It is intentionally narrower than a full market stack. It does **not** try to be
|
|
|
12
12
|
|
|
13
13
|
This SDK is designed to help Node developers get productive quickly, but it is still opinionated, early-stage, and best suited today to permissioned settlement pilots on Liquid.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Strict policy lifecycle
|
|
16
16
|
|
|
17
17
|
This release extends strict-policy positions from ordinary transfers to a
|
|
18
18
|
complete controlled lifecycle:
|
|
@@ -24,7 +24,7 @@ complete controlled lifecycle:
|
|
|
24
24
|
- browser wallets can provide their own audited crypto implementation before
|
|
25
25
|
any strict-policy helper loads, avoiding extension CSP violations.
|
|
26
26
|
|
|
27
|
-
For policy-locked redemptions, Liquid x402
|
|
27
|
+
For policy-locked redemptions, Liquid x402 binds a wallet-created holder
|
|
28
28
|
signature for the locally recomputed transaction hash into the payment payload.
|
|
29
29
|
|
|
30
30
|
## What You Can Build
|
|
@@ -112,6 +112,7 @@ import {
|
|
|
112
112
|
buildStrictPolicyWhitelist,
|
|
113
113
|
deriveStrictPolicyHolderPosition,
|
|
114
114
|
inspectStrictPolicyTransactionWithProofs,
|
|
115
|
+
normalizeStrictPolicyVerifierCovenantParams,
|
|
115
116
|
prepareStrictPolicySnapshot,
|
|
116
117
|
verifyStrictPolicySnapshot,
|
|
117
118
|
} from "@hazbase/simplicity";
|
|
@@ -170,10 +171,43 @@ output zero and exposes three mutually exclusive paths:
|
|
|
170
171
|
- governance: the authority signs a verifier-only transition to a reviewed
|
|
171
172
|
successor contract, without moving any strict asset.
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
`
|
|
176
|
-
|
|
174
|
+
### Verifier resource profiles
|
|
175
|
+
|
|
176
|
+
`strict_v2` is the default profile for the general strict-policy lifecycle. It
|
|
177
|
+
permits up to 16 transaction inputs, 8 outputs, and a 256-owner whitelist;
|
|
178
|
+
larger transactions fail closed.
|
|
179
|
+
|
|
180
|
+
`strict_v2_compact` is an explicit, tightly bounded profile for a controlled
|
|
181
|
+
two-owner lifecycle, such as issuer inventory to an approved holder. It permits
|
|
182
|
+
at most 3 inputs, 4 outputs, and 2 whitelist owners. It retains the complete
|
|
183
|
+
holder signature and whitelist checks while making the verifier witness small
|
|
184
|
+
enough for the bounded transaction shape. Do not use it for a secondary market,
|
|
185
|
+
additional intermediaries, or transactions that need more inputs, outputs, or
|
|
186
|
+
approved holders.
|
|
187
|
+
|
|
188
|
+
`strict_v2_confidential` is a separate verifier profile for Atomic DvP
|
|
189
|
+
purchases. It keeps the protected RWA inputs and outputs explicit, while the
|
|
190
|
+
single treasury-payment output at index 2 uses standard Liquid confidentiality.
|
|
191
|
+
The verifier still checks strict-asset conservation and rejects confidential
|
|
192
|
+
strict outputs. A wallet must inspect the complete explicit proposal first,
|
|
193
|
+
blind only that fixed payment output locally, and sign the resulting PSET. The
|
|
194
|
+
treasury then independently unblinds and checks the payment before service
|
|
195
|
+
finalization. Existing `strict_v2` and `strict_v2_compact` positions are not
|
|
196
|
+
changed or reinterpreted by this profile.
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
const verifier = normalizeStrictPolicyVerifierCovenantParams({
|
|
200
|
+
assetId,
|
|
201
|
+
feeAssetId,
|
|
202
|
+
redemptionScriptHash,
|
|
203
|
+
authorityXonly,
|
|
204
|
+
resourceProfile: "strict_v2_compact",
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
The verifier parameters require both `redemptionScriptHash` and
|
|
209
|
+
`authorityXonly`, so callers must bind the vault and the authority explicitly
|
|
210
|
+
when compiling a new verifier.
|
|
177
211
|
|
|
178
212
|
`inspectStrictPolicyTransactionWithProofs(...)` is the recommended wallet API.
|
|
179
213
|
It validates every strict output by index, verifies its owner proof, derives the
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Strict v2 confidential-value verifier covenant.
|
|
3
|
+
*
|
|
4
|
+
* This is a distinct profile from strict-verifier-ordinary-v1. It permits a
|
|
5
|
+
* single, designated confidential payment output at index 2. Every strict
|
|
6
|
+
* RWA input and output remains explicit, and the covenant requires their
|
|
7
|
+
* aggregate amounts to match. This prevents a strict RWA from being moved
|
|
8
|
+
* through the confidential payment output while allowing standard PSET
|
|
9
|
+
* value-and-asset blinding for the payment itself.
|
|
10
|
+
*/
|
|
11
|
+
fn not(bit: bool) -> bool {
|
|
12
|
+
<u1>::into(jet::complement_1(<bool>::into(bit)))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
fn explicit_input_asset_amount(index: u32) -> (u256, u64) {
|
|
16
|
+
let pair: (Asset1, Amount1) = unwrap(jet::input_amount(index));
|
|
17
|
+
let (asset, amount): (Asset1, Amount1) = pair;
|
|
18
|
+
let asset_bits: u256 = unwrap_right::<(u1, u256)>(asset);
|
|
19
|
+
let amount_bits: u64 = unwrap_right::<(u1, u256)>(amount);
|
|
20
|
+
(asset_bits, amount_bits)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fn explicit_output_asset_amount(index: u32) -> (u256, u64) {
|
|
24
|
+
let pair: (Asset1, Amount1) = unwrap(jet::output_amount(index));
|
|
25
|
+
let (asset, amount): (Asset1, Amount1) = pair;
|
|
26
|
+
let asset_bits: u256 = unwrap_right::<(u1, u256)>(asset);
|
|
27
|
+
let amount_bits: u64 = unwrap_right::<(u1, u256)>(amount);
|
|
28
|
+
(asset_bits, amount_bits)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fn add_amount(left: u64, right: u64) -> u64 {
|
|
32
|
+
let (carry, sum): (bool, u64) = jet::add_64(left, right);
|
|
33
|
+
assert!(not(carry));
|
|
34
|
+
sum
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fn whitelist_owner_leaf(owner: Pubkey) -> u256 {
|
|
38
|
+
let tag_hash: u256 = 0x{{WHITELIST_OWNER_TAG_HASH}};
|
|
39
|
+
let ctx: Ctx8 = jet::sha_256_ctx_8_init();
|
|
40
|
+
let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, tag_hash);
|
|
41
|
+
let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, tag_hash);
|
|
42
|
+
let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, owner);
|
|
43
|
+
jet::sha_256_ctx_8_finalize(ctx)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fn whitelist_step(step: (bool, u256), node: u256) -> u256 {
|
|
47
|
+
let (sibling_on_left, sibling): (bool, u256) = step;
|
|
48
|
+
let tag_hash: u256 = 0x{{WHITELIST_NODE_TAG_HASH}};
|
|
49
|
+
let ctx: Ctx8 = jet::sha_256_ctx_8_init();
|
|
50
|
+
let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, tag_hash);
|
|
51
|
+
let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, tag_hash);
|
|
52
|
+
let ctx: Ctx8 = match sibling_on_left {
|
|
53
|
+
true => jet::sha_256_ctx_8_add_32(ctx, sibling),
|
|
54
|
+
false => jet::sha_256_ctx_8_add_32(ctx, node),
|
|
55
|
+
};
|
|
56
|
+
let ctx: Ctx8 = match sibling_on_left {
|
|
57
|
+
true => jet::sha_256_ctx_8_add_32(ctx, node),
|
|
58
|
+
false => jet::sha_256_ctx_8_add_32(ctx, sibling),
|
|
59
|
+
};
|
|
60
|
+
jet::sha_256_ctx_8_finalize(ctx)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fn require_whitelisted(owner: Pubkey, proof: [(bool, u256); {{WHITELIST_DEPTH}}]) {
|
|
64
|
+
let leaf: u256 = whitelist_owner_leaf(owner);
|
|
65
|
+
let root: u256 = array_fold::<whitelist_step, {{WHITELIST_DEPTH}}>(proof, leaf);
|
|
66
|
+
let expected_root: u256 = 0x{{WHITELIST_ROOT}};
|
|
67
|
+
assert!(jet::eq_256(root, expected_root));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
fn canonical_holder_script_hash(owner: Pubkey) -> u256 {
|
|
71
|
+
let holder_cmr: u256 = 0x{{HOLDER_PROGRAM_CMR}};
|
|
72
|
+
let holder_leaf: u256 = jet::build_tapleaf_simplicity(holder_cmr);
|
|
73
|
+
let tapdata_ctx: Ctx8 = jet::tapdata_init();
|
|
74
|
+
let tapdata_ctx: Ctx8 = jet::sha_256_ctx_8_add_32(tapdata_ctx, owner);
|
|
75
|
+
let owner_tapdata: u256 = jet::sha_256_ctx_8_finalize(tapdata_ctx);
|
|
76
|
+
let holder_root: u256 = jet::build_tapbranch(holder_leaf, owner_tapdata);
|
|
77
|
+
let holder_internal_key: Pubkey = 0x{{HOLDER_NUMS_INTERNAL_KEY}};
|
|
78
|
+
let output_key: u256 = jet::build_taptweak(holder_internal_key, holder_root);
|
|
79
|
+
|
|
80
|
+
let script_ctx: Ctx8 = jet::sha_256_ctx_8_init();
|
|
81
|
+
let script_ctx: Ctx8 = jet::sha_256_ctx_8_add_1(script_ctx, 0x51);
|
|
82
|
+
let script_ctx: Ctx8 = jet::sha_256_ctx_8_add_1(script_ctx, 0x20);
|
|
83
|
+
let script_ctx: Ctx8 = jet::sha_256_ctx_8_add_32(script_ctx, output_key);
|
|
84
|
+
jet::sha_256_ctx_8_finalize(script_ctx)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
fn next_index(index: u32) -> u32 {
|
|
88
|
+
let (carry, next): (bool, u32) = jet::add_32(index, 1);
|
|
89
|
+
assert!(not(carry));
|
|
90
|
+
next
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fn scan_input(unused: (), state: (u32, u64)) -> (u32, u64) {
|
|
94
|
+
let (index, strict_total): (u32, u64) = state;
|
|
95
|
+
let past_end: bool = jet::le_32(jet::num_inputs(), index);
|
|
96
|
+
let strict_total: u64 = match past_end {
|
|
97
|
+
true => strict_total,
|
|
98
|
+
false => {
|
|
99
|
+
let (asset, amount): (u256, u64) = explicit_input_asset_amount(index);
|
|
100
|
+
let strict_asset: u256 = 0x{{STRICT_ASSET_ID_JET_HEX}};
|
|
101
|
+
let is_strict: bool = jet::eq_256(asset, strict_asset);
|
|
102
|
+
match is_strict {
|
|
103
|
+
true => add_amount(strict_total, amount),
|
|
104
|
+
false => strict_total,
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
(next_index(index), strict_total)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
fn scan_output_ordinary(
|
|
112
|
+
owner_proof: (Pubkey, [(bool, u256); {{WHITELIST_DEPTH}}]),
|
|
113
|
+
state: (u32, u64)
|
|
114
|
+
) -> (u32, u64) {
|
|
115
|
+
let (index, strict_total): (u32, u64) = state;
|
|
116
|
+
let past_end: bool = jet::le_32(jet::num_outputs(), index);
|
|
117
|
+
let strict_total: u64 = match past_end {
|
|
118
|
+
true => strict_total,
|
|
119
|
+
false => {
|
|
120
|
+
let pair: (Asset1, Amount1) = unwrap(jet::output_amount(index));
|
|
121
|
+
let (asset, amount): (Asset1, Amount1) = pair;
|
|
122
|
+
match asset {
|
|
123
|
+
// PSET supports standard confidential outputs only when both
|
|
124
|
+
// asset and value are blinded. This profile permits exactly
|
|
125
|
+
// the atomic purchase payment at output 2 to use that form.
|
|
126
|
+
Left(unused_confidential_asset: (u1, u256)) => {
|
|
127
|
+
assert!(jet::eq_32(index, 2));
|
|
128
|
+
strict_total
|
|
129
|
+
},
|
|
130
|
+
Right(asset_bits: u256) => {
|
|
131
|
+
let strict_asset: u256 = 0x{{STRICT_ASSET_ID_JET_HEX}};
|
|
132
|
+
match jet::eq_256(asset_bits, strict_asset) {
|
|
133
|
+
true => {
|
|
134
|
+
let amount_bits: u64 = unwrap_right::<(u1, u256)>(amount);
|
|
135
|
+
let (owner, proof): (Pubkey, [(bool, u256); {{WHITELIST_DEPTH}}]) = owner_proof;
|
|
136
|
+
require_whitelisted(owner, proof);
|
|
137
|
+
let actual_script_hash: u256 = unwrap(jet::output_script_hash(index));
|
|
138
|
+
let expected_script_hash: u256 = canonical_holder_script_hash(owner);
|
|
139
|
+
assert!(jet::eq_256(actual_script_hash, expected_script_hash));
|
|
140
|
+
add_amount(strict_total, amount_bits)
|
|
141
|
+
},
|
|
142
|
+
false => strict_total,
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
(next_index(index), strict_total)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
fn require_verifier_successor(expected_script_hash: u256) {
|
|
152
|
+
let (verifier_asset, verifier_amount): (u256, u64) = explicit_input_asset_amount(0);
|
|
153
|
+
let expected_verifier_asset: u256 = 0x{{VERIFIER_ASSET_ID_JET_HEX}};
|
|
154
|
+
assert!(jet::eq_256(verifier_asset, expected_verifier_asset));
|
|
155
|
+
assert!(jet::eq_64(verifier_amount, {{VERIFIER_AMOUNT_ATOMIC}}));
|
|
156
|
+
|
|
157
|
+
let (successor_asset, successor_amount): (u256, u64) = explicit_output_asset_amount(0);
|
|
158
|
+
assert!(jet::eq_256(successor_asset, expected_verifier_asset));
|
|
159
|
+
assert!(jet::eq_64(successor_amount, {{VERIFIER_AMOUNT_ATOMIC}}));
|
|
160
|
+
let successor_script_hash: u256 = unwrap(jet::output_script_hash(0));
|
|
161
|
+
assert!(jet::eq_256(successor_script_hash, expected_script_hash))
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
fn scan_output_redemption(unused: (), state: (u32, u64)) -> (u32, u64) {
|
|
165
|
+
let (index, strict_total): (u32, u64) = state;
|
|
166
|
+
let past_end: bool = jet::le_32(jet::num_outputs(), index);
|
|
167
|
+
let strict_total: u64 = match past_end {
|
|
168
|
+
true => strict_total,
|
|
169
|
+
false => {
|
|
170
|
+
let pair: (Asset1, Amount1) = unwrap(jet::output_amount(index));
|
|
171
|
+
let (asset, amount): (Asset1, Amount1) = pair;
|
|
172
|
+
match asset {
|
|
173
|
+
Left(unused_confidential_asset: (u1, u256)) => {
|
|
174
|
+
assert!(false);
|
|
175
|
+
strict_total
|
|
176
|
+
},
|
|
177
|
+
Right(asset_bits: u256) => {
|
|
178
|
+
let strict_asset: u256 = 0x{{STRICT_ASSET_ID_JET_HEX}};
|
|
179
|
+
match jet::eq_256(asset_bits, strict_asset) {
|
|
180
|
+
true => {
|
|
181
|
+
let amount_bits: u64 = unwrap_right::<(u1, u256)>(amount);
|
|
182
|
+
let actual_script_hash: u256 = unwrap(jet::output_script_hash(index));
|
|
183
|
+
let redemption_script_hash: u256 = 0x{{REDEMPTION_SCRIPT_HASH}};
|
|
184
|
+
assert!(jet::eq_256(actual_script_hash, redemption_script_hash));
|
|
185
|
+
add_amount(strict_total, amount_bits)
|
|
186
|
+
},
|
|
187
|
+
false => strict_total,
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
(next_index(index), strict_total)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
fn strict_input_total() -> u64 {
|
|
197
|
+
let input_slots: [(); {{MAX_INPUTS}}] = [{{INPUT_UNIT_SLOTS}}];
|
|
198
|
+
let input_state: (u32, u64) =
|
|
199
|
+
array_fold::<scan_input, {{MAX_INPUTS}}>(input_slots, (0, 0));
|
|
200
|
+
let (unused_input_index, strict_total): (u32, u64) = input_state;
|
|
201
|
+
strict_total
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
fn ordinary_transfer(
|
|
205
|
+
output_owner_proofs: [(Pubkey, [(bool, u256); {{WHITELIST_DEPTH}}]); {{MAX_OUTPUTS}}]
|
|
206
|
+
) {
|
|
207
|
+
require_verifier_successor(jet::current_script_hash());
|
|
208
|
+
let strict_inputs: u64 = strict_input_total();
|
|
209
|
+
assert!(not(jet::eq_64(strict_inputs, 0)));
|
|
210
|
+
|
|
211
|
+
let output_state: (u32, u64) =
|
|
212
|
+
array_fold::<scan_output_ordinary, {{MAX_OUTPUTS}}>(output_owner_proofs, (0, 0));
|
|
213
|
+
let (unused_output_index, strict_outputs): (u32, u64) = output_state;
|
|
214
|
+
assert!(jet::eq_64(strict_inputs, strict_outputs))
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
fn redemption(authority_signature: Signature) {
|
|
218
|
+
require_verifier_successor(jet::current_script_hash());
|
|
219
|
+
let strict_inputs: u64 = strict_input_total();
|
|
220
|
+
assert!(not(jet::eq_64(strict_inputs, 0)));
|
|
221
|
+
|
|
222
|
+
let output_slots: [(); {{MAX_OUTPUTS}}] = [{{OUTPUT_UNIT_SLOTS}}];
|
|
223
|
+
let output_state: (u32, u64) =
|
|
224
|
+
array_fold::<scan_output_redemption, {{MAX_OUTPUTS}}>(output_slots, (0, 0));
|
|
225
|
+
let (unused_output_index, strict_outputs): (u32, u64) = output_state;
|
|
226
|
+
assert!(jet::eq_64(strict_inputs, strict_outputs));
|
|
227
|
+
|
|
228
|
+
let authority: Pubkey = 0x{{AUTHORITY_XONLY}};
|
|
229
|
+
jet::bip_0340_verify((authority, jet::sig_all_hash()), authority_signature)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
fn governance(next: (u256, Signature)) {
|
|
233
|
+
let (next_verifier_script_hash, authority_signature): (u256, Signature) = next;
|
|
234
|
+
require_verifier_successor(next_verifier_script_hash);
|
|
235
|
+
assert!(jet::eq_64(strict_input_total(), 0));
|
|
236
|
+
|
|
237
|
+
let output_slots: [(); {{MAX_OUTPUTS}}] = [{{OUTPUT_UNIT_SLOTS}}];
|
|
238
|
+
let output_state: (u32, u64) =
|
|
239
|
+
array_fold::<scan_output_redemption, {{MAX_OUTPUTS}}>(output_slots, (0, 0));
|
|
240
|
+
let (unused_output_index, strict_outputs): (u32, u64) = output_state;
|
|
241
|
+
assert!(jet::eq_64(strict_outputs, 0));
|
|
242
|
+
|
|
243
|
+
let authority: Pubkey = 0x{{AUTHORITY_XONLY}};
|
|
244
|
+
jet::bip_0340_verify((authority, jet::sig_all_hash()), authority_signature)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
fn main() {
|
|
248
|
+
assert!(jet::eq_32(jet::current_index(), 0));
|
|
249
|
+
assert!(jet::le_32(jet::num_inputs(), {{MAX_INPUTS}}));
|
|
250
|
+
assert!(jet::le_32(jet::num_outputs(), {{MAX_OUTPUTS}}));
|
|
251
|
+
|
|
252
|
+
let action:
|
|
253
|
+
Either<
|
|
254
|
+
[(Pubkey, [(bool, u256); {{WHITELIST_DEPTH}}]); {{MAX_OUTPUTS}}],
|
|
255
|
+
Either<Signature, (u256, Signature)>
|
|
256
|
+
> = witness::ACTION;
|
|
257
|
+
match action {
|
|
258
|
+
Left(output_owner_proofs : [(Pubkey, [(bool, u256); {{WHITELIST_DEPTH}}]); {{MAX_OUTPUTS}}]) =>
|
|
259
|
+
ordinary_transfer(output_owner_proofs),
|
|
260
|
+
Right(protected_action : Either<Signature, (u256, Signature)>) => match protected_action {
|
|
261
|
+
Left(authority_signature : Signature) => redemption(authority_signature),
|
|
262
|
+
Right(next : (u256, Signature)) => governance(next),
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
}
|
package/dist/domain/damp.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SimplicityArtifact, SimplicityClientConfig } from "../core/types";
|
|
2
|
+
import { type StrictPolicyVerifierResourceProfileId } from "./dampPolicy";
|
|
2
3
|
export declare const STRICT_POLICY_SNAPSHOT_SCHEMA: "hazbase_strict_policy_snapshot_v1";
|
|
3
4
|
export declare const STRICT_POLICY_SNAPSHOT_APPROVAL_SCHEMA: "hazbase_strict_policy_snapshot_approval_v1";
|
|
4
5
|
export declare const STRICT_POLICY_SNAPSHOT_APPROVAL_DOMAIN: "HAZBASE-RWA-POLICY-SNAPSHOT-V1";
|
|
@@ -72,6 +73,7 @@ export interface StrictPolicyVerifierCovenantParams {
|
|
|
72
73
|
whitelistRoot: string;
|
|
73
74
|
redemptionScriptHash: string;
|
|
74
75
|
authorityXonly: string;
|
|
76
|
+
resourceProfile?: StrictPolicyVerifierResourceProfileId;
|
|
75
77
|
}
|
|
76
78
|
export declare function normalizeStrictPolicySnapshotPayload(value: unknown): StrictPolicySnapshotPayload;
|
|
77
79
|
export declare function normalizeStrictPolicySnapshotAuthority(value: unknown): StrictPolicySnapshotAuthority;
|
|
@@ -81,7 +83,7 @@ export declare function normalizeStrictPolicyVerifierCovenantParams(value: Stric
|
|
|
81
83
|
export declare function strictPolicyHolderCovenantTemplatePath(): string;
|
|
82
84
|
export declare function renderStrictPolicyHolderCovenantSource(value: StrictPolicyHolderCovenantParams | unknown): Promise<string>;
|
|
83
85
|
export declare function compileStrictPolicyHolderCovenant(config: SimplicityClientConfig, value: StrictPolicyHolderCovenantParams | unknown): Promise<SimplicityArtifact>;
|
|
84
|
-
export declare function strictPolicyVerifierCovenantTemplatePath(): string;
|
|
86
|
+
export declare function strictPolicyVerifierCovenantTemplatePath(resourceProfile?: StrictPolicyVerifierResourceProfileId): string;
|
|
85
87
|
export declare function renderStrictPolicyVerifierCovenantSource(value: StrictPolicyVerifierCovenantParams | unknown): Promise<string>;
|
|
86
88
|
export declare function compileStrictPolicyVerifierCovenant(config: SimplicityClientConfig, value: StrictPolicyVerifierCovenantParams | unknown): Promise<SimplicityArtifact>;
|
|
87
89
|
export declare function taggedHashHexUtf8(tag: string, canonicalPayload: string): string;
|
package/dist/domain/damp.js
CHANGED
|
@@ -213,6 +213,7 @@ function normalizeStrictPolicyVerifierCovenantParams(value) {
|
|
|
213
213
|
whitelistRoot: hexValue(record.whitelistRoot, "verifierCovenant.whitelistRoot", 32),
|
|
214
214
|
redemptionScriptHash: hexValue(record.redemptionScriptHash, "verifierCovenant.redemptionScriptHash", 32),
|
|
215
215
|
authorityXonly: hexValue(record.authorityXonly, "verifierCovenant.authorityXonly", 32),
|
|
216
|
+
resourceProfile: (0, dampPolicy_1.resolveStrictPolicyVerifierResourceProfile)(record.resourceProfile).id,
|
|
216
217
|
};
|
|
217
218
|
}
|
|
218
219
|
function strictPolicyHolderCovenantTemplatePath() {
|
|
@@ -241,12 +242,16 @@ async function compileStrictPolicyHolderCovenant(config, value) {
|
|
|
241
242
|
},
|
|
242
243
|
});
|
|
243
244
|
}
|
|
244
|
-
function strictPolicyVerifierCovenantTemplatePath() {
|
|
245
|
+
function strictPolicyVerifierCovenantTemplatePath(resourceProfile = "strict_v2") {
|
|
246
|
+
if (resourceProfile === "strict_v2_confidential") {
|
|
247
|
+
return `${__dirname}/../docs/definitions/strict-verifier-confidential-v1.simf`;
|
|
248
|
+
}
|
|
245
249
|
return `${__dirname}/../docs/definitions/strict-verifier-ordinary-v1.simf`;
|
|
246
250
|
}
|
|
247
251
|
function strictPolicyVerifierTemplateVars(value) {
|
|
248
252
|
const params = normalizeStrictPolicyVerifierCovenantParams(value);
|
|
249
253
|
const tagHashes = (0, dampPolicy_1.strictPolicyWhitelistTagHashes)();
|
|
254
|
+
const resourceProfile = (0, dampPolicy_1.resolveStrictPolicyVerifierResourceProfile)(params.resourceProfile);
|
|
250
255
|
return {
|
|
251
256
|
STRICT_ASSET_ID_JET_HEX: params.strictAssetIdJetHex,
|
|
252
257
|
VERIFIER_ASSET_ID_JET_HEX: params.verifierAssetIdJetHex,
|
|
@@ -258,22 +263,24 @@ function strictPolicyVerifierTemplateVars(value) {
|
|
|
258
263
|
AUTHORITY_XONLY: params.authorityXonly,
|
|
259
264
|
WHITELIST_OWNER_TAG_HASH: tagHashes.owner,
|
|
260
265
|
WHITELIST_NODE_TAG_HASH: tagHashes.node,
|
|
261
|
-
WHITELIST_DEPTH:
|
|
262
|
-
MAX_INPUTS:
|
|
263
|
-
MAX_OUTPUTS:
|
|
264
|
-
INPUT_UNIT_SLOTS: Array.from({ length:
|
|
265
|
-
OUTPUT_UNIT_SLOTS: Array.from({ length:
|
|
266
|
+
WHITELIST_DEPTH: resourceProfile.whitelistDepth,
|
|
267
|
+
MAX_INPUTS: resourceProfile.maxInputs,
|
|
268
|
+
MAX_OUTPUTS: resourceProfile.maxOutputs,
|
|
269
|
+
INPUT_UNIT_SLOTS: Array.from({ length: resourceProfile.maxInputs }, () => "()").join(", "),
|
|
270
|
+
OUTPUT_UNIT_SLOTS: Array.from({ length: resourceProfile.maxOutputs }, () => "()").join(", "),
|
|
266
271
|
};
|
|
267
272
|
}
|
|
268
273
|
async function renderStrictPolicyVerifierCovenantSource(value) {
|
|
269
|
-
const
|
|
270
|
-
|
|
274
|
+
const params = normalizeStrictPolicyVerifierCovenantParams(value);
|
|
275
|
+
const source = await readTemplateFile(strictPolicyVerifierCovenantTemplatePath(params.resourceProfile));
|
|
276
|
+
return (0, templating_1.renderTemplate)(source, strictPolicyVerifierTemplateVars(params));
|
|
271
277
|
}
|
|
272
278
|
async function compileStrictPolicyVerifierCovenant(config, value) {
|
|
273
279
|
const { compileFromFile } = await loadCompiler();
|
|
280
|
+
const params = normalizeStrictPolicyVerifierCovenantParams(value);
|
|
274
281
|
return compileFromFile(config, {
|
|
275
|
-
simfPath: strictPolicyVerifierCovenantTemplatePath(),
|
|
276
|
-
templateVars: strictPolicyVerifierTemplateVars(
|
|
282
|
+
simfPath: strictPolicyVerifierCovenantTemplatePath(params.resourceProfile),
|
|
283
|
+
templateVars: strictPolicyVerifierTemplateVars(params),
|
|
277
284
|
});
|
|
278
285
|
}
|
|
279
286
|
function taggedHashHexUtf8(tag, canonicalPayload) {
|
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
export declare const STRICT_POLICY_WHITELIST_DEPTH: 8;
|
|
2
2
|
export declare const STRICT_POLICY_MAX_WHITELIST_OWNERS: number;
|
|
3
|
+
export declare const STRICT_POLICY_COMPACT_WHITELIST_DEPTH: 1;
|
|
4
|
+
export declare const STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS: number;
|
|
5
|
+
/**
|
|
6
|
+
* Consensus-visible resource bounds for strict verifier covenants. The
|
|
7
|
+
* compact profile is for the bounded one-position testnet lifecycle only;
|
|
8
|
+
* the general strict_v2 profile remains the default.
|
|
9
|
+
*/
|
|
10
|
+
export declare const STRICT_POLICY_VERIFIER_RESOURCE_PROFILES: {
|
|
11
|
+
readonly strict_v2: {
|
|
12
|
+
readonly id: "strict_v2";
|
|
13
|
+
readonly maxInputs: 16;
|
|
14
|
+
readonly maxOutputs: 8;
|
|
15
|
+
readonly whitelistDepth: 8;
|
|
16
|
+
readonly maxWhitelistOwners: number;
|
|
17
|
+
};
|
|
18
|
+
readonly strict_v2_compact: {
|
|
19
|
+
readonly id: "strict_v2_compact";
|
|
20
|
+
readonly maxInputs: 3;
|
|
21
|
+
readonly maxOutputs: 4;
|
|
22
|
+
readonly whitelistDepth: 1;
|
|
23
|
+
readonly maxWhitelistOwners: number;
|
|
24
|
+
};
|
|
25
|
+
readonly strict_v2_confidential: {
|
|
26
|
+
readonly id: "strict_v2_confidential";
|
|
27
|
+
readonly maxInputs: 16;
|
|
28
|
+
readonly maxOutputs: 8;
|
|
29
|
+
readonly whitelistDepth: 8;
|
|
30
|
+
readonly maxWhitelistOwners: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type StrictPolicyVerifierResourceProfileId = keyof typeof STRICT_POLICY_VERIFIER_RESOURCE_PROFILES;
|
|
34
|
+
export type StrictPolicyVerifierResourceProfile = (typeof STRICT_POLICY_VERIFIER_RESOURCE_PROFILES)[StrictPolicyVerifierResourceProfileId];
|
|
3
35
|
export declare const STRICT_POLICY_WHITELIST_OWNER_DOMAIN: "HAZBASE-RWA-STRICT-WHITELIST-OWNER-V1";
|
|
4
36
|
export declare const STRICT_POLICY_WHITELIST_EMPTY_DOMAIN: "HAZBASE-RWA-STRICT-WHITELIST-EMPTY-V1";
|
|
5
37
|
export declare const STRICT_POLICY_WHITELIST_NODE_DOMAIN: "HAZBASE-RWA-STRICT-WHITELIST-NODE-V1";
|
|
@@ -29,7 +61,7 @@ export interface StrictPolicyWhitelistEntry {
|
|
|
29
61
|
proof: StrictPolicyWhitelistProofStep[];
|
|
30
62
|
}
|
|
31
63
|
export interface StrictPolicyWhitelist {
|
|
32
|
-
depth:
|
|
64
|
+
depth: number;
|
|
33
65
|
root: string;
|
|
34
66
|
entries: StrictPolicyWhitelistEntry[];
|
|
35
67
|
}
|
|
@@ -37,6 +69,7 @@ export interface StrictPolicyWhitelistProof {
|
|
|
37
69
|
ownerXonly: string;
|
|
38
70
|
proof: StrictPolicyWhitelistProofStep[];
|
|
39
71
|
}
|
|
72
|
+
export declare function resolveStrictPolicyVerifierResourceProfile(value?: unknown): StrictPolicyVerifierResourceProfile;
|
|
40
73
|
export declare function computeStrictPolicyHolderTapleafHash(holderProgramCmrValue: string): string;
|
|
41
74
|
export declare function computeStrictPolicyOwnerTapDataHash(holderXonlyValue: string): string;
|
|
42
75
|
export declare function computeElementsTapBranch(leftValue: string, rightValue: string): string;
|
|
@@ -44,15 +77,19 @@ export declare function deriveStrictPolicyHolderPosition(value: StrictPolicyHold
|
|
|
44
77
|
export declare function computeStrictPolicyWhitelistOwnerLeaf(ownerXonlyValue: string): string;
|
|
45
78
|
export declare function computeStrictPolicyWhitelistEmptyLeaf(): string;
|
|
46
79
|
export declare function computeStrictPolicyWhitelistNode(leftValue: string, rightValue: string): string;
|
|
47
|
-
export declare function buildStrictPolicyWhitelist(ownerXonlyValues: readonly string[]
|
|
80
|
+
export declare function buildStrictPolicyWhitelist(ownerXonlyValues: readonly string[], options?: {
|
|
81
|
+
depth?: number;
|
|
82
|
+
}): StrictPolicyWhitelist;
|
|
48
83
|
export declare function verifyStrictPolicyWhitelistProof(input: {
|
|
49
84
|
ownerXonly: string;
|
|
50
85
|
proof: readonly StrictPolicyWhitelistProofStep[];
|
|
51
86
|
expectedRoot: string;
|
|
87
|
+
depth?: number;
|
|
52
88
|
}): boolean;
|
|
53
89
|
export declare function normalizeStrictPolicyWhitelistProof(input: {
|
|
54
90
|
ownerXonly: string;
|
|
55
91
|
proof: readonly StrictPolicyWhitelistProofStep[];
|
|
92
|
+
depth?: number;
|
|
56
93
|
}): StrictPolicyWhitelistProof;
|
|
57
94
|
export declare function strictPolicyWhitelistTagHashes(): {
|
|
58
95
|
owner: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STRICT_POLICY_WHITELIST_NODE_DOMAIN = exports.STRICT_POLICY_WHITELIST_EMPTY_DOMAIN = exports.STRICT_POLICY_WHITELIST_OWNER_DOMAIN = exports.STRICT_POLICY_MAX_WHITELIST_OWNERS = exports.STRICT_POLICY_WHITELIST_DEPTH = void 0;
|
|
3
|
+
exports.STRICT_POLICY_WHITELIST_NODE_DOMAIN = exports.STRICT_POLICY_WHITELIST_EMPTY_DOMAIN = exports.STRICT_POLICY_WHITELIST_OWNER_DOMAIN = exports.STRICT_POLICY_VERIFIER_RESOURCE_PROFILES = exports.STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS = exports.STRICT_POLICY_COMPACT_WHITELIST_DEPTH = exports.STRICT_POLICY_MAX_WHITELIST_OWNERS = exports.STRICT_POLICY_WHITELIST_DEPTH = void 0;
|
|
4
|
+
exports.resolveStrictPolicyVerifierResourceProfile = resolveStrictPolicyVerifierResourceProfile;
|
|
4
5
|
exports.computeStrictPolicyHolderTapleafHash = computeStrictPolicyHolderTapleafHash;
|
|
5
6
|
exports.computeStrictPolicyOwnerTapDataHash = computeStrictPolicyOwnerTapDataHash;
|
|
6
7
|
exports.computeElementsTapBranch = computeElementsTapBranch;
|
|
@@ -17,6 +18,38 @@ const errors_1 = require("../core/errors");
|
|
|
17
18
|
const strictPolicyCrypto_1 = require("../core/strictPolicyCrypto");
|
|
18
19
|
exports.STRICT_POLICY_WHITELIST_DEPTH = 8;
|
|
19
20
|
exports.STRICT_POLICY_MAX_WHITELIST_OWNERS = 1 << exports.STRICT_POLICY_WHITELIST_DEPTH;
|
|
21
|
+
exports.STRICT_POLICY_COMPACT_WHITELIST_DEPTH = 1;
|
|
22
|
+
exports.STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS = 1 << exports.STRICT_POLICY_COMPACT_WHITELIST_DEPTH;
|
|
23
|
+
/**
|
|
24
|
+
* Consensus-visible resource bounds for strict verifier covenants. The
|
|
25
|
+
* compact profile is for the bounded one-position testnet lifecycle only;
|
|
26
|
+
* the general strict_v2 profile remains the default.
|
|
27
|
+
*/
|
|
28
|
+
exports.STRICT_POLICY_VERIFIER_RESOURCE_PROFILES = {
|
|
29
|
+
strict_v2: {
|
|
30
|
+
id: "strict_v2",
|
|
31
|
+
maxInputs: 16,
|
|
32
|
+
maxOutputs: 8,
|
|
33
|
+
whitelistDepth: exports.STRICT_POLICY_WHITELIST_DEPTH,
|
|
34
|
+
maxWhitelistOwners: exports.STRICT_POLICY_MAX_WHITELIST_OWNERS,
|
|
35
|
+
},
|
|
36
|
+
strict_v2_compact: {
|
|
37
|
+
id: "strict_v2_compact",
|
|
38
|
+
maxInputs: 3,
|
|
39
|
+
maxOutputs: 4,
|
|
40
|
+
whitelistDepth: exports.STRICT_POLICY_COMPACT_WHITELIST_DEPTH,
|
|
41
|
+
maxWhitelistOwners: exports.STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS,
|
|
42
|
+
},
|
|
43
|
+
// This profile permits one full confidential treasury payment output while
|
|
44
|
+
// strict RWA inputs and outputs remain explicit for deterministic checks.
|
|
45
|
+
strict_v2_confidential: {
|
|
46
|
+
id: "strict_v2_confidential",
|
|
47
|
+
maxInputs: 16,
|
|
48
|
+
maxOutputs: 8,
|
|
49
|
+
whitelistDepth: exports.STRICT_POLICY_WHITELIST_DEPTH,
|
|
50
|
+
maxWhitelistOwners: exports.STRICT_POLICY_MAX_WHITELIST_OWNERS,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
20
53
|
exports.STRICT_POLICY_WHITELIST_OWNER_DOMAIN = "HAZBASE-RWA-STRICT-WHITELIST-OWNER-V1";
|
|
21
54
|
exports.STRICT_POLICY_WHITELIST_EMPTY_DOMAIN = "HAZBASE-RWA-STRICT-WHITELIST-EMPTY-V1";
|
|
22
55
|
exports.STRICT_POLICY_WHITELIST_NODE_DOMAIN = "HAZBASE-RWA-STRICT-WHITELIST-NODE-V1";
|
|
@@ -26,6 +59,12 @@ function validationError(field, message) {
|
|
|
26
59
|
field,
|
|
27
60
|
});
|
|
28
61
|
}
|
|
62
|
+
function resolveStrictPolicyVerifierResourceProfile(value = "strict_v2") {
|
|
63
|
+
if (typeof value !== "string" || !(value in exports.STRICT_POLICY_VERIFIER_RESOURCE_PROFILES)) {
|
|
64
|
+
validationError("resourceProfile", "must be strict_v2, strict_v2_compact, or strict_v2_confidential");
|
|
65
|
+
}
|
|
66
|
+
return exports.STRICT_POLICY_VERIFIER_RESOURCE_PROFILES[value];
|
|
67
|
+
}
|
|
29
68
|
function hex32(value, field) {
|
|
30
69
|
if (typeof value !== "string")
|
|
31
70
|
validationError(field, "must be 32 bytes of hex");
|
|
@@ -121,12 +160,14 @@ function computeStrictPolicyWhitelistNode(leftValue, rightValue) {
|
|
|
121
160
|
const right = hex32(rightValue, "right");
|
|
122
161
|
return taggedHashHex(exports.STRICT_POLICY_WHITELIST_NODE_DOMAIN, concat(bytes(left), bytes(right)));
|
|
123
162
|
}
|
|
124
|
-
function buildStrictPolicyWhitelist(ownerXonlyValues) {
|
|
163
|
+
function buildStrictPolicyWhitelist(ownerXonlyValues, options = {}) {
|
|
164
|
+
const depth = strictPolicyWhitelistDepth(options.depth);
|
|
165
|
+
const maxOwners = 1 << depth;
|
|
125
166
|
if (!Array.isArray(ownerXonlyValues) || ownerXonlyValues.length === 0) {
|
|
126
167
|
validationError("ownerXonlyValues", "must contain at least one owner");
|
|
127
168
|
}
|
|
128
|
-
if (ownerXonlyValues.length >
|
|
129
|
-
validationError("ownerXonlyValues", `must contain at most ${
|
|
169
|
+
if (ownerXonlyValues.length > maxOwners) {
|
|
170
|
+
validationError("ownerXonlyValues", `must contain at most ${maxOwners} owners`);
|
|
130
171
|
}
|
|
131
172
|
const owners = ownerXonlyValues
|
|
132
173
|
.map((owner, index) => hex32(owner, `ownerXonlyValues[${index}]`))
|
|
@@ -135,10 +176,10 @@ function buildStrictPolicyWhitelist(ownerXonlyValues) {
|
|
|
135
176
|
validationError("ownerXonlyValues", "must not contain duplicates");
|
|
136
177
|
}
|
|
137
178
|
const emptyLeaf = computeStrictPolicyWhitelistEmptyLeaf();
|
|
138
|
-
const leaves = Array.from({ length:
|
|
179
|
+
const leaves = Array.from({ length: maxOwners }, (_, index) => (index < owners.length ? computeStrictPolicyWhitelistOwnerLeaf(owners[index]) : emptyLeaf));
|
|
139
180
|
const levels = [leaves];
|
|
140
|
-
for (let
|
|
141
|
-
const current = levels[
|
|
181
|
+
for (let level = 0; level < depth; level += 1) {
|
|
182
|
+
const current = levels[level];
|
|
142
183
|
const next = [];
|
|
143
184
|
for (let index = 0; index < current.length; index += 2) {
|
|
144
185
|
next.push(computeStrictPolicyWhitelistNode(current[index], current[index + 1]));
|
|
@@ -148,11 +189,11 @@ function buildStrictPolicyWhitelist(ownerXonlyValues) {
|
|
|
148
189
|
const entries = owners.map((ownerXonly, ownerIndex) => {
|
|
149
190
|
const proof = [];
|
|
150
191
|
let index = ownerIndex;
|
|
151
|
-
for (let
|
|
192
|
+
for (let level = 0; level < depth; level += 1) {
|
|
152
193
|
const siblingIndex = index ^ 1;
|
|
153
194
|
proof.push({
|
|
154
195
|
siblingPosition: siblingIndex < index ? "left" : "right",
|
|
155
|
-
siblingHash: levels[
|
|
196
|
+
siblingHash: levels[level][siblingIndex],
|
|
156
197
|
});
|
|
157
198
|
index = Math.floor(index / 2);
|
|
158
199
|
}
|
|
@@ -163,8 +204,8 @@ function buildStrictPolicyWhitelist(ownerXonlyValues) {
|
|
|
163
204
|
};
|
|
164
205
|
});
|
|
165
206
|
return {
|
|
166
|
-
depth
|
|
167
|
-
root: levels[
|
|
207
|
+
depth,
|
|
208
|
+
root: levels[depth][0],
|
|
168
209
|
entries,
|
|
169
210
|
};
|
|
170
211
|
}
|
|
@@ -182,8 +223,9 @@ function verifyStrictPolicyWhitelistProof(input) {
|
|
|
182
223
|
}
|
|
183
224
|
function normalizeStrictPolicyWhitelistProof(input) {
|
|
184
225
|
const ownerXonly = hex32(input.ownerXonly, "ownerXonly");
|
|
185
|
-
|
|
186
|
-
|
|
226
|
+
const depth = strictPolicyWhitelistDepth(input.depth);
|
|
227
|
+
if (!Array.isArray(input.proof) || input.proof.length !== depth) {
|
|
228
|
+
validationError("proof", `must contain exactly ${depth} sibling hashes`);
|
|
187
229
|
}
|
|
188
230
|
const proof = input.proof.map((step, index) => {
|
|
189
231
|
if (!step || typeof step !== "object") {
|
|
@@ -199,6 +241,14 @@ function normalizeStrictPolicyWhitelistProof(input) {
|
|
|
199
241
|
});
|
|
200
242
|
return { ownerXonly, proof };
|
|
201
243
|
}
|
|
244
|
+
function strictPolicyWhitelistDepth(value) {
|
|
245
|
+
if (value === undefined)
|
|
246
|
+
return exports.STRICT_POLICY_WHITELIST_DEPTH;
|
|
247
|
+
if (!Number.isInteger(value) || value < 1 || value > exports.STRICT_POLICY_WHITELIST_DEPTH) {
|
|
248
|
+
validationError("depth", `must be an integer between 1 and ${exports.STRICT_POLICY_WHITELIST_DEPTH}`);
|
|
249
|
+
}
|
|
250
|
+
return value;
|
|
251
|
+
}
|
|
202
252
|
function strictPolicyWhitelistTagHashes() {
|
|
203
253
|
return {
|
|
204
254
|
owner: sha256(Buffer.from(exports.STRICT_POLICY_WHITELIST_OWNER_DOMAIN, "utf8")).toString("hex"),
|
package/dist/index.d.ts
CHANGED
|
@@ -25,8 +25,8 @@ export { configureStrictPolicyCrypto, } from "./core/strictPolicyCrypto";
|
|
|
25
25
|
export type { StrictPolicyCryptoProvider, } from "./core/strictPolicyCrypto";
|
|
26
26
|
export { STRICT_POLICY_SNAPSHOT_SCHEMA, STRICT_POLICY_SNAPSHOT_APPROVAL_SCHEMA, STRICT_POLICY_SNAPSHOT_APPROVAL_DOMAIN, STRICT_POLICY_AUTHORITY_SET_DOMAIN, STRICT_POLICY_VERIFIER_MAX_INPUTS, STRICT_POLICY_VERIFIER_MAX_OUTPUTS, normalizeStrictPolicySnapshotPayload, normalizeStrictPolicySnapshotAuthority, normalizeStrictPolicySnapshotApprovalProof, taggedHashHexUtf8, computeStrictPolicyAuthoritySetHash, normalizeStrictPolicyHolderCovenantParams, normalizeStrictPolicyVerifierCovenantParams, strictPolicyHolderCovenantTemplatePath, strictPolicyVerifierCovenantTemplatePath, renderStrictPolicyHolderCovenantSource, renderStrictPolicyVerifierCovenantSource, compileStrictPolicyHolderCovenant, compileStrictPolicyVerifierCovenant, prepareStrictPolicySnapshot, finalizeStrictPolicySnapshot, verifyStrictPolicySnapshot, } from "./domain/damp";
|
|
27
27
|
export type { StrictPolicyNetwork, StrictPolicyVerifierReference, StrictPolicySnapshotPayload, StrictPolicySnapshotAuthority, StrictPolicySnapshotApprovalProof, PreparedStrictPolicySnapshot, StrictPolicySnapshotEnvelope, StrictPolicyHolderCovenantParams, StrictPolicyVerifierCovenantParams, } from "./domain/damp";
|
|
28
|
-
export { STRICT_POLICY_WHITELIST_DEPTH, STRICT_POLICY_MAX_WHITELIST_OWNERS, STRICT_POLICY_WHITELIST_OWNER_DOMAIN, STRICT_POLICY_WHITELIST_EMPTY_DOMAIN, STRICT_POLICY_WHITELIST_NODE_DOMAIN, computeStrictPolicyHolderTapleafHash, computeStrictPolicyOwnerTapDataHash, computeElementsTapBranch, deriveStrictPolicyHolderPosition, computeStrictPolicyWhitelistOwnerLeaf, computeStrictPolicyWhitelistEmptyLeaf, computeStrictPolicyWhitelistNode, buildStrictPolicyWhitelist, normalizeStrictPolicyWhitelistProof, verifyStrictPolicyWhitelistProof, strictPolicyWhitelistTagHashes, } from "./domain/dampPolicy";
|
|
29
|
-
export type { StrictPolicyHolderPositionParams, StrictPolicyHolderPosition, StrictPolicyWhitelistProofStep, StrictPolicyWhitelistProof, StrictPolicyWhitelistEntry, StrictPolicyWhitelist, } from "./domain/dampPolicy";
|
|
28
|
+
export { STRICT_POLICY_WHITELIST_DEPTH, STRICT_POLICY_MAX_WHITELIST_OWNERS, STRICT_POLICY_COMPACT_WHITELIST_DEPTH, STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS, STRICT_POLICY_VERIFIER_RESOURCE_PROFILES, STRICT_POLICY_WHITELIST_OWNER_DOMAIN, STRICT_POLICY_WHITELIST_EMPTY_DOMAIN, STRICT_POLICY_WHITELIST_NODE_DOMAIN, computeStrictPolicyHolderTapleafHash, computeStrictPolicyOwnerTapDataHash, computeElementsTapBranch, deriveStrictPolicyHolderPosition, computeStrictPolicyWhitelistOwnerLeaf, computeStrictPolicyWhitelistEmptyLeaf, computeStrictPolicyWhitelistNode, buildStrictPolicyWhitelist, normalizeStrictPolicyWhitelistProof, verifyStrictPolicyWhitelistProof, strictPolicyWhitelistTagHashes, resolveStrictPolicyVerifierResourceProfile, } from "./domain/dampPolicy";
|
|
29
|
+
export type { StrictPolicyHolderPositionParams, StrictPolicyHolderPosition, StrictPolicyWhitelistProofStep, StrictPolicyWhitelistProof, StrictPolicyWhitelistEntry, StrictPolicyWhitelist, StrictPolicyVerifierResourceProfile, StrictPolicyVerifierResourceProfileId, } from "./domain/dampPolicy";
|
|
30
30
|
export { STRICT_POLICY_TRANSACTION_SUMMARY_SCHEMA, normalizeStrictPolicyDecodedTransaction, inspectStrictPolicyTransaction, inspectStrictPolicyTransactionWithProofs, } from "./domain/dampTransaction";
|
|
31
31
|
export type { StrictPolicyOperation, StrictPolicyTransactionOutpoint, StrictPolicyDecodedInput, StrictPolicyDecodedOutput, StrictPolicyDecodedTransaction, StrictPolicyTransactionExpectation, StrictPolicyTransactionSummary, StrictPolicyTransactionInspection, StrictPolicyOutputAuthorization, StrictPolicyProofBackedTransactionExpectation, StrictPolicyVerifiedOutputAuthorization, StrictPolicyProofBackedTransactionInspection, } from "./domain/dampTransaction";
|
|
32
32
|
export { STRICT_POLICY_PSET_INSPECTION_SCHEMA, normalizeStrictPolicyPsetInspection, inspectStrictPolicyPsetForSigning, } from "./domain/dampPset";
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.signPositionReceipt = exports.verifyCapitalCall = exports.executeCapital
|
|
|
18
18
|
exports.validateFundDefinition = exports.summarizeFundFinalityPayload = exports.summarizeFundClosingDescriptor = exports.summarizeDistributionDescriptor = exports.summarizeLPPositionReceipt = exports.summarizeCapitalCallState = exports.summarizeFundDefinition = exports.validateBondSettlementMatchesExpected = exports.validateBondSettlementDescriptor = exports.summarizeBondSettlementDescriptor = exports.verifyBondIssuanceHistory = exports.summarizeBondIssuanceState = exports.buildRedeemedBondIssuanceState = exports.validateBondStateTransition = exports.validateBondCrossChecks = exports.validateBondIssuanceState = exports.validateBondDefinition = exports.exportReceivableFinalityPayload = exports.exportReceivableEvidence = exports.verifyReceivableStateHistory = exports.verifyReceivableClosing = exports.prepareReceivableClosing = exports.verifyReceivableWriteOff = exports.prepareReceivableWriteOff = exports.verifyReceivableRepaymentClaim = exports.executeReceivableRepaymentClaim = exports.inspectReceivableRepaymentClaim = exports.prepareReceivableRepaymentClaim = exports.verifyReceivableRepayment = exports.prepareReceivableRepayment = exports.verifyReceivableFundingClaim = exports.executeReceivableFundingClaim = exports.inspectReceivableFundingClaim = exports.prepareReceivableFundingClaim = exports.verifyReceivableFunding = exports.prepareReceivableFunding = exports.loadReceivable = exports.verifyReceivable = exports.defineReceivable = exports.exportFundFinalityPayload = exports.exportFundEvidence = exports.verifyFundClosing = exports.prepareFundClosing = exports.verifyDistribution = exports.executeDistributionClaim = exports.inspectDistributionClaim = exports.reconcilePosition = exports.prepareDistribution = exports.verifyPositionReceiptChain = exports.verifyPositionReceipt = void 0;
|
|
19
19
|
exports.inspectRwaDvpDeliveryClaim = exports.exportRwaDvpEvidence = exports.executeRwaDvpRefundClaim = exports.executeRwaDvpDeliveryClaim = exports.defineRwaDvpPurchase = exports.compileRwaDvpEscrowContract = exports.buildRwaDvpPaymentRequirements = exports.RWA_DVP_VERIFICATION_SCHEMA_VERSION = exports.RWA_DVP_REFUND_CLAIM_SCHEMA_VERSION = exports.RWA_DVP_PURCHASE_SCHEMA_VERSION = exports.RWA_DVP_EVIDENCE_SCHEMA_VERSION = exports.RWA_DVP_DELIVERY_CLAIM_SCHEMA_VERSION = exports.verifyReceivableStateHistoryValidation = exports.validateReceivableWriteOffTransition = exports.validateReceivableRepaymentTransition = exports.validateReceivableFundingTransition = exports.validateReceivableCrossChecks = exports.validateReceivableState = exports.validateReceivableRepaymentClaimDescriptor = exports.validateReceivableRepaymentClaimAgainstState = exports.validateReceivableFundingClaimDescriptor = exports.validateReceivableFundingClaimAgainstState = exports.validateReceivableDefinition = exports.validateReceivableClosingDescriptor = exports.validateReceivableClosingAgainstState = exports.summarizeReceivableState = exports.summarizeReceivableRepaymentClaimDescriptor = exports.summarizeReceivableFundingClaimDescriptor = exports.summarizeReceivableDefinition = exports.summarizeReceivableClosingDescriptor = exports.buildReceivableRepaymentClaimDescriptor = exports.buildReceivableFundingClaimDescriptor = exports.buildReceivableClosingDescriptor = exports.buildFundedReceivableState = exports.buildDefaultedReceivableState = exports.applyReceivableRepayment = exports.buildFundClosingDescriptor = exports.buildDistributionDescriptor = exports.applyDistributionsToReceipt = exports.applyDistributionToReceipt = exports.buildLPPositionReceipt = exports.buildRefundedCapitalCallState = exports.buildClaimedCapitalCallState = exports.validateClosingAgainstReceipt = exports.validateDistributionAgainstReceipt = exports.validateFundCrossChecks = exports.validateFundClosingDescriptor = exports.validateDistributionDescriptor = exports.validateLPPositionReceipt = exports.validateCapitalCallState = void 0;
|
|
20
20
|
exports.verifyStrictPolicySnapshot = exports.finalizeStrictPolicySnapshot = exports.prepareStrictPolicySnapshot = exports.compileStrictPolicyVerifierCovenant = exports.compileStrictPolicyHolderCovenant = exports.renderStrictPolicyVerifierCovenantSource = exports.renderStrictPolicyHolderCovenantSource = exports.strictPolicyVerifierCovenantTemplatePath = exports.strictPolicyHolderCovenantTemplatePath = exports.normalizeStrictPolicyVerifierCovenantParams = exports.normalizeStrictPolicyHolderCovenantParams = exports.computeStrictPolicyAuthoritySetHash = exports.taggedHashHexUtf8 = exports.normalizeStrictPolicySnapshotApprovalProof = exports.normalizeStrictPolicySnapshotAuthority = exports.normalizeStrictPolicySnapshotPayload = exports.STRICT_POLICY_VERIFIER_MAX_OUTPUTS = exports.STRICT_POLICY_VERIFIER_MAX_INPUTS = exports.STRICT_POLICY_AUTHORITY_SET_DOMAIN = exports.STRICT_POLICY_SNAPSHOT_APPROVAL_DOMAIN = exports.STRICT_POLICY_SNAPSHOT_APPROVAL_SCHEMA = exports.STRICT_POLICY_SNAPSHOT_SCHEMA = exports.configureStrictPolicyCrypto = exports.validatePolicyTransferDescriptor = exports.validatePolicyOutputDescriptor = exports.validatePolicyState = exports.summarizePolicyTransferDescriptor = exports.summarizePolicyOutputDescriptor = exports.summarizePolicyState = exports.exportPolicyEvidence = exports.verifyTransfer = exports.verifyState = exports.inspectTransfer = exports.executeTransfer = exports.prepareTransfer = exports.issue = exports.validatePolicyTemplateParams = exports.describePolicyTemplate = exports.validatePolicyTemplateManifest = exports.loadPolicyTemplateManifest = exports.listPolicyTemplates = exports.buildPolicyOutputDescriptor = exports.compilePolicyStateContract = exports.verifyRwaDvpRefundClaim = exports.verifyRwaDvpPaymentPset = exports.verifyRwaDvpDeliveryClaim = exports.summarizeRwaDvpPurchase = exports.prepareRwaDvpRefundClaim = exports.prepareRwaDvpDeliveryClaim = exports.inspectRwaDvpRefundClaim = void 0;
|
|
21
|
-
exports.inspectStrictPolicyPsetForSigning = exports.normalizeStrictPolicyPsetInspection = exports.STRICT_POLICY_PSET_INSPECTION_SCHEMA = exports.inspectStrictPolicyTransactionWithProofs = exports.inspectStrictPolicyTransaction = exports.normalizeStrictPolicyDecodedTransaction = exports.STRICT_POLICY_TRANSACTION_SUMMARY_SCHEMA = exports.strictPolicyWhitelistTagHashes = exports.verifyStrictPolicyWhitelistProof = exports.normalizeStrictPolicyWhitelistProof = exports.buildStrictPolicyWhitelist = exports.computeStrictPolicyWhitelistNode = exports.computeStrictPolicyWhitelistEmptyLeaf = exports.computeStrictPolicyWhitelistOwnerLeaf = exports.deriveStrictPolicyHolderPosition = exports.computeElementsTapBranch = exports.computeStrictPolicyOwnerTapDataHash = exports.computeStrictPolicyHolderTapleafHash = exports.STRICT_POLICY_WHITELIST_NODE_DOMAIN = exports.STRICT_POLICY_WHITELIST_EMPTY_DOMAIN = exports.STRICT_POLICY_WHITELIST_OWNER_DOMAIN = exports.STRICT_POLICY_MAX_WHITELIST_OWNERS = exports.STRICT_POLICY_WHITELIST_DEPTH = void 0;
|
|
21
|
+
exports.inspectStrictPolicyPsetForSigning = exports.normalizeStrictPolicyPsetInspection = exports.STRICT_POLICY_PSET_INSPECTION_SCHEMA = exports.inspectStrictPolicyTransactionWithProofs = exports.inspectStrictPolicyTransaction = exports.normalizeStrictPolicyDecodedTransaction = exports.STRICT_POLICY_TRANSACTION_SUMMARY_SCHEMA = exports.resolveStrictPolicyVerifierResourceProfile = exports.strictPolicyWhitelistTagHashes = exports.verifyStrictPolicyWhitelistProof = exports.normalizeStrictPolicyWhitelistProof = exports.buildStrictPolicyWhitelist = exports.computeStrictPolicyWhitelistNode = exports.computeStrictPolicyWhitelistEmptyLeaf = exports.computeStrictPolicyWhitelistOwnerLeaf = exports.deriveStrictPolicyHolderPosition = exports.computeElementsTapBranch = exports.computeStrictPolicyOwnerTapDataHash = exports.computeStrictPolicyHolderTapleafHash = exports.STRICT_POLICY_WHITELIST_NODE_DOMAIN = exports.STRICT_POLICY_WHITELIST_EMPTY_DOMAIN = exports.STRICT_POLICY_WHITELIST_OWNER_DOMAIN = exports.STRICT_POLICY_VERIFIER_RESOURCE_PROFILES = exports.STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS = exports.STRICT_POLICY_COMPACT_WHITELIST_DEPTH = exports.STRICT_POLICY_MAX_WHITELIST_OWNERS = exports.STRICT_POLICY_WHITELIST_DEPTH = void 0;
|
|
22
22
|
var SimplicityClient_1 = require("./client/SimplicityClient");
|
|
23
23
|
Object.defineProperty(exports, "createSimplicityClient", { enumerable: true, get: function () { return SimplicityClient_1.createSimplicityClient; } });
|
|
24
24
|
Object.defineProperty(exports, "SimplicityClient", { enumerable: true, get: function () { return SimplicityClient_1.SimplicityClient; } });
|
|
@@ -246,6 +246,9 @@ Object.defineProperty(exports, "verifyStrictPolicySnapshot", { enumerable: true,
|
|
|
246
246
|
var dampPolicy_1 = require("./domain/dampPolicy");
|
|
247
247
|
Object.defineProperty(exports, "STRICT_POLICY_WHITELIST_DEPTH", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_WHITELIST_DEPTH; } });
|
|
248
248
|
Object.defineProperty(exports, "STRICT_POLICY_MAX_WHITELIST_OWNERS", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_MAX_WHITELIST_OWNERS; } });
|
|
249
|
+
Object.defineProperty(exports, "STRICT_POLICY_COMPACT_WHITELIST_DEPTH", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_COMPACT_WHITELIST_DEPTH; } });
|
|
250
|
+
Object.defineProperty(exports, "STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_COMPACT_MAX_WHITELIST_OWNERS; } });
|
|
251
|
+
Object.defineProperty(exports, "STRICT_POLICY_VERIFIER_RESOURCE_PROFILES", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_VERIFIER_RESOURCE_PROFILES; } });
|
|
249
252
|
Object.defineProperty(exports, "STRICT_POLICY_WHITELIST_OWNER_DOMAIN", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_WHITELIST_OWNER_DOMAIN; } });
|
|
250
253
|
Object.defineProperty(exports, "STRICT_POLICY_WHITELIST_EMPTY_DOMAIN", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_WHITELIST_EMPTY_DOMAIN; } });
|
|
251
254
|
Object.defineProperty(exports, "STRICT_POLICY_WHITELIST_NODE_DOMAIN", { enumerable: true, get: function () { return dampPolicy_1.STRICT_POLICY_WHITELIST_NODE_DOMAIN; } });
|
|
@@ -260,6 +263,7 @@ Object.defineProperty(exports, "buildStrictPolicyWhitelist", { enumerable: true,
|
|
|
260
263
|
Object.defineProperty(exports, "normalizeStrictPolicyWhitelistProof", { enumerable: true, get: function () { return dampPolicy_1.normalizeStrictPolicyWhitelistProof; } });
|
|
261
264
|
Object.defineProperty(exports, "verifyStrictPolicyWhitelistProof", { enumerable: true, get: function () { return dampPolicy_1.verifyStrictPolicyWhitelistProof; } });
|
|
262
265
|
Object.defineProperty(exports, "strictPolicyWhitelistTagHashes", { enumerable: true, get: function () { return dampPolicy_1.strictPolicyWhitelistTagHashes; } });
|
|
266
|
+
Object.defineProperty(exports, "resolveStrictPolicyVerifierResourceProfile", { enumerable: true, get: function () { return dampPolicy_1.resolveStrictPolicyVerifierResourceProfile; } });
|
|
263
267
|
var dampTransaction_1 = require("./domain/dampTransaction");
|
|
264
268
|
Object.defineProperty(exports, "STRICT_POLICY_TRANSACTION_SUMMARY_SCHEMA", { enumerable: true, get: function () { return dampTransaction_1.STRICT_POLICY_TRANSACTION_SUMMARY_SCHEMA; } });
|
|
265
269
|
Object.defineProperty(exports, "normalizeStrictPolicyDecodedTransaction", { enumerable: true, get: function () { return dampTransaction_1.normalizeStrictPolicyDecodedTransaction; } });
|