@emilia-protocol/gate 0.13.0 → 0.14.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal-to-effect.d.ts","sourceRoot":"","sources":["../src/proposal-to-effect.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,EAIL,gBAAgB,EAIjB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,8CAA8C,CAAC;AAGtD,eAAO,MAAM,0BAA0B,iCAAiC,CAAC;AAEzE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACtC,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAK9B,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,UAAU,CAAC;IACrB,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE;QACb,sBAAsB,EAAE,MAAM,CAAC;QAC/B,IAAI,EAAE,OAAO,gBAAgB,CAAC;KAC/B,CAAC;IACF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1E,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,OAAO,0BAA0B,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,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,uBAAuB,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACnE,UAAU,CAAC,EAAE,SAAS,CAAC;KACxB,KAAG,OAAO,CAAC,UAAU,CAAC;0BAcY;QACjC,QAAQ,EAAE,OAAO,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,SAAS,CAAC;KACxB,KAAG,OAAO,CAAC,UAAU,CAAC;qBAjJd;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,UAC3D,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,wBAAwB,CAAC;QAAC,aAAa,EAAE,UAAU,CAAA;KAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KACnI,OAAO,CAAC,UAAU,CAAC;uBA0DU;QAC9B,QAAQ,EAAE,OAAO,CAAC;QAClB,UAAU,EAAE,OAAO,CAAC;QACpB,iBAAiB,EAAE,OAAO,CAAC;KAC5B,KAAG,OAAO,CAAC,UAAU,CAAC;GAoGxB;;;;;;AAED,wBAIE"}
@@ -0,0 +1,427 @@
1
+ // @ts-nocheck
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * Proposal-to-Effect is a product orchestration profile over existing EMILIA
5
+ * artifacts. A proposal is deliberately NOT a bearer authorization object.
6
+ * Authority remains in EP-RECEIPT-v1 and the relying party's pinned AEB
7
+ * requirement; consequence custody remains in Gate and its durable stores.
8
+ */
9
+ import { beginReceiptApproval, pollReceiptApproval, approvalActionHash, validateApprovalAuthorization, validateCaidSelector, validateRequiredFields, } from '@emilia-protocol/require-receipt/acquisition';
10
+ import { aebReservationKey, authorizeAebExecutionDurable, digestAeb, pinnedConfigDigest, reconcileAebExecutionDurable, verifyAebEvaluation, } from '@emilia-protocol/verify/aeb-adapter-contract';
11
+ import { actionDigest as aecActionDigest } from '@emilia-protocol/verify/evidence-chain';
12
+ export const PROPOSAL_TO_EFFECT_VERSION = 'EMILIA-PROPOSAL-TO-EFFECT-v1';
13
+ const CAID_PATTERN = /^caid:1:[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*\.[1-9][0-9]*:[a-z0-9]+(?:-[a-z0-9]+)*:[A-Za-z0-9_-]{43}$/;
14
+ const IDENTIFIER_PATTERN = /^[A-Za-z0-9][A-Za-z0-9:_.@/-]{2,255}$/;
15
+ function isPlainObject(value) {
16
+ if (!value || typeof value !== 'object' || Array.isArray(value))
17
+ return false;
18
+ const prototype = Object.getPrototypeOf(value);
19
+ return prototype === Object.prototype || prototype === null;
20
+ }
21
+ function clone(value) {
22
+ return structuredClone(value);
23
+ }
24
+ function assertIdentifier(value, name) {
25
+ if (typeof value !== 'string' || !IDENTIFIER_PATTERN.test(value)) {
26
+ throw new Error(`${name}_invalid`);
27
+ }
28
+ }
29
+ function assertProfile(profile) {
30
+ if (!isPlainObject(profile))
31
+ throw new Error('proposal_profile_invalid');
32
+ assertIdentifier(profile.id, 'proposal_profile_id');
33
+ assertIdentifier(profile.action_type, 'proposal_action_type');
34
+ assertIdentifier(profile.aeb_requirement_ref, 'proposal_aeb_requirement_ref');
35
+ if (!isPlainObject(profile.selector) || Object.keys(profile.selector).length === 0) {
36
+ throw new Error('proposal_selector_invalid');
37
+ }
38
+ const requiredFields = validateRequiredFields(profile.required_fields);
39
+ if (!requiredFields.ok)
40
+ throw new Error(requiredFields.reason);
41
+ if (!Number.isSafeInteger(profile.ttl_sec) || profile.ttl_sec <= 0 || profile.ttl_sec > 86_400) {
42
+ throw new Error('proposal_ttl_invalid');
43
+ }
44
+ if (typeof profile.canonicalize_action !== 'function') {
45
+ throw new Error('proposal_canonicalizer_required');
46
+ }
47
+ const authorization = validateApprovalAuthorization(profile.authorization);
48
+ if (!authorization.ok)
49
+ throw new Error(authorization.reason);
50
+ if (profile.caid_selector) {
51
+ const caidSelector = validateCaidSelector(profile.caid_selector);
52
+ if (!caidSelector.ok)
53
+ throw new Error(caidSelector.reason);
54
+ }
55
+ }
56
+ function canonicalizeForProfile(profile, input) {
57
+ const normalized = profile.canonicalize_action(clone(input));
58
+ if (!isPlainObject(normalized) || !isPlainObject(normalized.action)
59
+ || typeof normalized.caid !== 'string' || !CAID_PATTERN.test(normalized.caid)) {
60
+ throw new Error('proposal_canonicalization_invalid');
61
+ }
62
+ if (normalized.action.action_type !== profile.action_type) {
63
+ throw new Error('proposal_action_type_mismatch');
64
+ }
65
+ for (const field of profile.required_fields) {
66
+ if (!Object.hasOwn(normalized.action, field) || normalized.action[field] === undefined) {
67
+ throw new Error(`proposal_required_field_missing:${field}`);
68
+ }
69
+ }
70
+ if (profile.caid_selector) {
71
+ const field = profile.caid_selector.field;
72
+ if (typeof field !== 'string' || normalized.action[field] !== normalized.caid) {
73
+ throw new Error(`proposal_caid_binding_invalid:${field}`);
74
+ }
75
+ }
76
+ // Both digest functions reject unsupported/non-canonical JSON values.
77
+ approvalActionHash(normalized.action);
78
+ digestAeb(normalized.action);
79
+ return { action: clone(normalized.action), caid: normalized.caid };
80
+ }
81
+ function assertSameObject(left, right, reason) {
82
+ if (digestAeb(left) !== digestAeb(right))
83
+ throw new Error(reason);
84
+ }
85
+ function exactProposalKeys(proposal) {
86
+ const expected = [
87
+ '@version', 'action', 'action_digest', 'aeb', 'aeb_action_digest', 'authorization',
88
+ 'caid', 'challenge', 'created_at', 'expires_at', 'initiator_id', 'operation_id',
89
+ 'profile_id', 'proposal_id',
90
+ ].sort();
91
+ const actual = Object.keys(proposal).sort();
92
+ return expected.length === actual.length && expected.every((key, index) => key === actual[index]);
93
+ }
94
+ function proposalAdmissibility(proposal, record) {
95
+ return {
96
+ admissibility_profile: { id: `aeb:${proposal.aeb.requirement_ref}`, version: '1' },
97
+ profile_hash: proposal.aeb.pinned_config_digest,
98
+ verdict: 'admissible',
99
+ replay_digest: record.evidence_digest,
100
+ challenge_id: proposal.proposal_id,
101
+ aeb_evaluation_digest: digestAeb(record),
102
+ };
103
+ }
104
+ function refusal(reason, extra = {}) {
105
+ return { ok: false, reason, ...extra };
106
+ }
107
+ export function proposalToEffectConsumptionNonce(operationId, pinnedConfigDigest) {
108
+ assertIdentifier(operationId, 'proposal_operation_id');
109
+ if (typeof pinnedConfigDigest !== 'string' || !/^sha256:[a-f0-9]{64}$/.test(pinnedConfigDigest)) {
110
+ throw new Error('proposal_aeb_pin_invalid');
111
+ }
112
+ return digestAeb({
113
+ domain: PROPOSAL_TO_EFFECT_VERSION,
114
+ operation_id: operationId,
115
+ pinned_config_digest: pinnedConfigDigest,
116
+ });
117
+ }
118
+ function expectedAebCompositionDigest(proposal) {
119
+ return `sha256:${aecActionDigest({
120
+ caid: proposal.caid,
121
+ normalized_action_digest: proposal.aeb_action_digest,
122
+ })}`;
123
+ }
124
+ export function createProposalToEffect(options) {
125
+ if (!options?.gate || typeof options.gate.check !== 'function' || typeof options.gate.run !== 'function') {
126
+ throw new Error('proposal_gate_required');
127
+ }
128
+ if (!isPlainObject(options.profiles) || Object.keys(options.profiles).length === 0) {
129
+ throw new Error('proposal_profiles_required');
130
+ }
131
+ for (const [id, profile] of Object.entries(options.profiles)) {
132
+ assertProfile(profile);
133
+ if (id !== profile.id)
134
+ throw new Error('proposal_profile_registry_mismatch');
135
+ }
136
+ if (!options.aeb?.config || !options.aeb.adapters || !options.aeb.store
137
+ || typeof options.aeb.resolve_artifacts !== 'function'
138
+ || typeof options.aeb.verify_provider_evidence !== 'function') {
139
+ throw new Error('proposal_aeb_configuration_required');
140
+ }
141
+ const now = options.now ?? Date.now;
142
+ const configDigest = pinnedConfigDigest(options.aeb.config);
143
+ function profileFor(id) {
144
+ if (typeof id !== 'string' || !options.profiles[id])
145
+ throw new Error('proposal_profile_not_pinned');
146
+ return options.profiles[id];
147
+ }
148
+ function prepare(input) {
149
+ assertIdentifier(input?.proposal_id, 'proposal_id');
150
+ assertIdentifier(input?.operation_id, 'proposal_operation_id');
151
+ assertIdentifier(input?.initiator_id, 'proposal_initiator_id');
152
+ const profile = profileFor(input?.profile_id);
153
+ const normalized = canonicalizeForProfile(profile, input.action);
154
+ const createdAtMs = now();
155
+ if (!Number.isFinite(createdAtMs))
156
+ throw new Error('proposal_time_invalid');
157
+ const actionDigest = approvalActionHash(normalized.action);
158
+ return clone({
159
+ '@version': PROPOSAL_TO_EFFECT_VERSION,
160
+ proposal_id: input.proposal_id,
161
+ operation_id: input.operation_id,
162
+ initiator_id: input.initiator_id,
163
+ profile_id: profile.id,
164
+ action: normalized.action,
165
+ action_digest: actionDigest,
166
+ aeb_action_digest: digestAeb(normalized.action),
167
+ caid: normalized.caid,
168
+ created_at: new Date(createdAtMs).toISOString(),
169
+ expires_at: new Date(createdAtMs + profile.ttl_sec * 1000).toISOString(),
170
+ challenge: {
171
+ action: profile.action_type,
172
+ action_hash: actionDigest,
173
+ required_fields: [...profile.required_fields],
174
+ ...(profile.caid_selector ? { caid_selector: clone(profile.caid_selector) } : {}),
175
+ },
176
+ authorization: clone(profile.authorization),
177
+ aeb: {
178
+ requirement_ref: profile.aeb_requirement_ref,
179
+ pinned_config_digest: configDigest,
180
+ consumption_nonce: proposalToEffectConsumptionNonce(input.operation_id, configDigest),
181
+ },
182
+ });
183
+ }
184
+ function verifyProposal(input, { allowExpired = false } = {}) {
185
+ if (!isPlainObject(input) || !exactProposalKeys(input)
186
+ || input['@version'] !== PROPOSAL_TO_EFFECT_VERSION) {
187
+ throw new Error('proposal_shape_invalid');
188
+ }
189
+ const proposal = input;
190
+ assertIdentifier(proposal.proposal_id, 'proposal_id');
191
+ assertIdentifier(proposal.operation_id, 'proposal_operation_id');
192
+ assertIdentifier(proposal.initiator_id, 'proposal_initiator_id');
193
+ const profile = profileFor(proposal.profile_id);
194
+ const normalized = canonicalizeForProfile(profile, proposal.action);
195
+ if (normalized.caid !== proposal.caid)
196
+ throw new Error('proposal_caid_mismatch');
197
+ assertSameObject(normalized.action, proposal.action, 'proposal_action_not_canonical');
198
+ if (approvalActionHash(normalized.action) !== proposal.action_digest) {
199
+ throw new Error('proposal_action_digest_mismatch');
200
+ }
201
+ if (digestAeb(normalized.action) !== proposal.aeb_action_digest) {
202
+ throw new Error('proposal_aeb_action_digest_mismatch');
203
+ }
204
+ if (!Number.isFinite(Date.parse(proposal.created_at)) || !Number.isFinite(Date.parse(proposal.expires_at))
205
+ || Date.parse(proposal.expires_at) <= Date.parse(proposal.created_at)) {
206
+ throw new Error('proposal_time_invalid');
207
+ }
208
+ if (!allowExpired && now() >= Date.parse(proposal.expires_at))
209
+ throw new Error('proposal_expired');
210
+ assertSameObject(proposal.authorization, profile.authorization, 'proposal_authorization_mismatch');
211
+ if (!isPlainObject(proposal.aeb)
212
+ || Object.keys(proposal.aeb).sort().join(',') !== 'consumption_nonce,pinned_config_digest,requirement_ref'
213
+ || proposal.aeb?.requirement_ref !== profile.aeb_requirement_ref
214
+ || proposal.aeb?.pinned_config_digest !== configDigest) {
215
+ throw new Error('proposal_aeb_pin_mismatch');
216
+ }
217
+ if (proposal.aeb.consumption_nonce !== proposalToEffectConsumptionNonce(proposal.operation_id, configDigest)) {
218
+ throw new Error('proposal_aeb_nonce_mismatch');
219
+ }
220
+ const expectedChallenge = {
221
+ action: profile.action_type,
222
+ action_hash: proposal.action_digest,
223
+ required_fields: [...profile.required_fields],
224
+ ...(profile.caid_selector ? { caid_selector: clone(profile.caid_selector) } : {}),
225
+ };
226
+ assertSameObject(proposal.challenge, expectedChallenge, 'proposal_challenge_mismatch');
227
+ return { proposal: clone(proposal), profile };
228
+ }
229
+ async function verifyEvaluation(proposal, evaluation) {
230
+ if (!isPlainObject(evaluation))
231
+ return { valid: false, reason: 'aeb_evaluation_missing', record: null };
232
+ const record = evaluation;
233
+ if (record.operation_id !== proposal.operation_id
234
+ || record.consumption_nonce !== proposal.aeb.consumption_nonce
235
+ || record.initiator_id !== proposal.initiator_id
236
+ || record.requirement_ref !== proposal.aeb.requirement_ref
237
+ || record.caid !== proposal.caid) {
238
+ return { valid: false, reason: 'aeb_evaluation_binding_mismatch', record };
239
+ }
240
+ let artifacts;
241
+ try {
242
+ artifacts = await options.aeb.resolve_artifacts({ proposal: clone(proposal), evaluation: clone(record) });
243
+ }
244
+ catch {
245
+ return { valid: false, reason: 'aeb_artifact_resolution_failed', record };
246
+ }
247
+ const checked = verifyAebEvaluation(record, {
248
+ config: options.aeb.config,
249
+ adapters: options.aeb.adapters,
250
+ artifacts,
251
+ now: new Date(now()).toISOString(),
252
+ });
253
+ if (!checked.valid || record.verdict !== 'SATISFIED'
254
+ || record.authority_constraints?.one_time_consumption !== true) {
255
+ return { valid: false, reason: 'aeb_evaluation_refused', record, checked };
256
+ }
257
+ if (record.composition?.action_digest !== expectedAebCompositionDigest(proposal)) {
258
+ return { valid: false, reason: 'aeb_evaluation_binding_mismatch', record, checked };
259
+ }
260
+ return { valid: true, reason: null, record, checked };
261
+ }
262
+ function gateInput(proposal, profile, receipt, record) {
263
+ return {
264
+ selector: {
265
+ ...clone(profile.selector),
266
+ operation_id: proposal.operation_id,
267
+ initiator_id: proposal.initiator_id,
268
+ aeb_requirement_ref: proposal.aeb.requirement_ref,
269
+ },
270
+ receipt,
271
+ observedAction: clone(proposal.action),
272
+ admissibility: proposalAdmissibility(proposal, record),
273
+ };
274
+ }
275
+ async function execute(input, effect) {
276
+ if (typeof effect !== 'function')
277
+ throw new Error('proposal_effect_required');
278
+ const { proposal, profile } = verifyProposal(input?.proposal);
279
+ const evaluation = await verifyEvaluation(proposal, input?.evaluation);
280
+ if (!evaluation.valid || !evaluation.record) {
281
+ return refusal(evaluation.reason || 'aeb_evaluation_refused', { aeb: evaluation.checked ?? null });
282
+ }
283
+ const preparedGateInput = gateInput(proposal, profile, input.receipt, evaluation.record);
284
+ const preflight = await options.gate.check({ ...preparedGateInput, consumptionMode: 'none' });
285
+ if (preflight.allow !== true) {
286
+ return refusal(preflight.reason || 'gate_refused', { authorization: preflight });
287
+ }
288
+ if (preflight.reason === 'not_guarded' || preflight.requirement?.receipt_required !== true) {
289
+ return refusal('gate_profile_not_receipt_guarded', { authorization: preflight });
290
+ }
291
+ const reservation = await authorizeAebExecutionDurable(evaluation.record, {
292
+ verified: true,
293
+ local_authorization: true,
294
+ store: options.aeb.store,
295
+ });
296
+ if (!reservation.invoke_allowed || !reservation.reservation_key) {
297
+ return refusal(reservation.reason === 'consumption_conflict' ? 'aeb_consumption_conflict' : reservation.reason, { aeb: reservation });
298
+ }
299
+ const key = reservation.reservation_key;
300
+ try {
301
+ const result = await options.gate.run(preparedGateInput, async (authorization) => effect({
302
+ action: clone(proposal.action),
303
+ proposal: clone(proposal),
304
+ authorization: clone(authorization),
305
+ }));
306
+ if (result?.ok !== true) {
307
+ await options.aeb.store.release(key);
308
+ return refusal(result?.authorization?.reason || result?.reason || 'gate_refused', {
309
+ authorization: result?.authorization ?? null,
310
+ });
311
+ }
312
+ const committed = await reconcileAebExecutionDurable(options.aeb.store, key, 'COMMITTED');
313
+ if (committed.state !== 'CONSUMED') {
314
+ const error = new Error('aeb_consumption_commit_failed');
315
+ error.code = 'EMILIA_PROPOSAL_TO_EFFECT_COMMIT_FAILED';
316
+ error.proposalToEffect = { outcome: 'executed', reservation_key: key };
317
+ throw error;
318
+ }
319
+ return { ...result, proposal: clone(proposal), aeb: committed };
320
+ }
321
+ catch (error) {
322
+ const outcome = error?.proposalToEffect?.outcome ?? error?.emiliaGateOutcome?.outcome;
323
+ if (outcome === 'executed') {
324
+ await reconcileAebExecutionDurable(options.aeb.store, key, 'COMMITTED');
325
+ }
326
+ else if (outcome !== 'indeterminate') {
327
+ await options.aeb.store.release(key);
328
+ }
329
+ throw error;
330
+ }
331
+ }
332
+ async function reconcile(input) {
333
+ const { proposal } = verifyProposal(input?.proposal, { allowExpired: true });
334
+ if (!isPlainObject(input?.evaluation))
335
+ return refusal('aeb_evaluation_missing');
336
+ const record = input.evaluation;
337
+ if (record.operation_id !== proposal.operation_id
338
+ || record.consumption_nonce !== proposal.aeb.consumption_nonce
339
+ || record.initiator_id !== proposal.initiator_id
340
+ || record.requirement_ref !== proposal.aeb.requirement_ref
341
+ || record.caid !== proposal.caid) {
342
+ return refusal('aeb_evaluation_binding_mismatch');
343
+ }
344
+ const artifacts = await options.aeb.resolve_artifacts({ proposal: clone(proposal), evaluation: clone(record) });
345
+ const historical = verifyAebEvaluation(record, {
346
+ config: options.aeb.config,
347
+ adapters: options.aeb.adapters,
348
+ artifacts,
349
+ now: record.evaluated_at,
350
+ });
351
+ if (!historical.valid)
352
+ return refusal('aeb_evaluation_refused', { aeb: historical });
353
+ if (record.verdict !== 'SATISFIED'
354
+ || record.authority_constraints?.one_time_consumption !== true) {
355
+ return refusal('aeb_evaluation_refused', { aeb: historical });
356
+ }
357
+ if (record.composition?.action_digest !== expectedAebCompositionDigest(proposal)) {
358
+ return refusal('aeb_evaluation_binding_mismatch');
359
+ }
360
+ let provider;
361
+ try {
362
+ provider = await options.aeb.verify_provider_evidence({
363
+ evidence: clone(input.provider_evidence),
364
+ expected: {
365
+ operation_id: proposal.operation_id,
366
+ caid: proposal.caid,
367
+ action_digest: proposal.aeb_action_digest,
368
+ },
369
+ });
370
+ }
371
+ catch {
372
+ return refusal('provider_evidence_unverified');
373
+ }
374
+ if (!provider?.valid || (provider.outcome !== 'COMMITTED' && provider.outcome !== 'NOT_COMMITTED')) {
375
+ return refusal(provider?.reason || 'provider_evidence_unverified');
376
+ }
377
+ const key = aebReservationKey(record);
378
+ const reconciled = await reconcileAebExecutionDurable(options.aeb.store, key, provider.outcome);
379
+ if (reconciled.state === 'RECONCILIATION_REQUIRED') {
380
+ return refusal(reconciled.reason, { state: reconciled.state });
381
+ }
382
+ return {
383
+ ok: true,
384
+ state: reconciled.state,
385
+ outcome: provider.outcome,
386
+ evidence_digest: provider.evidence_digest ?? null,
387
+ reservation_key: key,
388
+ };
389
+ }
390
+ async function beginApproval(input) {
391
+ const { proposal, profile } = verifyProposal(input?.proposal);
392
+ return beginReceiptApproval({
393
+ authorization: proposal.authorization,
394
+ trustedAuthorization: profile.authorization,
395
+ challenge: proposal.challenge,
396
+ action: proposal.action,
397
+ approver_id: input.approver_id,
398
+ idempotency_key: input.idempotency_key,
399
+ requesterAuthorization: input.requester_authorization,
400
+ fetchImpl: input.fetch_impl,
401
+ });
402
+ }
403
+ async function pollApproval(input) {
404
+ const { proposal, profile } = verifyProposal(input?.proposal, { allowExpired: true });
405
+ return pollReceiptApproval({
406
+ authorization: proposal.authorization,
407
+ trustedAuthorization: profile.authorization,
408
+ request_id: input.request_id,
409
+ poll_token: input.poll_token,
410
+ fetchImpl: input.fetch_impl,
411
+ });
412
+ }
413
+ return Object.freeze({
414
+ prepare,
415
+ verifyProposal,
416
+ beginApproval,
417
+ pollApproval,
418
+ execute,
419
+ reconcile,
420
+ });
421
+ }
422
+ export default {
423
+ PROPOSAL_TO_EFFECT_VERSION,
424
+ proposalToEffectConsumptionNonce,
425
+ createProposalToEffect,
426
+ };
427
+ //# sourceMappingURL=proposal-to-effect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal-to-effect.js","sourceRoot":"","sources":["../src/proposal-to-effect.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;GAKG;AAEH,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAElB,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,SAAS,EACT,kBAAkB,EAClB,4BAA4B,EAC5B,mBAAmB,GAMpB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAEzF,MAAM,CAAC,MAAM,0BAA0B,GAAG,8BAA8B,CAAC;AAKzE,MAAM,YAAY,GAAG,wGAAwG,CAAC;AAC9H,MAAM,kBAAkB,GAAG,uCAAuC,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,uBAAuB;YACrD,SAAS,EAAE,KAAK,CAAC,UAAU;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,UAAU,YAAY,CAAC,KAK3B;QACC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACtF,OAAO,mBAAmB,CAAC;YACzB,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,oBAAoB,EAAE,OAAO,CAAC,aAAa;YAC3C,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,SAAS,EAAE,KAAK,CAAC,UAAU;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO;QACP,cAAc;QACd,aAAa;QACb,YAAY;QACZ,OAAO;QACP,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED,eAAe;IACb,0BAA0B;IAC1B,gCAAgC;IAChC,sBAAsB;CACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilia-protocol/gate",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/emiliaprotocol/emilia-protocol.git",
@@ -71,6 +71,7 @@
71
71
  "./remedy-program": "./remedy-program.js",
72
72
  "./remedy-program-receipt": "./remedy-program-receipt.js",
73
73
  "./remedy-program-postgres": "./remedy-program-postgres.js",
74
+ "./proposal-to-effect": "./proposal-to-effect.js",
74
75
  "./zk-range-proof": "./zk-range-proof.js"
75
76
  },
