@zanii/certify 0.0.0-stage → 0.6.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.
Files changed (141) hide show
  1. package/LICENSE +159 -0
  2. package/README.md +144 -2
  3. package/dist/appliance-execution.d.ts +18 -0
  4. package/dist/appliance-execution.js +12 -0
  5. package/dist/appliance.d.ts +135 -0
  6. package/dist/appliance.js +253 -0
  7. package/dist/assurance-status.d.ts +58 -0
  8. package/dist/assurance-status.js +86 -0
  9. package/dist/audit-renewal.d.ts +39 -0
  10. package/dist/audit-renewal.js +62 -0
  11. package/dist/audit.d.ts +69 -0
  12. package/dist/audit.js +112 -0
  13. package/dist/beacon-client.d.ts +40 -0
  14. package/dist/beacon-client.js +151 -0
  15. package/dist/beacon.d.ts +84 -0
  16. package/dist/beacon.js +106 -0
  17. package/dist/bitstring-status.d.ts +56 -0
  18. package/dist/bitstring-status.js +135 -0
  19. package/dist/board.d.ts +218 -0
  20. package/dist/board.js +428 -0
  21. package/dist/bundle.d.ts +100 -0
  22. package/dist/bundle.js +122 -0
  23. package/dist/certificate.d.ts +161 -0
  24. package/dist/certificate.js +346 -0
  25. package/dist/cli-messages.json +148 -0
  26. package/dist/cli.d.ts +16 -0
  27. package/dist/cli.js +369 -0
  28. package/dist/current-issuer-vc.d.ts +20 -0
  29. package/dist/current-issuer-vc.js +60 -0
  30. package/dist/evidence-share.d.ts +89 -0
  31. package/dist/evidence-share.js +479 -0
  32. package/dist/federation.d.ts +103 -0
  33. package/dist/federation.js +240 -0
  34. package/dist/feed-snapshot.d.ts +97 -0
  35. package/dist/feed-snapshot.js +186 -0
  36. package/dist/fingerprint.d.ts +23 -0
  37. package/dist/fingerprint.js +48 -0
  38. package/dist/formats/status-v2.schema.json +31 -0
  39. package/dist/governance.d.ts +244 -0
  40. package/dist/governance.js +418 -0
  41. package/dist/identity.d.ts +79 -0
  42. package/dist/identity.js +146 -0
  43. package/dist/impartiality.d.ts +47 -0
  44. package/dist/impartiality.js +85 -0
  45. package/dist/index.d.ts +61 -0
  46. package/dist/index.js +63 -0
  47. package/dist/issuer-authorization.d.ts +4 -0
  48. package/dist/issuer-authorization.js +52 -0
  49. package/dist/issuer-resolution.d.ts +25 -0
  50. package/dist/issuer-resolution.js +89 -0
  51. package/dist/licence-owner-entry.d.ts +20 -0
  52. package/dist/licence-owner-entry.js +33 -0
  53. package/dist/licence-owner.d.ts +67 -0
  54. package/dist/licence-owner.js +180 -0
  55. package/dist/licence.d.ts +174 -0
  56. package/dist/licence.js +400 -0
  57. package/dist/live-evidence.d.ts +135 -0
  58. package/dist/live-evidence.js +210 -0
  59. package/dist/nitro-roots.d.ts +3 -0
  60. package/dist/nitro-roots.js +20 -0
  61. package/dist/nitro-x509.d.ts +16 -0
  62. package/dist/nitro-x509.js +141 -0
  63. package/dist/nitro.d.ts +74 -0
  64. package/dist/nitro.js +329 -0
  65. package/dist/normalization.d.ts +8 -0
  66. package/dist/normalization.js +10 -0
  67. package/dist/pq.d.ts +32 -0
  68. package/dist/pq.js +69 -0
  69. package/dist/profile.d.ts +15 -0
  70. package/dist/profile.js +165 -0
  71. package/dist/register.d.ts +79 -0
  72. package/dist/register.js +134 -0
  73. package/dist/rotation.d.ts +49 -0
  74. package/dist/rotation.js +124 -0
  75. package/dist/royalty-reconciliation.d.ts +24 -0
  76. package/dist/royalty-reconciliation.js +88 -0
  77. package/dist/runtime-client.d.ts +40 -0
  78. package/dist/runtime-client.js +190 -0
  79. package/dist/runtime-gateway.d.ts +26 -0
  80. package/dist/runtime-gateway.js +169 -0
  81. package/dist/runtime-knowledge.d.ts +28 -0
  82. package/dist/runtime-knowledge.js +75 -0
  83. package/dist/runtime-nitro.d.ts +30 -0
  84. package/dist/runtime-nitro.js +57 -0
  85. package/dist/runtime.d.ts +226 -0
  86. package/dist/runtime.js +254 -0
  87. package/dist/sandbox-delegation.d.ts +38 -0
  88. package/dist/sandbox-delegation.js +61 -0
  89. package/dist/schema-dialect.d.ts +1 -0
  90. package/dist/schema-dialect.js +97 -0
  91. package/dist/schemas/clause-map.schema.json +52 -0
  92. package/dist/schemas/profile.schema.json +81 -0
  93. package/dist/schemas/scenarios.schema.json +573 -0
  94. package/dist/schemas/suite.schema.json +138 -0
  95. package/dist/schemas/trajectory.schema.json +1396 -0
  96. package/dist/scheme-authority.d.ts +5 -0
  97. package/dist/scheme-authority.js +15 -0
  98. package/dist/scheme-entry.d.ts +25 -0
  99. package/dist/scheme-entry.js +85 -0
  100. package/dist/scheme-history.d.ts +5 -0
  101. package/dist/scheme-history.js +87 -0
  102. package/dist/scheme-log.d.ts +98 -0
  103. package/dist/scheme-log.js +266 -0
  104. package/dist/scheme-merkle.d.ts +2 -0
  105. package/dist/scheme-merkle.js +20 -0
  106. package/dist/scheme-text.d.ts +25 -0
  107. package/dist/scheme-text.js +46 -0
  108. package/dist/scheme-timing.d.ts +16 -0
  109. package/dist/scheme-timing.js +22 -0
  110. package/dist/scheme-transition.d.ts +47 -0
  111. package/dist/scheme-transition.js +101 -0
  112. package/dist/scoring.d.ts +35 -0
  113. package/dist/scoring.js +50 -0
  114. package/dist/shared.d.ts +16 -0
  115. package/dist/shared.js +20 -0
  116. package/dist/signer.d.ts +18 -0
  117. package/dist/signer.js +49 -0
  118. package/dist/signing-identity.d.ts +1 -0
  119. package/dist/signing-identity.js +11 -0
  120. package/dist/status.d.ts +113 -0
  121. package/dist/status.js +204 -0
  122. package/dist/succession.d.ts +21 -0
  123. package/dist/succession.js +67 -0
  124. package/dist/suite.d.ts +261 -0
  125. package/dist/suite.js +458 -0
  126. package/dist/trajectory.d.ts +216 -0
  127. package/dist/trajectory.js +409 -0
  128. package/dist/transcript-provenance.d.ts +25 -0
  129. package/dist/transcript-provenance.js +37 -0
  130. package/dist/transport-key.d.ts +3 -0
  131. package/dist/transport-key.js +16 -0
  132. package/dist/vc.d.ts +29 -0
  133. package/dist/vc.js +96 -0
  134. package/dist/verification-bounds.d.ts +5 -0
  135. package/dist/verification-bounds.js +78 -0
  136. package/dist/verification-policy.d.ts +32 -0
  137. package/dist/verification-policy.js +85 -0
  138. package/dist/witness.d.ts +19 -0
  139. package/dist/witness.js +80 -0
  140. package/package.json +65 -4
  141. package/src/cli.ts +331 -0
