@emilia-protocol/gate 0.14.0 → 0.15.1
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/CHANGELOG.md +60 -1
- package/README.md +32 -1
- package/aeb-consumption-store.js +3 -0
- package/dist/aeb-consumption-store.d.ts +88 -0
- package/dist/aeb-consumption-store.d.ts.map +1 -0
- package/dist/aeb-consumption-store.js +471 -0
- package/dist/aeb-consumption-store.js.map +1 -0
- package/dist/capability-receipt.d.ts +8 -0
- package/dist/capability-receipt.d.ts.map +1 -1
- package/dist/capability-receipt.js +17 -0
- package/dist/capability-receipt.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/proposal-to-effect-postgres.d.ts +144 -0
- package/dist/proposal-to-effect-postgres.d.ts.map +1 -0
- package/dist/proposal-to-effect-postgres.js +1578 -0
- package/dist/proposal-to-effect-postgres.js.map +1 -0
- package/dist/proposal-to-effect-status-head-store.d.ts +72 -0
- package/dist/proposal-to-effect-status-head-store.d.ts.map +1 -0
- package/dist/proposal-to-effect-status-head-store.js +355 -0
- package/dist/proposal-to-effect-status-head-store.js.map +1 -0
- package/dist/proposal-to-effect-status.d.ts +55 -0
- package/dist/proposal-to-effect-status.d.ts.map +1 -0
- package/dist/proposal-to-effect-status.js +294 -0
- package/dist/proposal-to-effect-status.js.map +1 -0
- package/dist/proposal-to-effect.d.ts +151 -3
- package/dist/proposal-to-effect.d.ts.map +1 -1
- package/dist/proposal-to-effect.js +589 -46
- package/dist/proposal-to-effect.js.map +1 -1
- package/dist/remedy-case-set-postgres.d.ts +73 -0
- package/dist/remedy-case-set-postgres.d.ts.map +1 -0
- package/dist/remedy-case-set-postgres.js +846 -0
- package/dist/remedy-case-set-postgres.js.map +1 -0
- package/dist/remedy-case-set.d.ts +53 -0
- package/dist/remedy-case-set.d.ts.map +1 -0
- package/dist/remedy-case-set.js +571 -0
- package/dist/remedy-case-set.js.map +1 -0
- package/dist/remedy-program-adapters.d.ts +137 -0
- package/dist/remedy-program-adapters.d.ts.map +1 -0
- package/dist/remedy-program-adapters.js +590 -0
- package/dist/remedy-program-adapters.js.map +1 -0
- package/dist/trust-program-revocation.js.map +1 -1
- package/package.json +283 -63
- package/proposal-to-effect-postgres.js +3 -0
- package/proposal-to-effect-status-head-store.js +2 -0
- package/proposal-to-effect-status.js +2 -0
- package/remedy-case-set-postgres.js +3 -0
- package/remedy-case-set.js +3 -0
- package/remedy-program-adapters.js +3 -0
- package/src/aeb-consumption-store.ts +568 -0
- package/src/capability-receipt.ts +17 -0
- package/src/index.ts +66 -3
- package/src/proposal-to-effect-postgres.ts +1833 -0
- package/src/proposal-to-effect-status-head-store.ts +449 -0
- package/src/proposal-to-effect-status.ts +388 -0
- package/src/proposal-to-effect.ts +755 -50
- package/src/remedy-case-set-postgres.ts +1008 -0
- package/src/remedy-case-set.ts +603 -0
- package/src/remedy-program-adapters.ts +657 -0
- package/src/trust-program-revocation.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -90,6 +90,7 @@ import {
|
|
|
90
90
|
reconstructCapabilitySecret,
|
|
91
91
|
createMemoryCapabilityStore,
|
|
92
92
|
createPostgresCapabilityStore,
|
|
93
|
+
isSecureCapabilityStore,
|
|
93
94
|
executeWithCapability,
|
|
94
95
|
executeWithThreshold,
|
|
95
96
|
reconcileCapabilityOperation,
|
|
@@ -224,6 +225,7 @@ export {
|
|
|
224
225
|
reconstructCapabilitySecret,
|
|
225
226
|
createMemoryCapabilityStore,
|
|
226
227
|
createPostgresCapabilityStore,
|
|
228
|
+
isSecureCapabilityStore,
|
|
227
229
|
executeWithCapability,
|
|
228
230
|
executeWithThreshold,
|
|
229
231
|
reconcileCapabilityOperation,
|
|
@@ -284,11 +286,62 @@ export {
|
|
|
284
286
|
REMEDY_PROGRAM_POSTGRES_SQL,
|
|
285
287
|
createRemedyProgramPostgresStore,
|
|
286
288
|
} from './remedy-program-postgres.js';
|
|
289
|
+
export {
|
|
290
|
+
REMEDY_PROGRAM_EVIDENCE_VERSION,
|
|
291
|
+
REMEDY_PROGRAM_EVIDENCE_DOMAIN,
|
|
292
|
+
remedyProgramEvidenceDigest,
|
|
293
|
+
remedyProgramEvidenceSigningBytes,
|
|
294
|
+
createRemedyProgramAdapters,
|
|
295
|
+
} from './remedy-program-adapters.js';
|
|
296
|
+
export {
|
|
297
|
+
REMEDY_CASE_SET_VERSION,
|
|
298
|
+
createRemedyCaseSetCoordinator,
|
|
299
|
+
} from './remedy-case-set.js';
|
|
300
|
+
export {
|
|
301
|
+
REMEDY_CASE_SET_PG_STORE_VERSION,
|
|
302
|
+
REMEDY_CASE_SET_TABLE,
|
|
303
|
+
REMEDY_CASE_SET_EVENT_TABLE,
|
|
304
|
+
REMEDY_CASE_SET_MAX_STATE_BYTES,
|
|
305
|
+
REMEDY_CASE_SET_MAX_MANIFEST_BYTES,
|
|
306
|
+
REMEDY_CASE_SET_MAX_FORWARD_SKEW_MINUTES,
|
|
307
|
+
REMEDY_CASE_SET_POSTGRES_DDL,
|
|
308
|
+
REMEDY_CASE_SET_POSTGRES_SQL,
|
|
309
|
+
createRemedyCaseSetPostgresStore,
|
|
310
|
+
} from './remedy-case-set-postgres.js';
|
|
287
311
|
export {
|
|
288
312
|
PROPOSAL_TO_EFFECT_VERSION,
|
|
289
313
|
proposalToEffectConsumptionNonce,
|
|
290
314
|
createProposalToEffect,
|
|
291
315
|
} from './proposal-to-effect.js';
|
|
316
|
+
export {
|
|
317
|
+
PROPOSAL_TO_EFFECT_STATUS_HEAD_STORE_VERSION,
|
|
318
|
+
PROPOSAL_TO_EFFECT_STATUS_HEAD_TABLE,
|
|
319
|
+
PROPOSAL_TO_EFFECT_STATUS_HEAD_SQL,
|
|
320
|
+
createProposalToEffectStatusVerifier,
|
|
321
|
+
createPostgresProposalToEffectStatusHeadStore,
|
|
322
|
+
} from './proposal-to-effect-status.js';
|
|
323
|
+
export type {
|
|
324
|
+
PostgresProposalToEffectStatusHeadStoreOptions,
|
|
325
|
+
ProposalToEffectStatusHeadAcceptance,
|
|
326
|
+
ProposalToEffectStatusHeadAcceptanceInput,
|
|
327
|
+
ProposalToEffectStatusHeadPgClient,
|
|
328
|
+
ProposalToEffectStatusHeadPgPool,
|
|
329
|
+
ProposalToEffectStatusHeadStore,
|
|
330
|
+
} from './proposal-to-effect-status.js';
|
|
331
|
+
export {
|
|
332
|
+
PROPOSAL_TO_EFFECT_POSTGRES_DDL,
|
|
333
|
+
PROPOSAL_TO_EFFECT_POSTGRES_SQL,
|
|
334
|
+
proposalToEffectAttemptDigest,
|
|
335
|
+
createProposalToEffectPostgresStore,
|
|
336
|
+
} from './proposal-to-effect-postgres.js';
|
|
337
|
+
export {
|
|
338
|
+
AEB_PG_CONSUMPTION_STORE_VERSION,
|
|
339
|
+
AEB_CONSUMPTION_OPERATION_TABLE,
|
|
340
|
+
AEB_CONSUMPTION_REPLAY_TABLE,
|
|
341
|
+
AEB_CONSUMPTION_DDL,
|
|
342
|
+
AEB_CONSUMPTION_SQL,
|
|
343
|
+
createPostgresAebDurableConsumptionStore,
|
|
344
|
+
} from './aeb-consumption-store.js';
|
|
292
345
|
export const ASSURANCE_TIERS = ['software', 'class_a', 'quorum'];
|
|
293
346
|
const TIER_RANK = { software: 0, class_a: 1, quorum: 2 };
|
|
294
347
|
const CAPABILITY_FAILURE_STATUS = 409;
|
|
@@ -878,11 +931,13 @@ export function verifyBusinessAuthorization({ requirement, receipt, assurance, t
|
|
|
878
931
|
* @param {object} [opts.store] durable, ownership-fenced, permanent consumption store
|
|
879
932
|
* @param {object} [opts.capabilityStore] Marvel capability budget store. A
|
|
880
933
|
* capability run reserves here before the effect and commits after it.
|
|
934
|
+
* Production stores must explicitly mark durable and reconciliation-capable
|
|
935
|
+
* custody and implement register/reserve/commit/reconcile operations.
|
|
881
936
|
* @param {string[]} [opts.capabilityTrustedIssuerKeys] pinned capability
|
|
882
937
|
* envelope issuer keys. Required when capabilityStore is configured.
|
|
883
938
|
* @param {function|null} [opts.capabilityCaidResolver] relying-party-pinned resolver
|
|
884
939
|
* for `urn:emilia:scope:caid-set-v1`. Missing resolver fails CAID scope closed.
|
|
885
|
-
* @param {boolean} [opts.allowEphemeralStore=false] explicit test/demo opt-in for in-memory state
|
|
940
|
+
* @param {boolean} [opts.allowEphemeralStore=false] explicit test/demo opt-in for in-memory consumption or capability state
|
|
886
941
|
* @param {object} [opts.log] evidence log (default in-memory, hash-chained)
|
|
887
942
|
* @param {boolean} [opts.allowInlineKey=false] accept the receipt's own key (integrity, NOT trust)
|
|
888
943
|
* @param {object} [opts.keyRegistry] a key registry (createKeyRegistry) for rotation + revocation;
|
|
@@ -960,8 +1015,15 @@ export function createGate({ manifest = null, trustedKeys = [], maxAgeSec = 900,
|
|
|
960
1015
|
}
|
|
961
1016
|
if (capabilityStore && (typeof capabilityStore.registerCapability !== 'function'
|
|
962
1017
|
|| typeof capabilityStore.reserveSpend !== 'function'
|
|
963
|
-
|| typeof capabilityStore.commitSpend !== 'function'
|
|
964
|
-
|
|
1018
|
+
|| typeof capabilityStore.commitSpend !== 'function'
|
|
1019
|
+
|| typeof capabilityStore.reconcileSpend !== 'function')) {
|
|
1020
|
+
throw new Error('EMILIA Gate capabilityStore must implement registerCapability(), reserveSpend(), commitSpend(), and reconcileSpend()');
|
|
1021
|
+
}
|
|
1022
|
+
if (capabilityStore && !allowEphemeralStore && !isSecureCapabilityStore(capabilityStore)) {
|
|
1023
|
+
throw new Error(
|
|
1024
|
+
'EMILIA Gate capabilityStore must be durable and reconciliation-capable. '
|
|
1025
|
+
+ 'Pass allowEphemeralStore:true only for an explicit test/demo gate.',
|
|
1026
|
+
);
|
|
965
1027
|
}
|
|
966
1028
|
if (capabilityStore && (!Array.isArray(capabilityTrustedIssuerKeys)
|
|
967
1029
|
|| capabilityTrustedIssuerKeys.length === 0
|
|
@@ -2114,6 +2176,7 @@ export default {
|
|
|
2114
2176
|
reconstructCapabilitySecret,
|
|
2115
2177
|
createMemoryCapabilityStore,
|
|
2116
2178
|
createPostgresCapabilityStore,
|
|
2179
|
+
isSecureCapabilityStore,
|
|
2117
2180
|
executeWithCapability,
|
|
2118
2181
|
executeWithThreshold,
|
|
2119
2182
|
reconcileCapabilityOperation,
|