76
77
  "bin": {
@@ -111,6 +112,7 @@
111
112
  "remedy-program.js",
112
113
  "remedy-program-receipt.js",
113
114
  "remedy-program-postgres.js",
115
+ "proposal-to-effect.js",
114
116
  "zk-range-proof.js",
115
117
  "reports/assurance-package.js",
116
118
  "ep-assure.mjs",
@@ -183,8 +185,8 @@
183
185
  },
184
186
  "dependencies": {
185
187
  "@noble/curves": "2.2.0",
186
- "@emilia-protocol/require-receipt": "0.6.1",
187
- "@emilia-protocol/verify": "3.11.0"
188
+ "@emilia-protocol/require-receipt": "0.7.0",
189
+ "@emilia-protocol/verify": "3.13.0"
188
190
  },
189
191
  "keywords": [
190
192
  "emilia",
@@ -0,0 +1,4 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Compatibility entry point for the TypeScript proposal-to-effect module.
3
+ export * from './dist/proposal-to-effect.js';
4
+ export { default } from './dist/proposal-to-effect.js';
package/src/index.ts CHANGED
@@ -284,6 +284,11 @@ export {
284
284
  REMEDY_PROGRAM_POSTGRES_SQL,
285
285
  createRemedyProgramPostgresStore,
286
286
  } from './remedy-program-postgres.js';
287
+ export {
288
+ PROPOSAL_TO_EFFECT_VERSION,
289
+ proposalToEffectConsumptionNonce,
290
+ createProposalToEffect,
291
+ } from './proposal-to-effect.js';
287
292
  export const ASSURANCE_TIERS = ['software', 'class_a', 'quorum'];
288
293
  const TIER_RANK = { software: 0, class_a: 1, quorum: 2 };
289
294
  const CAPABILITY_FAILURE_STATUS = 409;