@@ -0,0 +1,79 @@
1
+ import { type OwnerAttestation, type OwnerDoc } from "@zanii/kyb";
2
+ import { type Signer } from "./signer.ts";
3
+ import { type AssuranceStatusPolicy } from "./assurance-status.ts";
4
+ export interface AgentBinding {
5
+ v: 1;
6
+ type: "certify.agent-binding";
7
+ applicant: string;
8
+ legal_name: string;
9
+ domain: string;
10
+ /** attestationHash of the applicant owner's @zanii/kyb attestation. */
11
+ kyb: string;
12
+ agent: string;
13
+ bound_at: string;
14
+ valid_until: string;
15
+ signer: string;
16
+ sig: string;
17
+ }
18
+ export interface AgentBindingInput {
19
+ /** The applicant record id. */
20
+ applicant: string;
21
+ /** The owner's attestation; legal name and domain are taken from it. */
22
+ attestation: OwnerAttestation;
23
+ agent: string;
24
+ boundAt: string;
25
+ validUntil: string;
26
+ }
27
+ /** Section 2: the lab binds an agent DID to an applicant whose attestation verifies. */
28
+ export declare function buildAgentBinding(f: AgentBindingInput, signer: Signer): Promise<AgentBinding>;
29
+ /**
30
+ * Section 3: the applicant another binding in `bindings` (the lab's) holds `agent` for at `now`,
31
+ * or null. An agent DID is bound to one applicant at a time.
32
+ */
33
+ export declare function boundElsewhere(bindings: readonly unknown[], agent: string, applicant: string, now: string): string | null;
34
+ export interface AgentBindingVerifyOptions {
35
+ /** The lab DIDs that sign bindings (the issuer document's `dids`). */
36
+ signers?: readonly string[];
37
+ /** The owner's attestation the binding names. */
38
+ attestation?: OwnerAttestation;
39
+ /** The applicant domain's `.well-known/zanii-owner.json`. */
40
+ ownerDoc?: OwnerDoc | null;
41
+ now?: string;
42
+ /** The lab's other bindings: an agent bound to another applicant at `now` is refused. */
43
+ bindings?: readonly unknown[];
44
+ /** Require fresh purpose-bound lab status, including retained epoch/revocation evidence. */
45
+ bindingStatus?: AssuranceStatusPolicy;
46
+ }
47
+ /** Section 3: the binding's signature and fields, its validity at `now` and, when supplied, the two-way @zanii/kyb check. */
48
+ export declare function verifyAgentBinding(doc: unknown, opts?: AgentBindingVerifyOptions): {
49
+ ok: boolean;
50
+ reasons: string[];
51
+ };
52
+ export interface KybProof {
53
+ v: 1;
54
+ type: "certify.kyb-proof";
55
+ /** The applicant record id the attestation is submitted for. */
56
+ applicant: string;
57
+ /** The lab's single-use challenge. */
58
+ nonce: string;
59
+ /** attestationHash of the attestation submitted with it. */
60
+ kyb: string;
61
+ /** The attestation's owner DID. */
62
+ signer: string;
63
+ sig: string;
64
+ }
65
+ /** Section 4: the owner key answers the lab's challenge for one applicant and one attestation. */
66
+ export declare function buildKybProof(f: {
67
+ applicant: string;
68
+ nonce: string;
69
+ attestation: OwnerAttestation;
70
+ }, ownerSigner: Signer): Promise<KybProof>;
71
+ /** Section 4: the proof answers `nonce` for `applicant`, signed by the owner DID of `attestation`, naming it. */
72
+ export declare function verifyKybProof(doc: unknown, opts: {
73
+ attestation: OwnerAttestation;
74
+ applicant: string;
75
+ nonce: string;
76
+ }): {
77
+ ok: boolean;
78
+ reasons: string[];
79
+ };
@@ -0,0 +1,146 @@
1
+ // spec/identity.md: the applicant's legal identity (@zanii/kyb: the domain's
2
+ // `.well-known/zanii-owner.json` and the owner's signed attestation) and the lab-signed binding of
3
+ // each agent DID to that applicant.
4
+ import { verifySignedObject } from "@zanii/core";
5
+ import { attestationHash, verifyOwnerAttestation, verifyOwnerBinding } from "@zanii/kyb";
6
+ import { DOMAIN } from "./certificate.js";
7
+ import { isDid, isIso, isObj, isSha, ms } from "./shared.js";
8
+ import { signWith } from "./signer.js";
9
+ import { verifyAssuranceStatus } from "./assurance-status.js";
10
+ import { withinVerificationBudget } from "./verification-bounds.js";
11
+ const RECORD_ID = /^[a-z]{3}_[a-z2-7]{24}$/;
12
+ function bindingError(b) {
13
+ if (typeof b.applicant !== "string" || !RECORD_ID.test(b.applicant))
14
+ return "applicant must be a record id";
15
+ if (typeof b.legal_name !== "string" || b.legal_name.length < 1 || b.legal_name.length > 200)
16
+ return "legal_name must be 1 to 200 characters";
17
+ if (typeof b.domain !== "string" || !DOMAIN.test(b.domain))
18
+ return "domain must be a lower-case DNS name";
19
+ if (!isSha(b.kyb))
20
+ return "kyb must be an attestation hash";
21
+ if (!isDid(b.agent))
22
+ return "agent must be a did:key";
23
+ if (!isIso(b.bound_at) || !isIso(b.valid_until) || !(ms(b.valid_until) > ms(b.bound_at)))
24
+ return "bound_at and valid_until must be ISO timestamps, valid_until after bound_at";
25
+ return null;
26
+ }
27
+ /** Section 2: the lab binds an agent DID to an applicant whose attestation verifies. */
28
+ export async function buildAgentBinding(f, signer) {
29
+ if (!verifyOwnerAttestation(f.attestation))
30
+ throw new Error("the KYB attestation is not validly signed by its DID");
31
+ const unsigned = {
32
+ v: 1,
33
+ type: "certify.agent-binding",
34
+ applicant: f.applicant,
35
+ legal_name: f.attestation.entity.name,
36
+ domain: f.attestation.domain,
37
+ kyb: attestationHash(f.attestation),
38
+ agent: f.agent,
39
+ bound_at: f.boundAt,
40
+ valid_until: f.validUntil,
41
+ };
42
+ const err = bindingError(unsigned);
43
+ if (err)
44
+ throw new Error(err);
45
+ return signWith(unsigned, signer);
46
+ }
47
+ const inForce = (b, now) => ms(b.bound_at) <= now && now < ms(b.valid_until);
48
+ /**
49
+ * Section 3: the applicant another binding in `bindings` (the lab's) holds `agent` for at `now`,
50
+ * or null. An agent DID is bound to one applicant at a time.
51
+ */
52
+ export function boundElsewhere(bindings, agent, applicant, now) {
53
+ const t = ms(now);
54
+ for (const b of bindings)
55
+ if (isObj(b) && b.agent === agent && b.applicant !== applicant && verifySignedObject(b) && inForce(b, t))
56
+ return String(b.applicant);
57
+ return null;
58
+ }
59
+ /** Section 3: the binding's signature and fields, its validity at `now` and, when supplied, the two-way @zanii/kyb check. */
60
+ export function verifyAgentBinding(doc, opts = {}) {
61
+ if (opts.bindingStatus !== undefined && (!withinVerificationBudget({ doc, opts }, { maxBytes: 4_194_304 }) || !isObj(opts.bindingStatus)))
62
+ return { ok: false, reasons: ["strict binding evidence exceeds its JSON budget or has an invalid status policy"] };
63
+ const b = isObj(doc) ? doc : {};
64
+ if (b.v !== 1 || b.type !== "certify.agent-binding" || Object.keys(b).length !== 11)
65
+ return { ok: false, reasons: ["not an agent binding (v1)"] };
66
+ const reasons = [];
67
+ if (!verifySignedObject(b))
68
+ reasons.push("bad agent binding signature");
69
+ const err = bindingError(b);
70
+ if (err)
71
+ reasons.push(`agent binding is malformed: ${err}`);
72
+ if (!opts.signers)
73
+ reasons.push("no trusted signers supplied: the signer was NOT checked");
74
+ else if (!opts.signers.includes(b.signer))
75
+ reasons.push("agent binding signer is not a trusted lab key");
76
+ const now = opts.now ? ms(opts.now) : Date.now();
77
+ if (opts.bindingStatus !== undefined)
78
+ reasons.push(...verifyAssuranceStatus(opts.bindingStatus.document, { ...opts.bindingStatus, purpose: "agent-binding", artifact: doc, now: opts.now ?? new Date(now).toISOString() }).reasons);
79
+ if (now < ms(b.bound_at))
80
+ reasons.push("agent binding is not yet in force");
81
+ if (now >= ms(b.valid_until))
82
+ reasons.push(`agent binding expired on ${String(b.valid_until)}`);
83
+ const a = opts.attestation;
84
+ if (!a)
85
+ reasons.push("no KYB attestation supplied: the applicant identity was NOT checked");
86
+ else {
87
+ if (attestationHash(a) !== b.kyb)
88
+ reasons.push("the KYB attestation is not the one the binding names");
89
+ else if (a.domain !== b.domain || a.entity?.name !== b.legal_name)
90
+ reasons.push("the KYB attestation names another domain or legal name");
91
+ if (opts.ownerDoc === undefined)
92
+ reasons.push("no owner document supplied: the domain side was NOT checked");
93
+ else
94
+ reasons.push(...verifyOwnerBinding(a, opts.ownerDoc).reasons.map((r) => `kyb: ${r}`));
95
+ }
96
+ if (opts.bindings && typeof b.agent === "string") {
97
+ const other = boundElsewhere(opts.bindings, b.agent, String(b.applicant), opts.now ?? new Date().toISOString());
98
+ if (other)
99
+ reasons.push(`agent is already bound to applicant ${other}`);
100
+ }
101
+ return { ok: reasons.length === 0, reasons };
102
+ }
103
+ const NONCE = /^[A-Za-z0-9_-]{16,128}$/;
104
+ function proofError(p) {
105
+ if (typeof p.applicant !== "string" || !RECORD_ID.test(p.applicant))
106
+ return "applicant must be a record id";
107
+ if (typeof p.nonce !== "string" || !NONCE.test(p.nonce))
108
+ return "nonce must be 16 to 128 base64url characters";
109
+ if (!isSha(p.kyb))
110
+ return "kyb must be an attestation hash";
111
+ return null;
112
+ }
113
+ /** Section 4: the owner key answers the lab's challenge for one applicant and one attestation. */
114
+ export async function buildKybProof(f, ownerSigner) {
115
+ if (!verifyOwnerAttestation(f.attestation))
116
+ throw new Error("the KYB attestation is not validly signed by its DID");
117
+ const unsigned = { v: 1, type: "certify.kyb-proof", applicant: f.applicant, nonce: f.nonce, kyb: attestationHash(f.attestation) };
118
+ const err = proofError(unsigned);
119
+ if (err)
120
+ throw new Error(err);
121
+ const proof = (await signWith(unsigned, ownerSigner));
122
+ if (proof.signer !== f.attestation.did)
123
+ throw new Error("the proof is signed by the attestation's owner key");
124
+ return proof;
125
+ }
126
+ /** Section 4: the proof answers `nonce` for `applicant`, signed by the owner DID of `attestation`, naming it. */
127
+ export function verifyKybProof(doc, opts) {
128
+ const p = isObj(doc) ? doc : {};
129
+ if (p.v !== 1 || p.type !== "certify.kyb-proof" || Object.keys(p).length !== 7)
130
+ return { ok: false, reasons: ["not a KYB proof (v1)"] };
131
+ const reasons = [];
132
+ if (!verifySignedObject(p))
133
+ reasons.push("bad KYB proof signature");
134
+ const err = proofError(p);
135
+ if (err)
136
+ reasons.push(`KYB proof is malformed: ${err}`);
137
+ if (p.signer !== opts.attestation?.did)
138
+ reasons.push("the KYB proof is not signed by the attestation's owner DID");
139
+ if (!isObj(opts.attestation) || p.kyb !== attestationHash(opts.attestation))
140
+ reasons.push("the KYB proof names another attestation");
141
+ if (p.applicant !== opts.applicant)
142
+ reasons.push("the KYB proof is for another applicant");
143
+ if (p.nonce !== opts.nonce)
144
+ reasons.push("the KYB proof answers another challenge");
145
+ return { ok: reasons.length === 0, reasons };
146
+ }
@@ -0,0 +1,47 @@
1
+ export interface Staff {
2
+ testers: readonly string[];
3
+ /** Null only at Level 1 (automated, no human review). */
4
+ reviewer: string | null;
5
+ decider: string;
6
+ /** Section 3a: the person handling an appeal or complaint, when one is checked. */
7
+ handler?: string | null;
8
+ }
9
+ export declare const REFUSALS: readonly ["DECIDER_IS_REVIEWER", "DECIDER_IS_TESTER", "DECIDER_CONFLICTED", "REVIEWER_CONFLICTED", "REVIEWER_IS_TESTER", "DECIDER_COOLING_OFF", "REVIEWER_COOLING_OFF", "TESTER_COOLING_OFF", "HANDLER_COOLING_OFF"];
10
+ export type Refusal = (typeof REFUSALS)[number];
11
+ /** Section 3a: one period a person worked on an applicant's product (`to` null while it lasts). */
12
+ export interface Engagement {
13
+ staff: string;
14
+ applicant: string;
15
+ from: string;
16
+ to: string | null;
17
+ }
18
+ export interface CoolingOff {
19
+ /** The applicant whose work is being staffed. */
20
+ applicant: string;
21
+ engagements: readonly Engagement[];
22
+ now: string;
23
+ }
24
+ export declare const COOLING_OFF_YEARS = 2;
25
+ /**
26
+ * Why this staffing must be refused, in REFUSALS order; empty when it may proceed. `conflicted`
27
+ * lists every person (DID) with a declared conflict on the applicant; `coolingOff`, when given,
28
+ * the engagement history the two-year rule reads.
29
+ */
30
+ export declare function staffRefusals(staff: Staff, conflicted: readonly string[], coolingOff?: CoolingOff): Refusal[];
31
+ /** governance.md section 3b: one committee seat, internal or external, held from `from` until `to` (null: still held). */
32
+ export interface CommitteeMember {
33
+ did: string;
34
+ external: boolean;
35
+ from: string;
36
+ to: string | null;
37
+ }
38
+ export declare const COMMITTEE_MIN_EXTERNAL = 2;
39
+ /**
40
+ * governance.md section 3b: may the committee act at `now`? At least two active external members.
41
+ * `external` lists them, sorted.
42
+ */
43
+ export declare function committeeQuorum(members: readonly CommitteeMember[], now: string): {
44
+ ok: boolean;
45
+ reasons: string[];
46
+ external: string[];
47
+ };
@@ -0,0 +1,85 @@
1
+ // spec/impartiality.md section 3: the refusal rules the software enforces; section 3a the
2
+ // two-year cooling-off; spec/governance.md section 3b the committee quorum.
3
+ import { isDid, ms } from "./shared.js";
4
+ export const REFUSALS = [
5
+ "DECIDER_IS_REVIEWER",
6
+ "DECIDER_IS_TESTER",
7
+ "DECIDER_CONFLICTED",
8
+ "REVIEWER_CONFLICTED",
9
+ "REVIEWER_IS_TESTER",
10
+ "DECIDER_COOLING_OFF",
11
+ "REVIEWER_COOLING_OFF",
12
+ "TESTER_COOLING_OFF",
13
+ "HANDLER_COOLING_OFF",
14
+ ];
15
+ export const COOLING_OFF_YEARS = 2;
16
+ /** `t` plus whole calendar years in UTC (29 February moves to 1 March), in ms; NaN when not a timestamp. */
17
+ const yearsAfter = (t, years) => {
18
+ const v = ms(t);
19
+ if (Number.isNaN(v))
20
+ return v;
21
+ const d = new Date(v);
22
+ d.setUTCFullYear(d.getUTCFullYear() + years);
23
+ return d.getTime();
24
+ };
25
+ /**
26
+ * Section 3a: is `did` within two years of the end of an engagement with the applicant (or in
27
+ * one)? An engagement whose dates are not timestamps counts, so malformed history refuses.
28
+ */
29
+ function cooling(did, c, now) {
30
+ if (!c || !did)
31
+ return false;
32
+ return c.engagements.some((e) => {
33
+ if (e.staff !== did || e.applicant !== c.applicant)
34
+ return false;
35
+ const until = e.to === null ? Number.POSITIVE_INFINITY : yearsAfter(e.to, COOLING_OFF_YEARS);
36
+ return !(ms(e.from) > now) && !(now >= until);
37
+ });
38
+ }
39
+ /**
40
+ * Why this staffing must be refused, in REFUSALS order; empty when it may proceed. `conflicted`
41
+ * lists every person (DID) with a declared conflict on the applicant; `coolingOff`, when given,
42
+ * the engagement history the two-year rule reads.
43
+ */
44
+ export function staffRefusals(staff, conflicted, coolingOff) {
45
+ const out = [];
46
+ if (staff.reviewer !== null && staff.decider === staff.reviewer)
47
+ out.push("DECIDER_IS_REVIEWER");
48
+ if (staff.testers.includes(staff.decider))
49
+ out.push("DECIDER_IS_TESTER");
50
+ if (conflicted.includes(staff.decider))
51
+ out.push("DECIDER_CONFLICTED");
52
+ if (staff.reviewer !== null && conflicted.includes(staff.reviewer))
53
+ out.push("REVIEWER_CONFLICTED");
54
+ if (staff.reviewer !== null && staff.testers.includes(staff.reviewer))
55
+ out.push("REVIEWER_IS_TESTER");
56
+ if (coolingOff === undefined)
57
+ return out;
58
+ const now = ms(coolingOff.now);
59
+ if (Number.isNaN(now) || typeof coolingOff.applicant !== "string" || !Array.isArray(coolingOff.engagements))
60
+ throw new Error("coolingOff needs an applicant, engagements and an ISO now");
61
+ if (cooling(staff.decider, coolingOff, now))
62
+ out.push("DECIDER_COOLING_OFF");
63
+ if (cooling(staff.reviewer, coolingOff, now))
64
+ out.push("REVIEWER_COOLING_OFF");
65
+ if (staff.testers.some((t) => cooling(t, coolingOff, now)))
66
+ out.push("TESTER_COOLING_OFF");
67
+ if (cooling(staff.handler, coolingOff, now))
68
+ out.push("HANDLER_COOLING_OFF");
69
+ return out;
70
+ }
71
+ export const COMMITTEE_MIN_EXTERNAL = 2;
72
+ /** The members holding their seat at `now` (`from` at or before it, `to` after it or null). */
73
+ const active = (members, now) => members.filter((m) => isDid(m?.did) && ms(m.from) <= now && (m.to === null || now < ms(m.to)));
74
+ /**
75
+ * governance.md section 3b: may the committee act at `now`? At least two active external members.
76
+ * `external` lists them, sorted.
77
+ */
78
+ export function committeeQuorum(members, now) {
79
+ const t = ms(now);
80
+ if (Number.isNaN(t) || !Array.isArray(members))
81
+ throw new Error("committeeQuorum needs members and an ISO now");
82
+ const external = [...new Set(active(members, t).filter((m) => m.external === true).map((m) => m.did))].sort((a, b) => (a < b ? -1 : 1));
83
+ const ok = external.length >= COMMITTEE_MIN_EXTERNAL;
84
+ return { ok, reasons: ok ? [] : [`the committee has ${external.length} active external members; at least ${COMMITTEE_MIN_EXTERNAL} are needed`], external };
85
+ }
@@ -0,0 +1,61 @@
1
+ export { BEACON_INTERVAL_MS, type BeaconHandle, type BeaconOptions, type BeaconResult, startBeacon, } from "./beacon-client.ts";
2
+ export { AUDIT_OUTCOMES, auditLapsed, type AuditAttestation, type AuditCheck, type AuditInput, type AuditOutcome, buildAuditAttestation, CONTROL, verifyAuditAttestation, } from "./audit.ts";
3
+ export { type ApplianceAttestation, type ApplianceCheck, applianceChallenge, type ApplianceEnrolment, type ApplianceExport, type ApplianceExportInput, type ApplianceUpdate, buildApplianceEnrolment, buildApplianceExport, buildApplianceUpdate, type EvidenceHead, labKeyId, openApplianceExport, type SealedTranscripts, sealTranscripts, verifyApplianceExport, verifyApplianceUpdate, } from "./appliance.ts";
4
+ export { type Board, type BoardBody, type BoardCheck, type BoardInput, type BodySignature, boardBody, bodySignature, buildBoard, buildRelease, RELEASE_KINDS, type Release, type ReleaseBody, type ReleaseInput, type ReleaseKind, type ReleaseSubject, releaseBody, requireRelease, signersOf, verifyBoardAppend, verifyBoardLog, verifyRelease, verifyReleaseAppend, verifyReleaseLog, buildReleaseWithdrawal, type ReleaseWithdrawal, type ReleaseWithdrawalBody, type ReleaseWithdrawalInput, releaseWithdrawalBody, verifyWithdrawalLog, WITHDRAWAL_REASONS, type WithdrawalReason, withdrawalFlags, withSignatures, } from "./board.ts";
5
+ export { type BodyRegister, type BodyRegisterBody, type BodyRegisterInput, type BodyRegisterOptions, bodyRegisterAt, bodyRegisterBody, buildBodyRegister, type RegisteredBody, trustedBodiesAt, verifyBodyRegisterLog, } from "./register.ts";
6
+ export { buildSchemeAppend, SCHEME_LOG_TYPES, type SchemeAppend, type SchemeAppendStatement, type SchemeLogsCheck, type SchemeLogsInput, schemeAppendStatement, schemeCheckpoint, schemeConsistencyProof, schemeInclusionProof, verifySchemeInclusion, verifySchemeLogs, } from "./scheme-log.ts";
7
+ export { MAX_SCHEME_ENTRY_BYTES, verifySchemeEntry, type SchemeEntryContext, type SchemeEntryCheck } from "./scheme-entry.ts";
8
+ export { verifySchemeEffectiveTime, type SchemeTimingPolicy, type SchemeTimingCode, type SchemeTimingCheck } from "./scheme-timing.ts";
9
+ export { withinVerificationBudget } from "./verification-bounds.ts";
10
+ export { buildSchemeTransition, verifySchemeTransition, verifySchemeTransitionProposal, type SchemeTransition, type SchemeTransitionBody, type SchemeTransitionContext, type SchemeTransitionAnchor } from "./scheme-transition.ts";
11
+ export { buildSchemeAppendFromStatement, verifySchemeAppend } from "./scheme-log.ts";
12
+ export { FEED_SNAPSHOT_CHUNK_ENTRIES, MAX_FEED_SNAPSHOT_BYTES, MAX_FEED_SNAPSHOT_CHUNK_BYTES, feedSnapshotFrontier, buildFeedSnapshot, verifyFeedSnapshot, feedSnapshotCursor, feedSnapshotChunkHash, verifyFeedSnapshotChunk, type FeedSnapshotNode, type FeedSnapshotManifest, type FeedSnapshotHeader, type FeedSnapshotCursor, type FeedSnapshotChunk } from "./feed-snapshot.ts";
13
+ export { buildFeedPage, type FederatedFeed, type FeedCheck, type FeedConflict, type FeedEntry, type FeedPage, type FeedPageInput, type FeedCursor, feedCheckpoint, MAX_FEED_ENTRIES, MAX_FEED_PAGE_BYTES, type MergedRegistry, mergeFeeds, verifyFeed, verifyFeedPage, } from "./federation.ts";
14
+ export { buildLicence, buildLicenceStatus, buildRoyaltyStatement, certificateListHash, countersignRoyaltyStatement, LICENCE_ACTIONS, LICENCE_REASONS, type Licence, type LicenceAction, type LicenceCheck, type LicenceInput, type LicenceOptions, type LicenceReason, type LicenceScope, type LicenceState, type LicenceStatus, licenceCoverage, licenceReasons, licensedKey, licenceStateAt, MAX_ROYALTY_MINOR, MAX_STATEMENT_CERTIFICATES, type RoyaltyStatement, type RoyaltyStatementBody, type RoyaltyStatementInput, verifyLicence, verifyLicenceLog, verifyRoyaltyStatement, } from "./licence.ts";
15
+ export { type AttestedBeaconCheck, type BeaconAttestation, type BeaconCheck, type BeaconReport, beaconChallenge, buildBeacon, MAX_SKEW_SECONDS, NONCE, verifyAttestedBeacon, verifyBeacon, } from "./beacon.ts";
16
+ export { type BundleInput, type ApplianceExecution, type ApplianceExportIdentity, type ApplianceExportBundle, type ApplianceExportBundleInput, bundleHash, buildBundle, buildApplianceExportBundle, type CategoryCount, type CategoryResult, type Evidence, type ResultBundle, type Assessment, } from "./bundle.ts";
17
+ export { applianceExecution, applianceExportIdentity } from "./appliance-execution.ts";
18
+ export { type CertificateCheck, type CertificateInput, type CertificateVerifyOptions, type CertifyClaim, type PqPolicy, CONFLICTS, type Conflict, certificateScope, claimReasons, issueCertificate, LEVELS, type Level, pickScheme, SCHEME, SCHEME_LEVELS, SCHEMES, type Scheme, SURVEILLANCE, VALIDITY_DAYS, verifyCertificate, } from "./certificate.ts";
19
+ export { buildFingerprint, checkFingerprint, type Fingerprint, type FingerprintInput, promptSha256, sha256Bytes, toolsSha256, } from "./fingerprint.ts";
20
+ export { COMMITTEE_MIN_EXTERNAL, type CommitteeMember, committeeQuorum, COOLING_OFF_YEARS, type CoolingOff, type Engagement, REFUSALS, type Refusal, type Staff, staffRefusals, } from "./impartiality.ts";
21
+ export { AUDIENCES, type Audience, buildEvidenceShare, discloseEvidenceField, type EvidenceShare, type EvidenceShareInput, GCC_IDENTIFIERS, REDACTION_KINDS, redactEvidence, type RedactionKind, type RedactOptions, type SharedEntry, verifyEvidenceShare, } from "./evidence-share.ts";
22
+ export { type AgentBinding, type AgentBindingInput, type AgentBindingVerifyOptions, boundElsewhere, buildAgentBinding, buildKybProof, type KybProof, verifyAgentBinding, verifyKybProof, } from "./identity.ts";
23
+ export { issuerLineage, type IssuerLineage } from "./succession.ts";
24
+ export { buildGatewayEnrolment, buildLiveEvidence, type GatewayAttestation, type GatewayEnrolment, type GatewayEnrolmentInput, type LiveEvidenceVerifyOptions, verifyGatewayEnrolment, LIVE_DEFAULTS, LIVE_TRIGGERS, type LiveEvidence, type LiveEvidenceInput, type LiveThresholds, type LiveTrigger, liveEvidenceTriggers, verifyLiveEvidence, } from "./live-evidence.ts";
25
+ export { checkPqBinding, type PqCosignature, pqCommitment, pqCosign, pqPolicyOf, verifyPqCosignature } from "./pq.ts";
26
+ export { clauseMapSchema, type ProfileCheck, profileSchema, schemaErrors, validateClauseMap, validateProfile, } from "./profile.ts";
27
+ export { type CategoryScore, type Overall, overallVerdict, type ProfileCategoryRule, type ScoredResult, scoreCategory, type Verdict, } from "./scoring.ts";
28
+ export { activeRotation, buildRotation, type Rotation, type RotationCheck, type RotationInput, type SuiteRef, verifyRotationLog, verifyRotationRecord, } from "./rotation.ts";
29
+ export { type Check, type CheckContext, type CheckResult, casesOf, DEFAULT_FINDINGS, type Delegation, type DelegationLink, effectiveDelegation, judgementResult, normaliseText, type Rubric, runCheck, type Scenario, type ScenarioLibrary, scenarioCases, scenariosSchema, type Suite, type SubAgent, type SuiteCase, suiteSchema, type ToolCall, suiteSnapshot, validateScenarios, validateSuite, verifyCaseDelegation, } from "./suite.ts";
30
+ export { keySigner, type Signer, signerDid, signWith } from "./signer.ts";
31
+ export { applyStatus, buildStatus, type CertificateStatus, REASONS, REASONS_V2, STATUS_V2_SCHEMA, STATUS_V2_MAX_ENTRIES, type StatusVersion, type Reason, revocationListFromStatus, type StatusAction, type StatusCheck, type StatusDocument, type StatusEntries, type StatusEntry, type StatusVerifyOptions, type StatusWitness, verifyStatus, logPositionOk, } from "./status.ts";
32
+ export { type CertificateVcCheck, certificateToVc, VC_STATUS_TYPE, VC_TYPE, verifyCertificateVc, } from "./vc.ts";
33
+ export { statusCheckpoint, statusConsistencyProof, statusInclusionProof, verifyStatusLog, } from "./witness.ts";
34
+ export { type AccreditationExport, buildAccreditationExport, buildFilingPack, buildGovernanceOutcome, buildSigningKeyApproval, CASE_KINDS, type CaseKind, type CertifyRiskFacts, type CertifyRiskProfile, certifyRiskProfile, type FilingPack, type FilingPackInput, type GovernanceCheck, type GovernanceOutcome, type GovernanceOutcomeInput, governanceOutcomeBody, OUTCOMES, RISK_NOTE, type RiskProfileInput, type SignedRiskProfile, type SigningKeyApproval, type SigningKeyApprovalInput, signingKeyApprovalBody, signRiskProfile, verifyRiskProfile, verifyAccreditationExport, verifyFilingPack, verifyGovernanceOutcome, verifySigningKeyApproval, } from "./governance.ts";
35
+ export { AWS_NITRO_ROOT_PEM, AWS_NITRO_ROOT_SHA256, AWS_NITRO_GOV_ROOT_PEM, AWS_NITRO_GOV_ROOT_SHA256, checkNitroAttestation, NITRO_MAX_AGE_SECONDS, NITRO_MAX_SKEW_SECONDS, type NitroCheck, type NitroDocument, type NitroOptions, type NitroPartition, type NitroQuoteOptions, nitroMeasurement, nitroQuoteVerifier, nitroRootForPartition, parseNitroDocument, sigStructure, verifyNitroDocument } from "./nitro.ts";
36
+ export { canonicalBytes, jcsHash } from "@zanii/core";
37
+ export { buildRuntimeRelease, buildRuntimePolicy, buildRuntimeApproval, buildRuntimeProof, buildRuntimeChallengeRequest, buildRuntimeLease, buildRuntimeAction, buildRuntimeLeaseRequest, buildRuntimeMandate, verifyRuntimeRelease, verifyRuntimePolicy, verifyRuntimeApproval, verifyRuntimeProof, verifyRuntimeChallengeRequest, verifyRuntimeLease, verifyRuntimeAction, verifyRuntimeLeaseRequest, verifyRuntimeMandate, runtimeReleaseHash, runtimePolicyHash, runtimeRequestHash, type RuntimeRelease, type RuntimePolicy, type RuntimeApproval, type RuntimeProof, type RuntimeChallengeRequest, type RuntimeLease, type RuntimeAction, type RuntimeLeaseRequest, type RuntimeMandate, type RuntimeCheck, type RuntimeTrustOptions, type RuntimeReleaseOptions, type RuntimeApprovalOptions, type RuntimeProofOptions, type RuntimeChallengeOptions, type RuntimeLeaseOptions, type RuntimeActionOptions, type RuntimeLeaseRequestOptions, type RuntimeMandateOptions, } from "./runtime.ts";
38
+ export { runtimeNitroBindingHash, verifyRuntimeNitroDocument, RUNTIME_NITRO_MAX_BYTES, RUNTIME_NITRO_MAX_SKEW_SECONDS, type RuntimeNitroBinding, type RuntimeNitroOptions, type RuntimeNitroCheck } from "./runtime-nitro.ts";
39
+ export { createRuntimeGateway, type RuntimeGatewayOptions } from "./runtime-gateway.ts";
40
+ export { createRuntimeReporter, type RuntimeReporterOptions, type RuntimeAttestationBinding, type RuntimeReportResult } from "./runtime-client.ts";
41
+ export { buildRuntimeKnowledgeSnapshot, runtimeKnowledgeProof, runtimeKnowledgeProofs, verifyRuntimeKnowledgeChunk, type RuntimeKnowledgeMetadata, type RuntimeKnowledgeSnapshot, type RuntimeKnowledgeProof, type RuntimeKnowledgeOptions, } from "./runtime-knowledge.ts";
42
+ export { resolveIssuerDetailed, fetchJsonBounded, type JsonFetchResult, type IssuerResolution, type IssuerResolutionCode, type ResolutionOptions, type ResolutionFailure } from "./issuer-resolution.ts";
43
+ export { isIssuerPolicy, issuerPolicyCheck, releasePolicyReasons, type IssuerPolicy, type ReleaseVerificationPolicy } from "./verification-policy.ts";
44
+ export { buildSandboxDelegationPolicy, verifySandboxDelegationPolicy, type SandboxDelegationPolicy, type SandboxDelegationContext } from "./sandbox-delegation.ts";
45
+ export { teamReceiptTask, type TeamReceiptPolicy } from "./suite.ts";
46
+ export { BITSTRING_STATUS_SLOTS, buildBitstringStatusList, bitstringStatusEntry, verifyBitstringStatusList, verifyBitstringStatusEntry, certificateToBitstringVc, verifyCertificateBitstringVc, type BitstringPurpose, type BitstringStatusEntry, type BitstringStatusListInput, type BitstringStatusTrust } from "./bitstring-status.ts";
47
+ export { reconcileRoyaltyStatementFeed, type RoyaltyFeedOptions, type RoyaltyFeedCheck } from "./royalty-reconciliation.ts";
48
+ export { buildLicenceOwnerRotation, verifyLicenceOwnerHistory, licenceOwnerCheckpoint, licenceOwnerProof, licenceOwnerProofs, verifyLicenceWithOwnerHistory, isLicenceOwnerCheckpoint, isLicenceOwnerRotation, type LicenceOwnerRotation, type OwnerLicenceProof, type LicenceOwnerHistoryPolicy, type LicenceOwnerHistoryCheck } from "./licence-owner.ts";
49
+ export { verifyLicenceOwnerEntry, type LicenceOwnerEntryContext, type LicenceOwnerEntryCheck } from "./licence-owner-entry.ts";
50
+ export { buildSchemeTextBundle, schemeTextBundleHash, verifySchemeTextBundle, SCHEME_TEXT_MAX_BYTES, type SchemeTextBundle, type SchemeTextFile } from "./scheme-text.ts";
51
+ export { certificateToCurrentIssuerVc, verifyCurrentIssuerCertificateVc, type CurrentIssuerVcOptions, type CurrentIssuerVcTrust } from "./current-issuer-vc.ts";
52
+ export { buildAssuranceRevocation, buildAssuranceStatus, verifyAssuranceStatus, type AssurancePurpose, type AssuranceRevocation, type AssuranceStatus, type AssuranceAuthority, type AssuranceStatusPolicy, type AssuranceStatusOptions } from "./assurance-status.ts";
53
+ export { buildAuditRenewal, verifyAuditRenewal, type AuditRenewal, type AuditRenewalPolicy, type AuditRenewalOptions } from "./audit-renewal.ts";
54
+ export { liveEvidenceFreshnessReasons } from "./live-evidence.ts";
55
+ export { signingIdentityReasons } from "./signing-identity.ts";
56
+ export { normalizationPolicyReasons, runtimeNormalizationVersion, type NormalizationPolicy } from "./normalization.ts";
57
+ export { schemaDialectErrors } from "./schema-dialect.ts";
58
+ export { type Credential, credentialHash, type RevocationList } from "@zanii/credentials";
59
+ export { TRANSCRIPT_TURNS_BYTES, transcriptTurnsHash, validateTranscriptProvenance, type TranscriptProvenance } from "./transcript-provenance.ts";
60
+ export { validateSuiteDocument, type SuiteDocument } from "./suite.ts";
61
+ export { TRAJECTORY_LIMITS, trajectorySchema, isTrajectoryCase, validateTrajectorySuite, validateTrajectoryTrace, validateTrajectoryArguments, parseTrajectoryArguments, trajectoryTools, resolveTrajectoryRef, trajectoryConditions, trajectoryStateHash, trajectoryCaseHash, trajectorySuiteHash, checkTrajectory, type TrajectoryScalar, type TrajectoryState, type TrajectoryRef, type TrajectoryCondition, type TrajectoryEffect, type TrajectoryArgument, type TrajectoryRule, type TrajectoryTool, type TrajectoryBudget, type TrajectoryCase, type TrajectorySuite, type TrajectoryCall, type TrajectoryEvent, type TrajectoryTrace, type TrajectoryCheck } from "./trajectory.ts";
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ // @zanii/certify: the Zanii Certify formats (spec/). Byte-identical with Python zanii-certify.
2
+ export { BEACON_INTERVAL_MS, startBeacon, } from "./beacon-client.js";
3
+ export { AUDIT_OUTCOMES, auditLapsed, buildAuditAttestation, CONTROL, verifyAuditAttestation, } from "./audit.js";
4
+ export { applianceChallenge, buildApplianceEnrolment, buildApplianceExport, buildApplianceUpdate, labKeyId, openApplianceExport, sealTranscripts, verifyApplianceExport, verifyApplianceUpdate, } from "./appliance.js";
5
+ export { boardBody, bodySignature, buildBoard, buildRelease, RELEASE_KINDS, releaseBody, requireRelease, signersOf, verifyBoardAppend, verifyBoardLog, verifyRelease, verifyReleaseAppend, verifyReleaseLog, buildReleaseWithdrawal, releaseWithdrawalBody, verifyWithdrawalLog, WITHDRAWAL_REASONS, withdrawalFlags, withSignatures, } from "./board.js";
6
+ export { bodyRegisterAt, bodyRegisterBody, buildBodyRegister, trustedBodiesAt, verifyBodyRegisterLog, } from "./register.js";
7
+ export { buildSchemeAppend, SCHEME_LOG_TYPES, schemeAppendStatement, schemeCheckpoint, schemeConsistencyProof, schemeInclusionProof, verifySchemeInclusion, verifySchemeLogs, } from "./scheme-log.js";
8
+ export { MAX_SCHEME_ENTRY_BYTES, verifySchemeEntry } from "./scheme-entry.js";
9
+ export { verifySchemeEffectiveTime } from "./scheme-timing.js";
10
+ export { withinVerificationBudget } from "./verification-bounds.js";
11
+ export { buildSchemeTransition, verifySchemeTransition, verifySchemeTransitionProposal } from "./scheme-transition.js";
12
+ export { buildSchemeAppendFromStatement, verifySchemeAppend } from "./scheme-log.js";
13
+ export { FEED_SNAPSHOT_CHUNK_ENTRIES, MAX_FEED_SNAPSHOT_BYTES, MAX_FEED_SNAPSHOT_CHUNK_BYTES, feedSnapshotFrontier, buildFeedSnapshot, verifyFeedSnapshot, feedSnapshotCursor, feedSnapshotChunkHash, verifyFeedSnapshotChunk } from "./feed-snapshot.js";
14
+ export { buildFeedPage, feedCheckpoint, MAX_FEED_ENTRIES, MAX_FEED_PAGE_BYTES, mergeFeeds, verifyFeed, verifyFeedPage, } from "./federation.js";
15
+ export { buildLicence, buildLicenceStatus, buildRoyaltyStatement, certificateListHash, countersignRoyaltyStatement, LICENCE_ACTIONS, LICENCE_REASONS, licenceCoverage, licenceReasons, licensedKey, licenceStateAt, MAX_ROYALTY_MINOR, MAX_STATEMENT_CERTIFICATES, verifyLicence, verifyLicenceLog, verifyRoyaltyStatement, } from "./licence.js";
16
+ export { beaconChallenge, buildBeacon, MAX_SKEW_SECONDS, NONCE, verifyAttestedBeacon, verifyBeacon, } from "./beacon.js";
17
+ export { bundleHash, buildBundle, buildApplianceExportBundle, } from "./bundle.js";
18
+ export { applianceExecution, applianceExportIdentity } from "./appliance-execution.js";
19
+ export { CONFLICTS, certificateScope, claimReasons, issueCertificate, LEVELS, pickScheme, SCHEME, SCHEME_LEVELS, SCHEMES, SURVEILLANCE, VALIDITY_DAYS, verifyCertificate, } from "./certificate.js";
20
+ export { buildFingerprint, checkFingerprint, promptSha256, sha256Bytes, toolsSha256, } from "./fingerprint.js";
21
+ export { COMMITTEE_MIN_EXTERNAL, committeeQuorum, COOLING_OFF_YEARS, REFUSALS, staffRefusals, } from "./impartiality.js";
22
+ export { AUDIENCES, buildEvidenceShare, discloseEvidenceField, GCC_IDENTIFIERS, REDACTION_KINDS, redactEvidence, verifyEvidenceShare, } from "./evidence-share.js";
23
+ export { boundElsewhere, buildAgentBinding, buildKybProof, verifyAgentBinding, verifyKybProof, } from "./identity.js";
24
+ export { issuerLineage } from "./succession.js";
25
+ export { buildGatewayEnrolment, buildLiveEvidence, verifyGatewayEnrolment, LIVE_DEFAULTS, LIVE_TRIGGERS, liveEvidenceTriggers, verifyLiveEvidence, } from "./live-evidence.js";
26
+ export { checkPqBinding, pqCommitment, pqCosign, pqPolicyOf, verifyPqCosignature } from "./pq.js";
27
+ export { clauseMapSchema, profileSchema, schemaErrors, validateClauseMap, validateProfile, } from "./profile.js";
28
+ export { overallVerdict, scoreCategory, } from "./scoring.js";
29
+ export { activeRotation, buildRotation, verifyRotationLog, verifyRotationRecord, } from "./rotation.js";
30
+ export { casesOf, DEFAULT_FINDINGS, effectiveDelegation, judgementResult, normaliseText, runCheck, scenarioCases, scenariosSchema, suiteSchema, suiteSnapshot, validateScenarios, validateSuite, verifyCaseDelegation, } from "./suite.js";
31
+ export { keySigner, signerDid, signWith } from "./signer.js";
32
+ export { applyStatus, buildStatus, REASONS, REASONS_V2, STATUS_V2_SCHEMA, STATUS_V2_MAX_ENTRIES, revocationListFromStatus, verifyStatus, logPositionOk, } from "./status.js";
33
+ export { certificateToVc, VC_STATUS_TYPE, VC_TYPE, verifyCertificateVc, } from "./vc.js";
34
+ export { statusCheckpoint, statusConsistencyProof, statusInclusionProof, verifyStatusLog, } from "./witness.js";
35
+ export { buildAccreditationExport, buildFilingPack, buildGovernanceOutcome, buildSigningKeyApproval, CASE_KINDS, certifyRiskProfile, governanceOutcomeBody, OUTCOMES, RISK_NOTE, signingKeyApprovalBody, signRiskProfile, verifyRiskProfile, verifyAccreditationExport, verifyFilingPack, verifyGovernanceOutcome, verifySigningKeyApproval, } from "./governance.js";
36
+ export { AWS_NITRO_ROOT_PEM, AWS_NITRO_ROOT_SHA256, AWS_NITRO_GOV_ROOT_PEM, AWS_NITRO_GOV_ROOT_SHA256, checkNitroAttestation, NITRO_MAX_AGE_SECONDS, NITRO_MAX_SKEW_SECONDS, nitroMeasurement, nitroQuoteVerifier, nitroRootForPartition, parseNitroDocument, sigStructure, verifyNitroDocument } from "./nitro.js";
37
+ export { canonicalBytes, jcsHash } from "@zanii/core";
38
+ export { buildRuntimeRelease, buildRuntimePolicy, buildRuntimeApproval, buildRuntimeProof, buildRuntimeChallengeRequest, buildRuntimeLease, buildRuntimeAction, buildRuntimeLeaseRequest, buildRuntimeMandate, verifyRuntimeRelease, verifyRuntimePolicy, verifyRuntimeApproval, verifyRuntimeProof, verifyRuntimeChallengeRequest, verifyRuntimeLease, verifyRuntimeAction, verifyRuntimeLeaseRequest, verifyRuntimeMandate, runtimeReleaseHash, runtimePolicyHash, runtimeRequestHash, } from "./runtime.js";
39
+ export { runtimeNitroBindingHash, verifyRuntimeNitroDocument, RUNTIME_NITRO_MAX_BYTES, RUNTIME_NITRO_MAX_SKEW_SECONDS } from "./runtime-nitro.js";
40
+ export { createRuntimeGateway } from "./runtime-gateway.js";
41
+ export { createRuntimeReporter } from "./runtime-client.js";
42
+ export { buildRuntimeKnowledgeSnapshot, runtimeKnowledgeProof, runtimeKnowledgeProofs, verifyRuntimeKnowledgeChunk, } from "./runtime-knowledge.js";
43
+ export { resolveIssuerDetailed, fetchJsonBounded } from "./issuer-resolution.js";
44
+ export { isIssuerPolicy, issuerPolicyCheck, releasePolicyReasons } from "./verification-policy.js";
45
+ export { buildSandboxDelegationPolicy, verifySandboxDelegationPolicy } from "./sandbox-delegation.js";
46
+ export { teamReceiptTask } from "./suite.js";
47
+ export { BITSTRING_STATUS_SLOTS, buildBitstringStatusList, bitstringStatusEntry, verifyBitstringStatusList, verifyBitstringStatusEntry, certificateToBitstringVc, verifyCertificateBitstringVc } from "./bitstring-status.js";
48
+ export { reconcileRoyaltyStatementFeed } from "./royalty-reconciliation.js";
49
+ export { buildLicenceOwnerRotation, verifyLicenceOwnerHistory, licenceOwnerCheckpoint, licenceOwnerProof, licenceOwnerProofs, verifyLicenceWithOwnerHistory, isLicenceOwnerCheckpoint, isLicenceOwnerRotation } from "./licence-owner.js";
50
+ export { verifyLicenceOwnerEntry } from "./licence-owner-entry.js";
51
+ export { buildSchemeTextBundle, schemeTextBundleHash, verifySchemeTextBundle, SCHEME_TEXT_MAX_BYTES } from "./scheme-text.js";
52
+ export { certificateToCurrentIssuerVc, verifyCurrentIssuerCertificateVc } from "./current-issuer-vc.js";
53
+ export { buildAssuranceRevocation, buildAssuranceStatus, verifyAssuranceStatus } from "./assurance-status.js";
54
+ export { buildAuditRenewal, verifyAuditRenewal } from "./audit-renewal.js";
55
+ export { liveEvidenceFreshnessReasons } from "./live-evidence.js";
56
+ export { signingIdentityReasons } from "./signing-identity.js";
57
+ export { normalizationPolicyReasons, runtimeNormalizationVersion } from "./normalization.js";
58
+ export { schemaDialectErrors } from "./schema-dialect.js";
59
+ export { credentialHash } from "@zanii/credentials";
60
+ // Draft public-practice trajectory extension; existing v1 formats/certification scope are unchanged.
61
+ export { TRANSCRIPT_TURNS_BYTES, transcriptTurnsHash, validateTranscriptProvenance } from "./transcript-provenance.js";
62
+ export { validateSuiteDocument } from "./suite.js";
63
+ export { TRAJECTORY_LIMITS, trajectorySchema, isTrajectoryCase, validateTrajectorySuite, validateTrajectoryTrace, validateTrajectoryArguments, parseTrajectoryArguments, trajectoryTools, resolveTrajectoryRef, trajectoryConditions, trajectoryStateHash, trajectoryCaseHash, trajectorySuiteHash, checkTrajectory } from "./trajectory.js";
@@ -0,0 +1,4 @@
1
+ export declare function issuerArtifactAuthorization(artifact: {
2
+ signer: string;
3
+ issued_at: string;
4
+ }, current: string, document: unknown, owner: string, domain: string, at: string): string[];
@@ -0,0 +1,52 @@
1
+ // One bounded authority policy for current-key wrappers and historical assurance artifacts.
2
+ import { publicKeyFromDid } from "@zanii/core";
3
+ import { isInt, isIso, isObj, ms } from "./shared.js";
4
+ import { afterCompromise, compromisedKeyReasons, issuerLineage, succeeds } from "./succession.js";
5
+ import { withinVerificationBudget } from "./verification-bounds.js";
6
+ const did = (v) => typeof v === "string" && v.length <= 69 && publicKeyFromDid(v) !== null;
7
+ export function issuerArtifactAuthorization(artifact, current, document, owner, domain, at) {
8
+ if (!withinVerificationBudget(document, { maxBytes: 1_048_576 }))
9
+ return ["issuer authorization exceeds its JSON budget"];
10
+ if (!did(owner) || !did(current) || !isIso(at) || typeof domain !== "string" || domain.length > 253 || !/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/.test(domain) || domain.trim() !== domain
11
+ || !isObj(document) || document.v !== 1 || document.owner !== owner || document.domain !== domain
12
+ || !Array.isArray(document.dids) || document.dids.length < 1 || document.dids.length > 64 || document.dids[0] !== current || !Array.from(document.dids).every(did) || document.dids.includes(owner))
13
+ return ["current issuer wrapper requires independently pinned owner, domain and current key"];
14
+ if (!did(artifact.signer) || !isIso(artifact.issued_at) || ms(artifact.issued_at) > ms(at))
15
+ return ["invalid artifact signer or issuance time"];
16
+ const links = document.successions ?? [];
17
+ if (!Array.isArray(links) || links.length > 64)
18
+ return ["invalid or oversized issuer authorization history"];
19
+ const windows = document.activation_windows ?? [], policy = document.rotation_policy;
20
+ if (!Array.isArray(windows) || windows.length !== links.length || (links.length && (!isInt(document.cache_max_age_s, 1, 300) || !isObj(policy)
21
+ || !isInt(policy.overlap_s, 600, 86_400) || !isInt(policy.refresh_within_s, 1, document.cache_max_age_s))))
22
+ return ["issuer activation windows and bounded published rotation policy are required"];
23
+ for (const [i, link] of links.entries()) {
24
+ if (!isObj(link) || Object.keys(link).length !== 2 || !isObj(link.body) || Object.keys(link.body).length > 9 || Object.keys(link.body).some((k) => !["v", "type", "predecessor", "successor", "owner", "reason", "ts", "note", "compromised_at"].includes(k))
25
+ || link.body.v !== 1 || link.body.type !== "succession" || !["rotation", "retirement", "compromise"].includes(String(link.body.reason))
26
+ || !isIso(link.body.ts) || ms(link.body.ts) > ms(at) || (i && ms(link.body.ts) < ms(links[i - 1].body.ts))
27
+ || !did(link.body.owner) || !did(link.body.predecessor) || !did(link.body.successor)
28
+ || (link.body.note !== undefined && (typeof link.body.note !== "string" || link.body.note.length > 1000))
29
+ || (link.body.compromised_at !== undefined && (!isIso(link.body.compromised_at) || ms(link.body.compromised_at) > ms(link.body.ts)))
30
+ || !Array.isArray(link.signatures) || link.signatures.length < 1 || link.signatures.length > 2 || !Array.from(link.signatures).every((s) => isObj(s) && Object.keys(s).length === 2 && did(s.did) && typeof s.sig === "string" && s.sig.length === 136))
31
+ return ["invalid, future or unbounded issuer authorization link"];
32
+ const window = windows[i], announced = ms(link.body.ts);
33
+ if (!isObj(window) || Object.keys(window).length !== 2 || window.successor !== link.body.successor || !isIso(window.active_from)
34
+ || ms(window.active_from) > ms(at) || (i && ms(window.active_from) < ms(windows[i - 1].active_from)) || ms(window.active_from) < announced + (link.body.reason === "compromise" ? 0 : Number(document.cache_max_age_s) * 2000)
35
+ || ms(window.active_from) - announced > 86_400_000)
36
+ return ["issuer activation window is missing, future or outside published bounds"];
37
+ }
38
+ const lineage = issuerLineage(document);
39
+ if (lineage && !lineage.ok)
40
+ return lineage.reasons;
41
+ if (artifact.signer !== current && !succeeds(lineage, artifact.signer, current))
42
+ return ["current signing key is not an authorized successor of the original issuer"];
43
+ const reasons = [...compromisedKeyReasons(lineage, current, "current issuer wrapper"), ...afterCompromise(lineage, artifact.signer, artifact.issued_at, "artifact")];
44
+ for (const [i, link] of links.entries()) {
45
+ const activated = windows[i].active_from;
46
+ if (link.body.successor === artifact.signer && ms(artifact.issued_at) < ms(activated))
47
+ reasons.push("artifact predates its issuer activation");
48
+ if (link.body.predecessor === artifact.signer && link.body.reason !== "compromise" && ms(artifact.issued_at) >= ms(activated))
49
+ reasons.push("artifact was issued after its issuer retirement");
50
+ }
51
+ return reasons;
52
+ }
@@ -0,0 +1,25 @@
1
+ import type { ResolvedIssuer } from "@zanii/credentials";
2
+ export type IssuerResolutionCode = "invalid_input" | "dns" | "tls" | "timeout" | "network" | "http" | "document" | "key_missing" | "too_large" | "busy";
3
+ export interface ResolutionFailure {
4
+ ok: false;
5
+ code: IssuerResolutionCode;
6
+ status?: number;
7
+ }
8
+ export type IssuerResolution = {
9
+ ok: true;
10
+ issuer: ResolvedIssuer;
11
+ document: Record<string, unknown>;
12
+ } | ResolutionFailure;
13
+ export interface ResolutionOptions {
14
+ fetch?: typeof fetch;
15
+ timeoutMs?: number;
16
+ maxBytes?: number;
17
+ }
18
+ export type JsonFetchResult = {
19
+ ok: true;
20
+ document: unknown;
21
+ } | ResolutionFailure;
22
+ /** A single deadline covers headers and body, including injected transports that ignore AbortSignal. */
23
+ export declare function fetchJsonBounded(url: string, opts?: ResolutionOptions): Promise<JsonFetchResult>;
24
+ /** Unlike the legacy null resolver, distinguishes a failed fetch from a document that omits the key. */
25
+ export declare function resolveIssuerDetailed(did: string, domain: string, opts?: ResolutionOptions): Promise<IssuerResolution>;