@emilia-protocol/gate 0.18.2 → 0.20.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.
- package/CHANGELOG.md +56 -0
- package/README.md +64 -0
- package/action-refusal-statement.js +1 -0
- package/coverage-reconciliation-attestation.js +1 -0
- package/dist/action-refusal-statement.d.ts +109 -0
- package/dist/action-refusal-statement.d.ts.map +1 -0
- package/dist/action-refusal-statement.js +333 -0
- package/dist/action-refusal-statement.js.map +1 -0
- package/dist/coverage-reconciliation-attestation.d.ts +29 -0
- package/dist/coverage-reconciliation-attestation.d.ts.map +1 -0
- package/dist/coverage-reconciliation-attestation.js +111 -0
- package/dist/coverage-reconciliation-attestation.js.map +1 -0
- package/dist/gate-qualification-v2.d.ts +4 -0
- package/dist/gate-qualification-v2.d.ts.map +1 -1
- package/dist/gate-qualification-v2.js +39 -47
- package/dist/gate-qualification-v2.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/loss-allocation-schedule.d.ts +53 -0
- package/dist/loss-allocation-schedule.d.ts.map +1 -0
- package/dist/loss-allocation-schedule.js +351 -0
- package/dist/loss-allocation-schedule.js.map +1 -0
- package/dist/loss-experience-feed.d.ts +82 -0
- package/dist/loss-experience-feed.d.ts.map +1 -0
- package/dist/loss-experience-feed.js +314 -0
- package/dist/loss-experience-feed.js.map +1 -0
- package/dist/open-exposure-ledger-postgres.d.ts +40 -0
- package/dist/open-exposure-ledger-postgres.d.ts.map +1 -0
- package/dist/open-exposure-ledger-postgres.js +577 -0
- package/dist/open-exposure-ledger-postgres.js.map +1 -0
- package/dist/open-exposure-ledger.d.ts +243 -0
- package/dist/open-exposure-ledger.d.ts.map +1 -0
- package/dist/open-exposure-ledger.js +794 -0
- package/dist/open-exposure-ledger.js.map +1 -0
- package/dist/receipt-census.d.ts +21 -0
- package/dist/receipt-census.d.ts.map +1 -0
- package/dist/receipt-census.js +162 -0
- package/dist/receipt-census.js.map +1 -0
- package/dist/reliance-program.d.ts +88 -0
- package/dist/reliance-program.d.ts.map +1 -0
- package/dist/reliance-program.js +437 -0
- package/dist/reliance-program.js.map +1 -0
- package/dist/reliance-risk-crypto.d.ts +28 -0
- package/dist/reliance-risk-crypto.d.ts.map +1 -0
- package/dist/reliance-risk-crypto.js +110 -0
- package/dist/reliance-risk-crypto.js.map +1 -0
- package/dist/remedy-program.d.ts.map +1 -1
- package/dist/remedy-program.js +28 -18
- package/dist/remedy-program.js.map +1 -1
- package/loss-allocation-schedule.js +1 -0
- package/loss-experience-feed.js +1 -0
- package/open-exposure-ledger-postgres.js +1 -0
- package/open-exposure-ledger.js +1 -0
- package/package.json +42 -2
- package/receipt-census.js +1 -0
- package/reliance-program.js +3 -0
- package/src/action-refusal-statement.ts +396 -0
- package/src/coverage-reconciliation-attestation.ts +107 -0
- package/src/gate-qualification-v2.ts +56 -46
- package/src/index.ts +7 -0
- package/src/loss-allocation-schedule.ts +427 -0
- package/src/loss-experience-feed.ts +398 -0
- package/src/open-exposure-ledger-postgres.ts +701 -0
- package/src/open-exposure-ledger.ts +1213 -0
- package/src/receipt-census.ts +163 -0
- package/src/reliance-program.ts +499 -0
- package/src/reliance-risk-crypto.ts +114 -0
- package/src/remedy-program.ts +28 -17
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,62 @@
|
|
|
4
4
|
All notable changes to `@emilia-protocol/gate` are documented here.
|
|
5
5
|
This package follows [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## 0.20.0 (2026-07-28)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- A separately signed Loss-Allocation Schedule pinned to an exact Reliance
|
|
12
|
+
Program through a relying-party-owned Admissibility Profile.
|
|
13
|
+
- An Open Exposure Ledger with aggregate ceilings across tenant, program,
|
|
14
|
+
counterparty, and action class; durable PostgreSQL custody; and mandatory
|
|
15
|
+
independent reconciliation for indeterminate execution.
|
|
16
|
+
- Exact-action signed refusal statements with atomic replay acceptance and
|
|
17
|
+
optional delivery, custody, and transparency evidence references.
|
|
18
|
+
- Period Coverage Reconciliation Attestations, governed-taxonomy Receipt Census
|
|
19
|
+
aggregates with coarse primary suppression, and signed external Loss
|
|
20
|
+
Experience Feeds with trusted correction lineage.
|
|
21
|
+
- A bounded composed lifecycle model and runtime-refinement trace covering
|
|
22
|
+
admission, exposure reservation, invocation, uncertainty, reconciliation,
|
|
23
|
+
refusal, and terminal-state preservation.
|
|
24
|
+
|
|
25
|
+
### Security
|
|
26
|
+
|
|
27
|
+
- Loss schedules, refusal statements, coverage attestations, and loss feeds
|
|
28
|
+
remain separate from authorization and cannot create execution authority.
|
|
29
|
+
- Open exposure remains reserved through `INVOKING` and `INDETERMINATE`; there
|
|
30
|
+
is no blind release or retry, and origin, executor, and reconciler authority
|
|
31
|
+
must remain distinct.
|
|
32
|
+
- Coverage and census artifacts reconcile only supplied populations. They do
|
|
33
|
+
not establish completeness, causation, insurance coverage, legal liability,
|
|
34
|
+
adjudicated loss, solvency, or payment.
|
|
35
|
+
|
|
36
|
+
## 0.19.0 (2026-07-28)
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- `./reliance-program`, a closed, relying-party-signed source policy and
|
|
41
|
+
deterministic compiler to the existing
|
|
42
|
+
`EP-GATE-TRUST-PROGRAM-PROFILE-v1` wire format.
|
|
43
|
+
- Admissibility Profile references as digest-pinned program fragments, with a
|
|
44
|
+
relying-party-owned evaluator adapter that prevents presenters from choosing
|
|
45
|
+
the acceptance bar.
|
|
46
|
+
- A public JSON Schema, compiler trace, and explicit consequence ownership by
|
|
47
|
+
either a receipt program or Action Escrow.
|
|
48
|
+
|
|
49
|
+
### Security
|
|
50
|
+
|
|
51
|
+
- Gate now pins the independently published
|
|
52
|
+
`@emilia-protocol/verify@3.17.0` registry tarball. Reliance Program decision
|
|
53
|
+
citations therefore execute against the exact AEB/AEC verifier release whose
|
|
54
|
+
bytes are recorded in the governed package registry.
|
|
55
|
+
- Compilation requires an Ed25519 signer whose pinned key is bound to the
|
|
56
|
+
named relying party, recomputes every profile self-hash, and refuses unknown
|
|
57
|
+
fields, substituted profiles, disconnected stages, action drift, and
|
|
58
|
+
ambiguous consequence ownership.
|
|
59
|
+
- Compilation proves only that the signed source maps to the existing Trust
|
|
60
|
+
Program. It does not assert evidence sufficiency, authorization, provider
|
|
61
|
+
outcome, observed effect, or deployment completion.
|
|
62
|
+
|
|
7
63
|
## 0.18.2 (2026-07-27)
|
|
8
64
|
|
|
9
65
|
### Added
|
package/README.md
CHANGED
|
@@ -59,6 +59,48 @@ if (!out.ok) throw out.body; // 428 Receipt Required
|
|
|
59
59
|
console.log(out.packet.verdict); // "rely"
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
## Customer-owned Reliance Programs
|
|
63
|
+
|
|
64
|
+
`@emilia-protocol/gate/reliance-program` turns a relying party's signed policy
|
|
65
|
+
source into the existing Gate Trust Program wire format. It does not add a
|
|
66
|
+
second authorization engine. An Admissibility Profile remains the acceptance
|
|
67
|
+
bar for one evidence role; a Reliance Program composes those hash-pinned bars
|
|
68
|
+
across stages and selects exactly one consequence owner.
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import {
|
|
72
|
+
compileRelianceProgram,
|
|
73
|
+
createAdmissibilityProfileTrustAdapter,
|
|
74
|
+
signRelianceProgram,
|
|
75
|
+
} from '@emilia-protocol/gate/reliance-program';
|
|
76
|
+
|
|
77
|
+
const signed = signRelianceProgram(customerOwnedSource, rpPrivateKey);
|
|
78
|
+
const compiled = compileRelianceProgram(signed, {
|
|
79
|
+
trustedKeys: {
|
|
80
|
+
'rp-key-1': {
|
|
81
|
+
relying_party_id: 'payer:example',
|
|
82
|
+
public_key: rpPublicKey,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
profiles: relyingPartyPinnedAdmissibilityProfiles,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// `compiled.program` is EP-GATE-TRUST-PROGRAM-PROFILE-v1.
|
|
89
|
+
// The adapter runs the already-shipped profile evaluator under a constructor-
|
|
90
|
+
// pinned profile; the presenter supplies evidence, never policy or trust roots.
|
|
91
|
+
const verifier = createAdmissibilityProfileTrustAdapter({
|
|
92
|
+
profile: relyingPartyPinnedAdmissibilityProfiles[0],
|
|
93
|
+
evaluate: evaluateAdmissibilityProfile,
|
|
94
|
+
project: projectVerifiedPrincipalsAndTimes,
|
|
95
|
+
now: () => new Date().toISOString(),
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The signed source, its `source_digest`, the compiled `program_digest`, and the
|
|
100
|
+
compiler trace remain distinct. Compilation proves a deterministic policy
|
|
101
|
+
mapping; it does not prove that evidence is sufficient, authorize an action, or
|
|
102
|
+
claim an external effect occurred.
|
|
103
|
+
|
|
62
104
|
## Gate Qualification v2
|
|
63
105
|
|
|
64
106
|
Gate Qualification v2 treats model or agent qualification as one input to a
|
|
@@ -778,6 +820,28 @@ consequential actions by default**, so the parties with leverage (clouds, paymen
|
|
|
778
820
|
insurers) can *require* a receipt — and "no receipt" becomes like "no TLS cert" or "unsigned binary":
|
|
779
821
|
not always illegal, just untrusted. Necessary, not sufficient.
|
|
780
822
|
|
|
823
|
+
## Reliance risk plane
|
|
824
|
+
|
|
825
|
+
Gate `0.20.0` adds a consequence-risk plane around the existing Reliance
|
|
826
|
+
Program and execution lifecycle:
|
|
827
|
+
|
|
828
|
+
- `./loss-allocation-schedule` verifies separately signed, exact-program terms;
|
|
829
|
+
- `./open-exposure-ledger` and `./open-exposure-ledger-postgres` reserve and
|
|
830
|
+
aggregate open exposure before provider invocation;
|
|
831
|
+
- `./action-refusal-statement` emits a signed exact-action technical refusal;
|
|
832
|
+
- `./coverage-reconciliation-attestation` reconciles supplied effect and
|
|
833
|
+
receipt populations for a bounded period;
|
|
834
|
+
- `./receipt-census` emits governed-taxonomy aggregates with coarse primary suppression; and
|
|
835
|
+
- `./loss-experience-feed` carries signed external observations whose
|
|
836
|
+
corrections require a trusted current-head lineage resolver.
|
|
837
|
+
|
|
838
|
+
These artifacts do not create authority. EMILIA does not bear or allocate loss,
|
|
839
|
+
adjudicate disputes, verify insurance coverage or solvency, or move money.
|
|
840
|
+
Open exposure is an operational ceiling: an `INDETERMINATE` provider outcome
|
|
841
|
+
stays open until an independent reconciler supplies authenticated evidence.
|
|
842
|
+
See `docs/architecture/RELIANCE-RISK-PLANE.md` for the composed state model and
|
|
843
|
+
claim boundaries.
|
|
844
|
+
|
|
781
845
|
## Standards
|
|
782
846
|
|
|
783
847
|
The mechanism is specified in `draft-schrock-ep-enforcement-point` (the Receipt-Required rail) over
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/action-refusal-statement.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/coverage-reconciliation-attestation.js';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact-action technical refusal evidence. It is not a legal determination,
|
|
3
|
+
* an adverse-benefit denial, an authorization grant, or proof of delivery.
|
|
4
|
+
*/
|
|
5
|
+
import { type RiskRecord, type TrustedRiskKeys } from './reliance-risk-crypto.js';
|
|
6
|
+
export declare const ACTION_REFUSAL_STATEMENT_VERSION = "EP-ACTION-REFUSAL-STATEMENT-v1";
|
|
7
|
+
export declare const ACTION_REFUSAL_CLAIM_BOUNDARY = "technical_refusal_not_legal_or_benefit_determination";
|
|
8
|
+
export declare const ACTION_REFUSAL_CLASSES: readonly string[];
|
|
9
|
+
export type ActionRefusalExpectedBindings = {
|
|
10
|
+
caid?: string;
|
|
11
|
+
action_digest?: string;
|
|
12
|
+
relying_party_id?: string;
|
|
13
|
+
program_id?: string;
|
|
14
|
+
program_version?: number;
|
|
15
|
+
source_digest?: string;
|
|
16
|
+
program_digest?: string;
|
|
17
|
+
nonce?: string;
|
|
18
|
+
};
|
|
19
|
+
export type ActionRefusalReplayStore = {
|
|
20
|
+
durable: boolean;
|
|
21
|
+
consume(relyingPartyId: string, nonce: string, refusalDigest: string): Promise<{
|
|
22
|
+
accepted: boolean;
|
|
23
|
+
reason: string | null;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
export declare function signActionRefusalStatement(input: RiskRecord, signer: {
|
|
27
|
+
issuer_id: string;
|
|
28
|
+
key_id: string;
|
|
29
|
+
private_key: any;
|
|
30
|
+
}): RiskRecord;
|
|
31
|
+
export declare function actionRefusalStatementDigest(statement: unknown): string;
|
|
32
|
+
export declare function verifyActionRefusalStatement(statement: unknown, options?: {
|
|
33
|
+
trusted_keys?: TrustedRiskKeys;
|
|
34
|
+
now?: string | number;
|
|
35
|
+
max_future_skew_sec?: number;
|
|
36
|
+
expected?: ActionRefusalExpectedBindings;
|
|
37
|
+
}): {
|
|
38
|
+
accepted: false;
|
|
39
|
+
verified: false;
|
|
40
|
+
reason: string;
|
|
41
|
+
refusal_digest: string | null;
|
|
42
|
+
semantics: null;
|
|
43
|
+
delivery_evidence: "NOT_EVIDENCED";
|
|
44
|
+
custody_evidence: "NOT_EVIDENCED";
|
|
45
|
+
transparency_anchor: "NOT_REFERENCED";
|
|
46
|
+
claim_boundary: string;
|
|
47
|
+
} | {
|
|
48
|
+
accepted: true;
|
|
49
|
+
verified: true;
|
|
50
|
+
reason: null;
|
|
51
|
+
refusal_digest: string | null;
|
|
52
|
+
relying_party_id: any;
|
|
53
|
+
nonce: any;
|
|
54
|
+
semantics: any;
|
|
55
|
+
delivery_evidence: string;
|
|
56
|
+
custody_evidence: string;
|
|
57
|
+
transparency_anchor: string;
|
|
58
|
+
claim_boundary: string;
|
|
59
|
+
};
|
|
60
|
+
export declare function createMemoryActionRefusalReplayStore(): ActionRefusalReplayStore;
|
|
61
|
+
export declare function acceptActionRefusalStatement(statement: unknown, options?: {
|
|
62
|
+
trusted_keys?: TrustedRiskKeys;
|
|
63
|
+
now?: string | number;
|
|
64
|
+
max_future_skew_sec?: number;
|
|
65
|
+
expected?: ActionRefusalExpectedBindings;
|
|
66
|
+
replayStore?: ActionRefusalReplayStore;
|
|
67
|
+
allowEphemeralReplayStore?: boolean;
|
|
68
|
+
}): Promise<{
|
|
69
|
+
accepted: false;
|
|
70
|
+
reason: string;
|
|
71
|
+
replay_checked: boolean;
|
|
72
|
+
replay_store_durable: boolean;
|
|
73
|
+
verified: false;
|
|
74
|
+
refusal_digest: string | null;
|
|
75
|
+
semantics: null;
|
|
76
|
+
delivery_evidence: "NOT_EVIDENCED";
|
|
77
|
+
custody_evidence: "NOT_EVIDENCED";
|
|
78
|
+
transparency_anchor: "NOT_REFERENCED";
|
|
79
|
+
claim_boundary: string;
|
|
80
|
+
} | {
|
|
81
|
+
accepted: false;
|
|
82
|
+
reason: string;
|
|
83
|
+
replay_checked: boolean;
|
|
84
|
+
replay_store_durable: boolean;
|
|
85
|
+
verified: true;
|
|
86
|
+
refusal_digest: string | null;
|
|
87
|
+
relying_party_id: any;
|
|
88
|
+
nonce: any;
|
|
89
|
+
semantics: any;
|
|
90
|
+
delivery_evidence: string;
|
|
91
|
+
custody_evidence: string;
|
|
92
|
+
transparency_anchor: string;
|
|
93
|
+
claim_boundary: string;
|
|
94
|
+
} | {
|
|
95
|
+
accepted: true;
|
|
96
|
+
replay_checked: boolean;
|
|
97
|
+
replay_store_durable: boolean;
|
|
98
|
+
verified: true;
|
|
99
|
+
reason: null;
|
|
100
|
+
refusal_digest: string | null;
|
|
101
|
+
relying_party_id: any;
|
|
102
|
+
nonce: any;
|
|
103
|
+
semantics: any;
|
|
104
|
+
delivery_evidence: string;
|
|
105
|
+
custody_evidence: string;
|
|
106
|
+
transparency_anchor: string;
|
|
107
|
+
claim_boundary: string;
|
|
108
|
+
}>;
|
|
109
|
+
//# sourceMappingURL=action-refusal-statement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-refusal-statement.d.ts","sourceRoot":"","sources":["../src/action-refusal-statement.ts"],"names":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,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,6BAA6B,CAAC;CACrC;;;;;;;;;;;;;;;;;;;;;;EA2CL;AAED,wBAAgB,oCAAoC,IAAI,wBAAwB,CAe/E;AAED,wBAAsB,4BAA4B,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,GAAE;IAC9E,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,6BAA6B,CAAC;IACzC,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CL"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Exact-action technical refusal evidence. It is not a legal determination,
|
|
5
|
+
* an adverse-benefit denial, an authorization grant, or proof of delivery.
|
|
6
|
+
*/
|
|
7
|
+
import { RISK_CAID, RISK_DIGEST, riskClone, riskDigest, riskExact, riskIdentifier, riskInstant, riskRecord, signRiskBody, verifyRiskBody, } from './reliance-risk-crypto.js';
|
|
8
|
+
export const ACTION_REFUSAL_STATEMENT_VERSION = 'EP-ACTION-REFUSAL-STATEMENT-v1';
|
|
9
|
+
export const ACTION_REFUSAL_CLAIM_BOUNDARY = 'technical_refusal_not_legal_or_benefit_determination';
|
|
10
|
+
export const ACTION_REFUSAL_CLASSES = Object.freeze([
|
|
11
|
+
'verification_failed',
|
|
12
|
+
'action_mismatch',
|
|
13
|
+
'evidence_unsatisfied',
|
|
14
|
+
'authorization_refused',
|
|
15
|
+
'replay_detected',
|
|
16
|
+
'expired',
|
|
17
|
+
'indeterminate',
|
|
18
|
+
]);
|
|
19
|
+
const PROGRAM_KEYS = ['program_id', 'version', 'source_digest', 'program_digest'];
|
|
20
|
+
const DELIVERY_KEYS = ['channel', 'recipient_id', 'delivered_at', 'custody_digest'];
|
|
21
|
+
const CUSTODY_KEYS = ['custodian_id', 'acknowledged_at', 'evidence_digest'];
|
|
22
|
+
const ANCHOR_KEYS = ['method', 'evidence_digest'];
|
|
23
|
+
const SEMANTIC_KEYS = ['verification', 'match', 'satisfaction', 'authorization'];
|
|
24
|
+
const BODY_KEYS = [
|
|
25
|
+
'@version', 'refusal_id', 'relying_party_id', 'caid', 'action_digest',
|
|
26
|
+
'program', 'failed_requirement_ids', 'evidence_digests',
|
|
27
|
+
'challenge_digests', 'nonce', 'refused_at', 'expires_at', 'refusal_class',
|
|
28
|
+
'semantics', 'delivery', 'custody', 'transparency_anchor', 'claim_boundary',
|
|
29
|
+
];
|
|
30
|
+
const INPUT_KEYS = new Set([
|
|
31
|
+
...BODY_KEYS.filter((key) => key !== '@version' && key !== 'semantics'
|
|
32
|
+
&& key !== 'delivery' && key !== 'custody' && key !== 'transparency_anchor'
|
|
33
|
+
&& key !== 'challenge_digests'),
|
|
34
|
+
'semantics', 'delivery', 'custody', 'transparency_anchor',
|
|
35
|
+
'challenge_digest', 'challenge_digests',
|
|
36
|
+
]);
|
|
37
|
+
const EXPECTED_KEYS = [
|
|
38
|
+
'caid', 'action_digest', 'relying_party_id', 'program_id', 'program_version',
|
|
39
|
+
'source_digest', 'program_digest', 'nonce',
|
|
40
|
+
];
|
|
41
|
+
const VERIFICATION = new Set(['VERIFIED', 'NOT_VERIFIED', 'INDETERMINATE']);
|
|
42
|
+
const MATCH = new Set(['MATCH', 'MISMATCH', 'INDETERMINATE']);
|
|
43
|
+
const SATISFACTION = new Set(['SATISFIED', 'NOT_SATISFIED', 'INDETERMINATE']);
|
|
44
|
+
const AUTHORIZATION = new Set(['AUTHORIZED', 'NOT_AUTHORIZED', 'NOT_EVALUATED', 'INDETERMINATE']);
|
|
45
|
+
function canonicalSet(value, validator, maximum, requireNonEmpty) {
|
|
46
|
+
if (!Array.isArray(value) || value.length > maximum
|
|
47
|
+
|| (requireNonEmpty && value.length === 0) || !value.every(validator)
|
|
48
|
+
|| new Set(value).size !== value.length)
|
|
49
|
+
return false;
|
|
50
|
+
return value.every((entry, index) => index === 0
|
|
51
|
+
|| Buffer.from(value[index - 1]).compare(Buffer.from(entry)) < 0);
|
|
52
|
+
}
|
|
53
|
+
function sortedUnique(value, validator, maximum, label, requireNonEmpty) {
|
|
54
|
+
if (!Array.isArray(value) || value.length > maximum
|
|
55
|
+
|| (requireNonEmpty && value.length === 0) || !value.every(validator)) {
|
|
56
|
+
throw new TypeError(`action refusal ${label} are invalid`);
|
|
57
|
+
}
|
|
58
|
+
if (new Set(value).size !== value.length) {
|
|
59
|
+
throw new TypeError(`action refusal ${label} are duplicate`);
|
|
60
|
+
}
|
|
61
|
+
return [...value].sort((left, right) => Buffer.from(left).compare(Buffer.from(right)));
|
|
62
|
+
}
|
|
63
|
+
function defaultSemantics(refusalClass) {
|
|
64
|
+
const base = {
|
|
65
|
+
verification: 'VERIFIED',
|
|
66
|
+
match: 'MATCH',
|
|
67
|
+
satisfaction: 'NOT_SATISFIED',
|
|
68
|
+
authorization: 'NOT_EVALUATED',
|
|
69
|
+
};
|
|
70
|
+
if (refusalClass === 'verification_failed')
|
|
71
|
+
return { ...base, verification: 'NOT_VERIFIED' };
|
|
72
|
+
if (refusalClass === 'action_mismatch')
|
|
73
|
+
return { ...base, match: 'MISMATCH' };
|
|
74
|
+
if (refusalClass === 'authorization_refused')
|
|
75
|
+
return { ...base, authorization: 'NOT_AUTHORIZED' };
|
|
76
|
+
if (refusalClass === 'indeterminate')
|
|
77
|
+
return { ...base, satisfaction: 'INDETERMINATE' };
|
|
78
|
+
return base;
|
|
79
|
+
}
|
|
80
|
+
function validSemantics(value, refusalClass) {
|
|
81
|
+
if (!riskExact(value, SEMANTIC_KEYS)
|
|
82
|
+
|| !VERIFICATION.has(value.verification) || !MATCH.has(value.match)
|
|
83
|
+
|| !SATISFACTION.has(value.satisfaction) || !AUTHORIZATION.has(value.authorization)
|
|
84
|
+
|| value.satisfaction === 'SATISFIED')
|
|
85
|
+
return false;
|
|
86
|
+
if (refusalClass === 'verification_failed')
|
|
87
|
+
return value.verification === 'NOT_VERIFIED';
|
|
88
|
+
if (refusalClass === 'action_mismatch')
|
|
89
|
+
return value.match === 'MISMATCH';
|
|
90
|
+
if (refusalClass === 'evidence_unsatisfied')
|
|
91
|
+
return value.satisfaction === 'NOT_SATISFIED';
|
|
92
|
+
if (refusalClass === 'authorization_refused')
|
|
93
|
+
return value.authorization === 'NOT_AUTHORIZED';
|
|
94
|
+
if (refusalClass === 'indeterminate')
|
|
95
|
+
return Object.values(value).includes('INDETERMINATE');
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
function validate(value) {
|
|
99
|
+
if (!riskRecord(value))
|
|
100
|
+
throw new TypeError('action refusal statement shape is invalid');
|
|
101
|
+
const { issuer, ...body } = value;
|
|
102
|
+
if (issuer !== undefined && (!riskExact(issuer, ['id', 'key_id'])
|
|
103
|
+
|| !riskIdentifier(issuer.id) || !riskIdentifier(issuer.key_id))) {
|
|
104
|
+
throw new TypeError('action refusal issuer is invalid');
|
|
105
|
+
}
|
|
106
|
+
if (!riskExact(body, BODY_KEYS) || body['@version'] !== ACTION_REFUSAL_STATEMENT_VERSION
|
|
107
|
+
|| !riskIdentifier(body.refusal_id) || !riskIdentifier(body.relying_party_id)
|
|
108
|
+
|| typeof body.caid !== 'string' || !RISK_CAID.test(body.caid)
|
|
109
|
+
|| typeof body.action_digest !== 'string' || !RISK_DIGEST.test(body.action_digest)
|
|
110
|
+
|| !riskExact(body.program, PROGRAM_KEYS) || !riskIdentifier(body.program.program_id)
|
|
111
|
+
|| !Number.isSafeInteger(body.program.version) || body.program.version < 1
|
|
112
|
+
|| typeof body.program.source_digest !== 'string' || !RISK_DIGEST.test(body.program.source_digest)
|
|
113
|
+
|| typeof body.program.program_digest !== 'string' || !RISK_DIGEST.test(body.program.program_digest)
|
|
114
|
+
|| !riskIdentifier(body.nonce) || !ACTION_REFUSAL_CLASSES.includes(body.refusal_class)
|
|
115
|
+
|| !validSemantics(body.semantics, body.refusal_class)
|
|
116
|
+
|| body.claim_boundary !== ACTION_REFUSAL_CLAIM_BOUNDARY) {
|
|
117
|
+
throw new TypeError('action refusal statement shape is invalid');
|
|
118
|
+
}
|
|
119
|
+
if (!canonicalSet(body.failed_requirement_ids, riskIdentifier, 128, true)) {
|
|
120
|
+
throw new TypeError('action refusal requirements are invalid, duplicate, or unsorted');
|
|
121
|
+
}
|
|
122
|
+
if (!canonicalSet(body.evidence_digests, (entry) => typeof entry === 'string' && RISK_DIGEST.test(entry), 256, false) || !canonicalSet(body.challenge_digests, (entry) => typeof entry === 'string' && RISK_DIGEST.test(entry), 256, true))
|
|
123
|
+
throw new TypeError('action refusal evidence or challenge binding is invalid');
|
|
124
|
+
const refused = riskInstant(body.refused_at);
|
|
125
|
+
const expires = riskInstant(body.expires_at);
|
|
126
|
+
if (!Number.isFinite(refused) || !Number.isFinite(expires) || expires <= refused) {
|
|
127
|
+
throw new TypeError('action refusal time window is invalid');
|
|
128
|
+
}
|
|
129
|
+
if (body.delivery !== null && (!riskExact(body.delivery, DELIVERY_KEYS)
|
|
130
|
+
|| !riskIdentifier(body.delivery.channel) || !riskIdentifier(body.delivery.recipient_id)
|
|
131
|
+
|| !Number.isFinite(riskInstant(body.delivery.delivered_at))
|
|
132
|
+
|| riskInstant(body.delivery.delivered_at) < refused
|
|
133
|
+
|| riskInstant(body.delivery.delivered_at) > expires
|
|
134
|
+
|| typeof body.delivery.custody_digest !== 'string'
|
|
135
|
+
|| !RISK_DIGEST.test(body.delivery.custody_digest))) {
|
|
136
|
+
throw new TypeError('action refusal delivery evidence is invalid');
|
|
137
|
+
}
|
|
138
|
+
if (body.custody !== null && (body.delivery === null
|
|
139
|
+
|| !riskExact(body.custody, CUSTODY_KEYS)
|
|
140
|
+
|| !riskIdentifier(body.custody.custodian_id)
|
|
141
|
+
|| !Number.isFinite(riskInstant(body.custody.acknowledged_at))
|
|
142
|
+
|| riskInstant(body.custody.acknowledged_at) < riskInstant(body.delivery.delivered_at)
|
|
143
|
+
|| riskInstant(body.custody.acknowledged_at) > expires
|
|
144
|
+
|| typeof body.custody.evidence_digest !== 'string'
|
|
145
|
+
|| !RISK_DIGEST.test(body.custody.evidence_digest))) {
|
|
146
|
+
throw new TypeError('action refusal custody evidence is invalid');
|
|
147
|
+
}
|
|
148
|
+
if (body.transparency_anchor !== null && (!riskExact(body.transparency_anchor, ANCHOR_KEYS)
|
|
149
|
+
|| !riskIdentifier(body.transparency_anchor.method)
|
|
150
|
+
|| typeof body.transparency_anchor.evidence_digest !== 'string'
|
|
151
|
+
|| !RISK_DIGEST.test(body.transparency_anchor.evidence_digest))) {
|
|
152
|
+
throw new TypeError('action refusal transparency anchor is invalid');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function normalizedInput(input) {
|
|
156
|
+
const required = [
|
|
157
|
+
'refusal_id', 'relying_party_id', 'caid', 'action_digest', 'program',
|
|
158
|
+
'failed_requirement_ids', 'evidence_digests', 'nonce', 'refused_at',
|
|
159
|
+
'expires_at', 'refusal_class', 'claim_boundary',
|
|
160
|
+
];
|
|
161
|
+
if (!riskRecord(input) || !required.every((key) => Object.hasOwn(input, key))
|
|
162
|
+
|| !Object.keys(input).every((key) => INPUT_KEYS.has(key))
|
|
163
|
+
|| (Object.hasOwn(input, 'challenge_digest') === Object.hasOwn(input, 'challenge_digests'))) {
|
|
164
|
+
throw new TypeError('action refusal input shape is invalid');
|
|
165
|
+
}
|
|
166
|
+
const rawChallenges = input.challenge_digests ?? [input.challenge_digest];
|
|
167
|
+
return {
|
|
168
|
+
'@version': ACTION_REFUSAL_STATEMENT_VERSION,
|
|
169
|
+
refusal_id: input.refusal_id,
|
|
170
|
+
relying_party_id: input.relying_party_id,
|
|
171
|
+
caid: input.caid,
|
|
172
|
+
action_digest: input.action_digest,
|
|
173
|
+
program: input.program,
|
|
174
|
+
failed_requirement_ids: sortedUnique(input.failed_requirement_ids, riskIdentifier, 128, 'requirements', true),
|
|
175
|
+
evidence_digests: sortedUnique(input.evidence_digests, (entry) => typeof entry === 'string' && RISK_DIGEST.test(entry), 256, 'evidence digests', false),
|
|
176
|
+
challenge_digests: sortedUnique(rawChallenges, (entry) => typeof entry === 'string' && RISK_DIGEST.test(entry), 256, 'challenge digests', true),
|
|
177
|
+
nonce: input.nonce,
|
|
178
|
+
refused_at: input.refused_at,
|
|
179
|
+
expires_at: input.expires_at,
|
|
180
|
+
refusal_class: input.refusal_class,
|
|
181
|
+
semantics: input.semantics ?? defaultSemantics(input.refusal_class),
|
|
182
|
+
delivery: input.delivery ?? null,
|
|
183
|
+
custody: input.custody ?? null,
|
|
184
|
+
transparency_anchor: input.transparency_anchor ?? null,
|
|
185
|
+
claim_boundary: input.claim_boundary,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
export function signActionRefusalStatement(input, signer) {
|
|
189
|
+
const body = normalizedInput(input);
|
|
190
|
+
validate(body);
|
|
191
|
+
return signRiskBody(ACTION_REFUSAL_STATEMENT_VERSION, body, signer);
|
|
192
|
+
}
|
|
193
|
+
export function actionRefusalStatementDigest(statement) {
|
|
194
|
+
return riskDigest(statement);
|
|
195
|
+
}
|
|
196
|
+
function expectedMismatch(body, expected) {
|
|
197
|
+
if (expected === undefined)
|
|
198
|
+
return null;
|
|
199
|
+
if (!riskRecord(expected) || !Object.keys(expected).every((key) => EXPECTED_KEYS.includes(key))) {
|
|
200
|
+
return 'expected_binding_invalid';
|
|
201
|
+
}
|
|
202
|
+
const bindings = {
|
|
203
|
+
caid: body.caid,
|
|
204
|
+
action_digest: body.action_digest,
|
|
205
|
+
relying_party_id: body.relying_party_id,
|
|
206
|
+
program_id: body.program.program_id,
|
|
207
|
+
program_version: body.program.version,
|
|
208
|
+
source_digest: body.program.source_digest,
|
|
209
|
+
program_digest: body.program.program_digest,
|
|
210
|
+
nonce: body.nonce,
|
|
211
|
+
};
|
|
212
|
+
for (const key of Object.keys(expected)) {
|
|
213
|
+
if (bindings[key] !== expected[key])
|
|
214
|
+
return `${key}_mismatch`;
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
export function verifyActionRefusalStatement(statement, options = {}) {
|
|
219
|
+
const refuse = (reason, refusalDigest = null) => ({
|
|
220
|
+
accepted: false,
|
|
221
|
+
verified: false,
|
|
222
|
+
reason,
|
|
223
|
+
refusal_digest: refusalDigest,
|
|
224
|
+
semantics: null,
|
|
225
|
+
delivery_evidence: 'NOT_EVIDENCED',
|
|
226
|
+
custody_evidence: 'NOT_EVIDENCED',
|
|
227
|
+
transparency_anchor: 'NOT_REFERENCED',
|
|
228
|
+
claim_boundary: ACTION_REFUSAL_CLAIM_BOUNDARY,
|
|
229
|
+
});
|
|
230
|
+
const signed = verifyRiskBody(statement, ACTION_REFUSAL_STATEMENT_VERSION, options.trusted_keys);
|
|
231
|
+
if (!signed.valid || !signed.body)
|
|
232
|
+
return refuse(signed.reason ?? 'refusal_invalid');
|
|
233
|
+
try {
|
|
234
|
+
validate(signed.body);
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
return refuse('refusal_schema_invalid', signed.artifact_digest);
|
|
238
|
+
}
|
|
239
|
+
const now = options.now === undefined
|
|
240
|
+
? Date.now() : (typeof options.now === 'string' ? Date.parse(options.now) : Number(options.now));
|
|
241
|
+
const skew = options.max_future_skew_sec ?? 30;
|
|
242
|
+
if (!Number.isFinite(now) || !Number.isSafeInteger(skew) || skew < 0 || skew > 3600) {
|
|
243
|
+
return refuse('verification_time_invalid', signed.artifact_digest);
|
|
244
|
+
}
|
|
245
|
+
if (riskInstant(signed.body.refused_at) > now + skew * 1000) {
|
|
246
|
+
return refuse('refusal_from_future', signed.artifact_digest);
|
|
247
|
+
}
|
|
248
|
+
if (now >= riskInstant(signed.body.expires_at)) {
|
|
249
|
+
return refuse('refusal_expired', signed.artifact_digest);
|
|
250
|
+
}
|
|
251
|
+
const mismatch = expectedMismatch(signed.body, options.expected);
|
|
252
|
+
if (mismatch)
|
|
253
|
+
return refuse(mismatch, signed.artifact_digest);
|
|
254
|
+
return {
|
|
255
|
+
accepted: true,
|
|
256
|
+
verified: true,
|
|
257
|
+
reason: null,
|
|
258
|
+
refusal_digest: signed.artifact_digest,
|
|
259
|
+
relying_party_id: signed.body.relying_party_id,
|
|
260
|
+
nonce: signed.body.nonce,
|
|
261
|
+
semantics: riskClone(signed.body.semantics),
|
|
262
|
+
delivery_evidence: signed.body.delivery === null ? 'NOT_EVIDENCED' : 'REFERENCED',
|
|
263
|
+
custody_evidence: signed.body.custody === null ? 'NOT_EVIDENCED' : 'REFERENCED',
|
|
264
|
+
transparency_anchor: signed.body.transparency_anchor === null
|
|
265
|
+
? 'NOT_REFERENCED' : 'REFERENCED_NOT_EXTERNALLY_VERIFIED',
|
|
266
|
+
claim_boundary: ACTION_REFUSAL_CLAIM_BOUNDARY,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
export function createMemoryActionRefusalReplayStore() {
|
|
270
|
+
const consumed = new Map();
|
|
271
|
+
return Object.freeze({
|
|
272
|
+
durable: false,
|
|
273
|
+
async consume(relyingPartyId, nonce, refusalDigest) {
|
|
274
|
+
const key = JSON.stringify([relyingPartyId, nonce]);
|
|
275
|
+
const existing = consumed.get(key);
|
|
276
|
+
if (existing === undefined) {
|
|
277
|
+
consumed.set(key, refusalDigest);
|
|
278
|
+
return { accepted: true, reason: null };
|
|
279
|
+
}
|
|
280
|
+
if (existing === refusalDigest)
|
|
281
|
+
return { accepted: false, reason: 'statement_replay' };
|
|
282
|
+
return { accepted: false, reason: 'nonce_equivocation' };
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
export async function acceptActionRefusalStatement(statement, options = {}) {
|
|
287
|
+
const verification = verifyActionRefusalStatement(statement, options);
|
|
288
|
+
const refused = (reason, checked = false, durable = false) => ({
|
|
289
|
+
...verification,
|
|
290
|
+
accepted: false,
|
|
291
|
+
reason,
|
|
292
|
+
replay_checked: checked,
|
|
293
|
+
replay_store_durable: durable,
|
|
294
|
+
});
|
|
295
|
+
if (!verification.verified)
|
|
296
|
+
return refused(verification.reason);
|
|
297
|
+
if (typeof verification.refusal_digest !== 'string')
|
|
298
|
+
return refused('refusal_digest_missing');
|
|
299
|
+
if (!riskExact(options.expected, EXPECTED_KEYS))
|
|
300
|
+
return refused('complete_expected_binding_required');
|
|
301
|
+
const store = options.replayStore;
|
|
302
|
+
if (!store || typeof store.consume !== 'function' || typeof store.durable !== 'boolean') {
|
|
303
|
+
return refused('replay_store_required');
|
|
304
|
+
}
|
|
305
|
+
if (!store.durable && options.allowEphemeralReplayStore !== true) {
|
|
306
|
+
return refused('durable_replay_store_required');
|
|
307
|
+
}
|
|
308
|
+
let result;
|
|
309
|
+
try {
|
|
310
|
+
result = await store.consume(verification.relying_party_id, verification.nonce, verification.refusal_digest);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
return refused('replay_store_unavailable', false, store.durable);
|
|
314
|
+
}
|
|
315
|
+
if (!riskExact(result, ['accepted', 'reason']) || typeof result.accepted !== 'boolean'
|
|
316
|
+
|| (result.reason !== null && typeof result.reason !== 'string')) {
|
|
317
|
+
return refused('replay_store_result_invalid', false, store.durable);
|
|
318
|
+
}
|
|
319
|
+
if (!result.accepted) {
|
|
320
|
+
const reason = result.reason === 'statement_replay' || result.reason === 'nonce_equivocation'
|
|
321
|
+
? result.reason : 'replay_store_refused';
|
|
322
|
+
return refused(reason, true, store.durable);
|
|
323
|
+
}
|
|
324
|
+
if (result.reason !== null)
|
|
325
|
+
return refused('replay_store_result_invalid', true, store.durable);
|
|
326
|
+
return {
|
|
327
|
+
...verification,
|
|
328
|
+
accepted: true,
|
|
329
|
+
replay_checked: true,
|
|
330
|
+
replay_store_durable: store.durable,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=action-refusal-statement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-refusal-statement.js","sourceRoot":"","sources":["../src/action-refusal-statement.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;GAGG;AACH,OAAO,EACL,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EACxE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,GAEtD,MAAM,2BAA2B,CAAC;AAEnC,MAAM,CAAC,MAAM,gCAAgC,GAAG,gCAAgC,CAAC;AACjF,MAAM,CAAC,MAAM,6BAA6B,GAAG,sDAAsD,CAAC;AACpG,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,qBAAqB;IACrB,iBAAiB;IACjB,sBAAsB;IACtB,uBAAuB;IACvB,iBAAiB;IACjB,SAAS;IACT,eAAe;CAChB,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAC3F,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,CAAU,CAAC;AAC7F,MAAM,YAAY,GAAG,CAAC,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,CAAU,CAAC;AACrF,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAU,CAAC;AAC3D,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,CAAU,CAAC;AAC1F,MAAM,SAAS,GAAG;IAChB,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,EAAE,eAAe;IACrE,SAAS,EAAE,wBAAwB,EAAE,kBAAkB;IACvD,mBAAmB,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe;IACzE,WAAW,EAAE,UAA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OAAO,CAAC,0BAA0B,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,SAAS;WAC/E,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,EAAE,CAAC;QACrE,OAAO,OAAO,CAAC,6BAA6B,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,kBAAkB,IAAI,MAAM,CAAC,MAAM,KAAK,oBAAoB;YAC3F,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC;QAC3C,OAAO,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,6BAA6B,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/F,OAAO;QACL,GAAG,YAAY;QACf,QAAQ,EAAE,IAAa;QACvB,cAAc,EAAE,IAAI;QACpB,oBAAoB,EAAE,KAAK,CAAC,OAAO;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Signed period reconciliation of supplied populations; never proof that the supplied population is complete. */
|
|
2
|
+
import { type RiskRecord, type TrustedRiskKeys } from './reliance-risk-crypto.js';
|
|
3
|
+
export declare const COVERAGE_RECONCILIATION_ATTESTATION_VERSION = "EP-COVERAGE-RECONCILIATION-ATTESTATION-v1";
|
|
4
|
+
export declare const COVERAGE_RECONCILIATION_CLAIM_BOUNDARY = "signed_reconciliation_of_supplied_populations_not_population_completeness";
|
|
5
|
+
export declare function signCoverageReconciliationAttestation(input: RiskRecord, signer: {
|
|
6
|
+
issuer_id: string;
|
|
7
|
+
key_id: string;
|
|
8
|
+
private_key: any;
|
|
9
|
+
}): RiskRecord;
|
|
10
|
+
export declare function verifyCoverageReconciliationAttestation(attestation: unknown, options?: {
|
|
11
|
+
trusted_keys?: TrustedRiskKeys;
|
|
12
|
+
now?: string | number;
|
|
13
|
+
expected_program?: RiskRecord;
|
|
14
|
+
expected_census_digest?: string;
|
|
15
|
+
expected_relying_party_id?: string;
|
|
16
|
+
}): {
|
|
17
|
+
accepted: boolean;
|
|
18
|
+
verified: boolean;
|
|
19
|
+
reason: string;
|
|
20
|
+
attestation_digest: string | null;
|
|
21
|
+
claim_boundary: string;
|
|
22
|
+
} | {
|
|
23
|
+
accepted: boolean;
|
|
24
|
+
verified: boolean;
|
|
25
|
+
reason: null;
|
|
26
|
+
attestation_digest: string | null;
|
|
27
|
+
claim_boundary: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=coverage-reconciliation-attestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-reconciliation-attestation.d.ts","sourceRoot":"","sources":["../src/coverage-reconciliation-attestation.ts"],"names":[],"mappings":"AACA,kHAAkH;AAClH,OAAO,EAEyB,KAAK,UAAU,EAAE,KAAK,eAAe,EACpE,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,2CAA2C,8CAA8C,CAAC;AACvG,eAAO,MAAM,sCAAsC,8EAA8E,CAAC;AAkDlI,wBAAgB,qCAAqC,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,GAAG,CAAA;CAAE,cAKvI;AAED,wBAAgB,uCAAuC,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,GAAE;IACrF,YAAY,CAAC,EAAE,eAAe,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IACrF,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC;CAChE;;;;;;;;;;;;EAsCL"}
|