@charter-agreement-protocol/verifier 0.7.0 → 2.0.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 +65 -0
- package/IPR.md +14 -0
- package/LICENSE +1 -1
- package/NOTICE +2 -2
- package/README.md +230 -30
- package/SECURITY.md +4 -2
- package/conformance/cases/acceptance-verify.json +1 -1
- package/conformance/cases/chain-verify.json +1 -1
- package/conformance/cases/chain-verify_profile.json +1 -1
- package/conformance/cases/charter_revision-decode.json +1 -1
- package/conformance/cases/descriptor_chain-verify.json +1 -1
- package/conformance/cases/descriptor_publication-verify.json +1 -0
- package/conformance/cases/governing_revision.json +1 -1
- package/conformance/cases/party_descriptor-verify.json +1 -1
- package/conformance/cases/receipt-inspect.json +1 -0
- package/conformance/cases/receipt-verify.json +1 -1
- package/conformance/cases/signing-prepare.json +1 -1
- package/conformance/cases/termination-verify.json +1 -1
- package/conformance/index.json +1 -1
- package/dist/core.d.ts +111 -9
- package/dist/core.js +1029 -245
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +14 -8
- package/reference.json +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,71 @@
|
|
|
3
3
|
All notable public changes to `@charter-agreement-protocol/verifier` are
|
|
4
4
|
documented here.
|
|
5
5
|
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [2.0.0] — 2026-11-27
|
|
9
|
+
|
|
10
|
+
- Inspect receipts against retained chain artifacts in Node and the browser.
|
|
11
|
+
Export the original signed segments, verified provenance, grant digest
|
|
12
|
+
equality, and governing agreement as JSON.
|
|
13
|
+
|
|
14
|
+
- Breaking TypeScript change: `SigningKind` and `SigningPlan.kind` include
|
|
15
|
+
`"party_replacement"`. Exhaustive switches over either type need a branch
|
|
16
|
+
for the new operation.
|
|
17
|
+
|
|
18
|
+
- Verify revision-8 party quorums, declared assignments, and receipt ownership.
|
|
19
|
+
Prepare assignor acceptances through the same checked signing path.
|
|
20
|
+
|
|
21
|
+
- Verify per-party signer scopes on revision-8 descriptors. Retain scope
|
|
22
|
+
facts on signed artifacts, exclude outside-scope votes from quorum and
|
|
23
|
+
assignment assent, and refuse outside-scope signing preparation.
|
|
24
|
+
|
|
25
|
+
- Require an accepted predecessor for every charter successor. A signed legacy
|
|
26
|
+
successor of an unsigned genesis remains proposed and cannot govern.
|
|
27
|
+
|
|
28
|
+
- Retain bounded signing contexts across key callbacks while preserving
|
|
29
|
+
preparation error order. Bound algorithm profiles before reading entries
|
|
30
|
+
and copy byte views without invoking caller conversion methods.
|
|
31
|
+
|
|
32
|
+
- Verify revision-8 descriptor commitments and unsigned current/next
|
|
33
|
+
publications in Node and browser builds.
|
|
34
|
+
|
|
35
|
+
- Check the canonical limited-substrate outcomes for receipt preparation
|
|
36
|
+
when the browser cannot verify the supplied ML-DSA chain.
|
|
37
|
+
|
|
38
|
+
- Expose the receipt deployment match and retained optional extension names
|
|
39
|
+
through `verifyReceipt`. The browser corpus uses the public verifier and
|
|
40
|
+
governing revision APIs.
|
|
41
|
+
|
|
42
|
+
- Pin the canonical CAP corpus by source commit and index SHA-256. Run
|
|
43
|
+
all 931 cases through the browser bundle, including the declared
|
|
44
|
+
limited-substrate outcomes and new receipt and lifecycle verdicts.
|
|
45
|
+
|
|
46
|
+
- Read CI runtime defaults and compatibility lanes only through the shared
|
|
47
|
+
toolchain reader, with exact installed-version checks.
|
|
48
|
+
|
|
49
|
+
- Resumes approved npm releases on the same commit, refusing missing package
|
|
50
|
+
names, retired versions and differing archive bytes. Preserves verified
|
|
51
|
+
consumer files for the maintainers' GitHub release and reads npm integrity back.
|
|
52
|
+
- Qualifies commits only through landing CI, with exact runtime checks and a
|
|
53
|
+
required site job. The maintainers' release process dispatches protected npm
|
|
54
|
+
and Pages publication from the default branch after qualification.
|
|
55
|
+
|
|
56
|
+
## [1.0.0] — 2026-11-09
|
|
57
|
+
|
|
58
|
+
- Lets the quickstart flush its complete canonical report before process exit.
|
|
59
|
+
- Updates the browser workshop to pass the current direct chain context to
|
|
60
|
+
the signer, fixing its stale wrapped acceptance context.
|
|
61
|
+
- Stabilizes the public API under Semantic Versioning; wire revisions 1–3 and
|
|
62
|
+
the certified corpus stay unchanged.
|
|
63
|
+
- Pins and checks the published Elixir 1.0 conformance reference. The release
|
|
64
|
+
gate verifies packed contents, reproducible bytes, installed README examples
|
|
65
|
+
and generated declarations.
|
|
66
|
+
- Refreshes documentation, security support, Node requirements and workshop
|
|
67
|
+
version labels. Updates development tools and adds the Node 24.8 CI floor.
|
|
68
|
+
- Stages verified archives with provenance through the existing npm trusted
|
|
69
|
+
publisher. Owner approval with 2FA is required to make them public.
|
|
70
|
+
|
|
6
71
|
## [0.7.0] — 2026-10-14
|
|
7
72
|
|
|
8
73
|
### Added
|
package/IPR.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Intellectual property
|
|
2
|
+
|
|
3
|
+
**Steward.** BaseLabs Holdings LLC is the steward of the Charter Agreement Protocol
|
|
4
|
+
specification and holds the copyright in the work it contributes. Contributors keep the
|
|
5
|
+
copyright in their contributions.
|
|
6
|
+
|
|
7
|
+
**License.** Everything in this repository, specification text, schemas, conformance
|
|
8
|
+
corpora and code alike, is licensed under the Apache License, Version 2.0, unless a
|
|
9
|
+
file or NOTICE says otherwise. See LICENSE and NOTICE.
|
|
10
|
+
|
|
11
|
+
**Contributions.** Contributions are accepted under the Apache License, Version 2.0, as
|
|
12
|
+
its section 5 describes, with a Developer Certificate of Origin 1.1 sign-off
|
|
13
|
+
(https://developercertificate.org) on every commit: `git commit -s`. No contributor
|
|
14
|
+
license agreement is required.
|
package/LICENSE
CHANGED
package/NOTICE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Charter Agreement Protocol Verifier (TypeScript)
|
|
2
|
-
Copyright 2026 BaseLabs
|
|
2
|
+
Copyright 2026 BaseLabs Holdings LLC
|
|
3
3
|
|
|
4
|
-
This product includes software developed by BaseLabs
|
|
4
|
+
This product includes software developed by BaseLabs Holdings LLC
|
|
5
5
|
(https://github.com/baselabs).
|
|
6
6
|
|
|
7
7
|
The certified conformance corpus vendored in this package is certified
|
package/README.md
CHANGED
|
@@ -4,20 +4,69 @@ Independent TypeScript verifier for the
|
|
|
4
4
|
[Charter Agreement Protocol](https://hex.pm/packages/charter_agreement_protocol) (CAP).
|
|
5
5
|
|
|
6
6
|
**CAP verifies. It never authorizes.** This package re-verifies signed,
|
|
7
|
-
byte-exact evidence of what
|
|
7
|
+
byte-exact evidence of what charter parties agreed — party descriptor key
|
|
8
8
|
histories (Ed25519 and, from `protocol_revision` 3, ML-DSA per RFC 9964),
|
|
9
|
-
charter revisions,
|
|
9
|
+
charter revisions, acceptances, termination notices, and action
|
|
10
10
|
receipts — completely offline, with no network, no clock, and no central
|
|
11
11
|
authority. Every verification result carries a closed floor of what was
|
|
12
12
|
*not* verified: authority, execution, billing, legal validity, term
|
|
13
13
|
satisfaction, and more. Hosts read the evidence and decide.
|
|
14
14
|
|
|
15
|
+
## Descriptor rotation
|
|
16
|
+
|
|
17
|
+
Use `descriptorNextKeyCommitment` to commit to a successor’s active keys. Create
|
|
18
|
+
revision-8 descriptors with the existing signing-input API. Pass the signed
|
|
19
|
+
history to `encodeDescriptorPublication` and `verifyDescriptorPublication` to
|
|
20
|
+
check the current and next pair and its opening status.
|
|
21
|
+
|
|
22
|
+
## Signer scopes
|
|
23
|
+
|
|
24
|
+
A revision-8 descriptor may declare `signing_scopes`, an array of up to 64
|
|
25
|
+
role entries. Each entry has a `role` and up to 32 `signers`. A signer
|
|
26
|
+
entry has a `key_thumbprint` from an active verification key and an
|
|
27
|
+
`artifact_kinds` array drawn from `acceptance`, `descriptor`, `receipt`,
|
|
28
|
+
and `termination`. Roles, thumbprints within each role, and kinds within
|
|
29
|
+
each signer entry are sorted and unique. Omission leaves the descriptor
|
|
30
|
+
unrestricted. An empty scope array permits no match.
|
|
31
|
+
|
|
32
|
+
`signerThumbprint` identifies a descriptor key by its algorithm and public
|
|
33
|
+
key bytes. Renaming its key id preserves that identity. The predecessor must
|
|
34
|
+
match `descriptor` under some role for its signing key to sign a successor.
|
|
35
|
+
|
|
36
|
+
Acceptances and terminations use the descriptor digest in the signed claims.
|
|
37
|
+
Receipts look up the issuing role in the named accepted revision. Those
|
|
38
|
+
verifiers report `scope_status` (`not_required`, `matched`, `outside`,
|
|
39
|
+
or `not_verified`) and `signer_thumbprint`. Bare-revision receipts and
|
|
40
|
+
receipts whose named revision is unrecognized have `not_verified` scope
|
|
41
|
+
and a null thumbprint.
|
|
42
|
+
|
|
43
|
+
Chain verification keeps every verified acceptance. It records the first
|
|
44
|
+
applicable `credit_reason` in order: `arbiter_not_counted`,
|
|
45
|
+
`role_outside_quorum`, and `signer_outside_scope`. A replacement vote uses
|
|
46
|
+
the predecessor's acceptance rule. An ordinary vote can still count under
|
|
47
|
+
the predecessor's rule when a successor narrows its quorum. A vote with a
|
|
48
|
+
reason has `credit: "uncredited"` and contributes no quorum vote.
|
|
49
|
+
Every candidate party supplies ordinary assignment assent even if its role
|
|
50
|
+
is outside the quorum. An outside signer cannot supply that assent.
|
|
51
|
+
Eligible votes have `credit: "not_required"` and a null reason.
|
|
52
|
+
Single-artifact acceptance verification returns
|
|
53
|
+
`credit: "not_evaluated"` and a null reason.
|
|
54
|
+
|
|
55
|
+
Outside termination notices remain visible and contribute no termination
|
|
56
|
+
votes. Receipt scope is descriptive. Checked signing refuses outside scope
|
|
57
|
+
with `signing_refused`. An outside descriptor successor returns
|
|
58
|
+
`descriptor_chain_invalid` in verification and checked preparation.
|
|
59
|
+
|
|
15
60
|
## Install
|
|
16
61
|
|
|
17
62
|
```console
|
|
18
|
-
npm install @charter-agreement-protocol/verifier
|
|
63
|
+
npm install @charter-agreement-protocol/verifier@^2.0.0
|
|
19
64
|
```
|
|
20
65
|
|
|
66
|
+
|
|
67
|
+
The maintainers' release process publishes inspected archives to npm with
|
|
68
|
+
provenance through GitHub Actions trusted publishing after owner approval.
|
|
69
|
+
|
|
21
70
|
Requires Node >= 24.8 (ML-DSA landed in the Node builtins across the
|
|
22
71
|
24.6–24.8 minors). Zero runtime dependencies — Node builtins only.
|
|
23
72
|
|
|
@@ -35,14 +84,14 @@ const require = createRequire(import.meta.url);
|
|
|
35
84
|
const corpusRoot = join(dirname(require.resolve("@charter-agreement-protocol/verifier/package.json")), "conformance");
|
|
36
85
|
const report = reportFor(corpusRoot);
|
|
37
86
|
console.log(report.bytes); // canonical JSON report
|
|
38
|
-
process.
|
|
87
|
+
process.exitCode = report.exitStatus; // 0 = all certified cases recomputed and agreed
|
|
39
88
|
```
|
|
40
89
|
|
|
41
90
|
Or from the shell:
|
|
42
91
|
|
|
43
92
|
```console
|
|
44
|
-
npx @charter-agreement-protocol/verifier # the vendored certified corpus
|
|
45
|
-
npx @charter-agreement-protocol/verifier --corpus DIR # any corpus directory
|
|
93
|
+
npx @charter-agreement-protocol/verifier@^2.0.0 # the vendored certified corpus
|
|
94
|
+
npx @charter-agreement-protocol/verifier@^2.0.0 --corpus DIR # any corpus directory
|
|
46
95
|
```
|
|
47
96
|
|
|
48
97
|
Exit `0` means every case recomputed and agreed with the certified
|
|
@@ -55,6 +104,7 @@ cannot verify green.
|
|
|
55
104
|
| Export | What it does |
|
|
56
105
|
|---|---|
|
|
57
106
|
| `reportFor(root)` | Load + integrity-check + recompute a corpus directory; returns the canonical report bytes and exit status |
|
|
107
|
+
| `runConformanceCase(case)` | Run one decoded corpus case through the public verifier and project its verdict |
|
|
58
108
|
| `loadCorpus(root)` | Integrity-checked corpus load (canonical index, digests, file set, applicability floor, certified index pin) |
|
|
59
109
|
| `selfChecks()` | The self-check battery: SHA-256 known answers, canonical ordering, strict base64url, timestamp and limit invariants |
|
|
60
110
|
| `canonical(value)` | RFC 8785 canonical JSON serialization |
|
|
@@ -62,29 +112,46 @@ cannot verify green.
|
|
|
62
112
|
| `jsonProjection(value)` | The tagged projection used by reports; object members retain text order |
|
|
63
113
|
| `Limits`, `DEFAULT_LIMITS`, `MAXIMUM_LIMITS` | Closed limits type, reference defaults and compiled maximum values; overrides must be nonnegative integers within the maximums |
|
|
64
114
|
| `ChainInput` | A chain view with `revisions`, `acceptances`, `descriptors`, and `terminations` string arrays |
|
|
65
|
-
| `VerificationOptions` | Optional `{ limits?: Partial<Limits>, profile?: { algorithms
|
|
115
|
+
| `VerificationOptions` | Optional `{ limits?: Partial<Limits>, profile?: { algorithms?: string[]; revisions?: { min: number; max: number } } }` for public verification |
|
|
66
116
|
| `SigningOptions` | Verification options plus an optional `algorithm` for `prepareSigning` |
|
|
117
|
+
| `algorithmRegistry()` / `emissions()` / `defaultEmissionName()` | Signature registry rows, producer algorithm/revision pairs and the default emission name |
|
|
118
|
+
| `Profile` / `DescriptorPredecessor` | Optional capability axes and retained descriptor identity/lineage types |
|
|
67
119
|
| `capabilities()` / `algorithmRegistryDigest()` | Runtime known-answer results per signature registry row, and the signature registry digest |
|
|
68
120
|
| `CERTIFIED_INDEX_SHA256_BASE64URL`, `CERTIFIED_REGISTRY_DIGEST` | The certified identity pins this build carries |
|
|
121
|
+
| `inspectReceipt(compact, chain, grantReference?, options?)` | Receipt bytes, verified provenance, grant digest equality, and governing agreement |
|
|
69
122
|
| `verifyDescriptor(compact, predecessor?, options?)` / `verifyDescriptorChain(compacts, options?)` | Artifact-level verification: one party descriptor (with optional predecessor facts), or a full descriptor chain |
|
|
123
|
+
| `signerThumbprint(key)` | Validate a descriptor verification-key declaration and return its tagged algorithm-and-public-key identity |
|
|
70
124
|
| `verifyAcceptance(compact, revisionText, descriptorCompacts, options?)` / `verifyTermination(compact, revisionText, descriptorCompacts, options?)` | Artifact-level verification of an acceptance / termination notice against the named revision and the signing party's descriptor chain |
|
|
71
|
-
| `verifyChain(chainInput, options?)` / `verifyReceipt(compact, chainInput, options?)` | Full chain-view verification (facts include topology, verified acceptances and termination notices); receipt verification against the verified chain |
|
|
72
|
-
| `checkSigningClaims(kind, claims)` | The producer build gate's claims half (the reference `decode_for_signing`): the claims-only schema checks
|
|
125
|
+
| `verifyChain(chainInput, options?)` / `verifyReceipt(compact, chainInput, options?)` | Full chain-view verification (facts include topology, verified acceptances and termination notices); receipt verification against the verified chain, with `deployment_digest_matched` and `optional_extensions_retained` in its facts |
|
|
126
|
+
| `checkSigningClaims(kind, claims)` | The producer build gate's claims half (the reference `decode_for_signing`): the claims-only schema checks for the four wire artifact kinds — `descriptor \| acceptance \| termination \| receipt` — shared with the verify paths; holder-side signers run it before any key is used |
|
|
73
127
|
| `decodeArtifact(compact)` / `verifySignature(message, signature, publicKey, alg, options?)` | Framing decode and the strict signature primitive; the latter retains its boolean result with optional limits and algorithm filtering |
|
|
74
128
|
| `descriptorSigningInput(kid, claims, alg?)` / `receiptSigningInput(kid, claims, alg?)` | The build-only producers: the exact RFC 7515 signing input per kind (emission pair gated, claims schema gated, provisional decode) — no key, no signature |
|
|
75
|
-
| `acceptanceSigningInput(kid, claims, chainInput, alg?)` / `terminationSigningInput(kid, claims, chainInput, alg?)` |
|
|
76
|
-
| `prepareSigning(kind, kid, claims, publicKey, context, options?)` | Check framing, claims, context, profile, limits,
|
|
129
|
+
| `acceptanceSigningInput(kid, claims, chainInput, alg?)` / `partyReplacementSigningInput(kid, claims, chainInput, alg?)` / `terminationSigningInput(kid, claims, chainInput, alg?)` | Set-aware producers. The replacement producer frames the departing party's marked acceptance. |
|
|
130
|
+
| `prepareSigning(kind, kid, claims, publicKey, context, options?)` | Check framing, claims, context, profile, limits, key membership, and signer scope before signing; return a `SigningPlan` |
|
|
131
|
+
| `retainSigningContext(kind, context, options?)` | Validate options and context shape, then capture a bounded context before awaiting custody. On success, `value(kid, claims, publicKey)` prepares with the same result and error order as `prepareSigning`. |
|
|
77
132
|
| `finishSigning(plan, signature)` | Assemble under the plan's limits and run public verification with its retained context |
|
|
78
|
-
| `SigningPlan` / `SigningKind` | The plan class exposes `kind`, `input`, and `key` (`matched` or `unnamed`); kinds are `descriptor`, `acceptance`, `termination`, and `receipt` |
|
|
133
|
+
| `SigningPlan` / `SigningKind` | The plan class exposes `kind`, `input`, and `key` (`matched` or `unnamed`); kinds are `descriptor`, `acceptance`, `party_replacement`, `termination`, and `receipt` |
|
|
79
134
|
| `assembleCompact(signingInput, signature)` | Assemble a validated signing input and its exact raw signature (registry-row length, framing re-decode, size gate) |
|
|
80
135
|
| `governingRevision(chainInput, at, options?)` | The unique governing revision at one UTC instant — a digest, or `contested`/`none`, including verified termination closing |
|
|
81
136
|
| `decodeCharterRevision(text, options?)` / `revisionDigest(text, options?)` | Decode one canonical unsigned Charter Revision (claims + content digest over the exact text bytes) |
|
|
82
137
|
| `decodePartyDescriptor(compact)` / `descriptorDigest(compact)` | Decode one Party Descriptor's claims and digest without verifying its signature |
|
|
83
138
|
| `acceptanceRefusal(claims, chainInput)` / `terminationRefusal(claims, chainInput)` | The honest-signer refusal checks (R1–R3: claims-truth, no-equivocation, ancestry/governing coverage) over the caller's own view return `{ok: true}`, `signing_refused`, `signing_input_invalid`, or the set verification error. Holder-side signers run these before any key is used; the rule that fired is deliberately not surfaced |
|
|
84
139
|
|
|
140
|
+
Additional exported structural types are `CanonicalValue`, `Projection`,
|
|
141
|
+
`DecodeResult`, `CaseResult`, `CorpusFile`, `CorpusIndex`, `ConformanceCase`,
|
|
142
|
+
`LoadedCorpus`, `CaseOutcome`, `ConformanceReport`, `ReportOutput`,
|
|
143
|
+
`SigningInput`, `ProducerResult`, `AlgRow`, `VerifyResult`, and `RefusalResult`.
|
|
144
|
+
The installed declarations contain their complete shapes.
|
|
145
|
+
|
|
146
|
+
Legacy artifacts, including receipts, use `Ed25519` at protocol revision 2
|
|
147
|
+
or `ML-DSA-65` at revision 3. Revision-8 party descriptors, acceptances
|
|
148
|
+
(including marked assignor acceptances), and termination notices can use
|
|
149
|
+
either algorithm.
|
|
150
|
+
|
|
85
151
|
`prepareSigning` accepts a predecessor or `null` for a descriptor, a chain view
|
|
86
|
-
(`revisions`, `acceptances`, `descriptors`, `terminations` arrays) for acceptance
|
|
87
|
-
|
|
152
|
+
(`revisions`, `acceptances`, `descriptors`, `terminations` arrays) for acceptance,
|
|
153
|
+
party replacement, and termination. It accepts a chain view for a receipt,
|
|
154
|
+
or bare revision text for a legacy charter. Pass a
|
|
88
155
|
canonical base64url public key. Its options are `algorithm`, `limits`, and
|
|
89
156
|
`profile`. Limits cover every artifact read, including the entire set. For
|
|
90
157
|
acceptance and termination, the profile covers the revision, the signing party's
|
|
@@ -96,8 +163,10 @@ Sign `plan.input.message`, then pass the raw `Uint8Array` signature to
|
|
|
96
163
|
`finishSigning`. Both signature functions accept plain and cross-realm
|
|
97
164
|
`Uint8Array` bytes, including Node Buffers. `verifySignature` returns `false` for
|
|
98
165
|
`ArrayBuffer` and `DataView` inputs; `finishSigning` returns `invalid_type` for
|
|
99
|
-
them. A bare
|
|
100
|
-
|
|
166
|
+
them. A receipt prepared against a bare legacy revision has `key: "unnamed"`.
|
|
167
|
+
Preparing against a bare revision-8 charter returns `signing_refused`.
|
|
168
|
+
Public receipt verification against a bare revision lists `signature` in
|
|
169
|
+
`not_verified` and adds `ownership` for revision 8. `signing_key_invalid` means the
|
|
101
170
|
snapshot key fails the encoding or shape check; `signing_key_mismatch` means it
|
|
102
171
|
matches no active candidate in the holder's own view. The plan retains private
|
|
103
172
|
copies of its input, context arrays, limits, and profile. The existing producers
|
|
@@ -108,11 +177,11 @@ producers still returns `signing_input_invalid`.
|
|
|
108
177
|
The following public functions return typed results for malformed input and
|
|
109
178
|
unreadable getters or Proxies: `verifyDescriptor`, `verifyDescriptorChain`,
|
|
110
179
|
`verifyAcceptance`, `verifyTermination`, `verifyChain`, `verifyReceipt`,
|
|
111
|
-
`prepareSigning`, `finishSigning`, `governingRevision`, `decodeArtifact`,
|
|
180
|
+
`prepareSigning`, `retainSigningContext`, `finishSigning`, `governingRevision`, `decodeArtifact`,
|
|
112
181
|
`decodeCharterRevision`, `revisionDigest`, `decodePartyDescriptor`,
|
|
113
182
|
`descriptorDigest`, `checkSigningClaims`, `acceptanceRefusal`,
|
|
114
183
|
`terminationRefusal`, `descriptorSigningInput`, `receiptSigningInput`,
|
|
115
|
-
`acceptanceSigningInput`, `terminationSigningInput`, `assembleCompact`, and
|
|
184
|
+
`acceptanceSigningInput`, `partyReplacementSigningInput`, `terminationSigningInput`, `assembleCompact`, and
|
|
116
185
|
`decodeJsonText`. `verifySignature` returns `false` for malformed input.
|
|
117
186
|
`canonical`, `jsonProjection`, `encodeBase64url`, `taggedDigest`, `loadCorpus`,
|
|
118
187
|
and `reportFor` retain their existing return shapes and can throw on invalid
|
|
@@ -124,7 +193,7 @@ Copies check array lengths and byte sizes before allocation and bound expanded
|
|
|
124
193
|
bytes and depth. Deep or excessively shared signing claims return
|
|
125
194
|
`signing_input_invalid`.
|
|
126
195
|
|
|
127
|
-
Verification options default to the full algorithm registry, revisions 1
|
|
196
|
+
Verification options default to the full algorithm registry, revisions 1, 2, 3, and 8,
|
|
128
197
|
and `DEFAULT_LIMITS`. Profiles apply to each signed artifact after its local
|
|
129
198
|
checks and before crypto; unsigned charter revisions use only the revision
|
|
130
199
|
axis. Public acceptance, termination, and receipt calls re-verify their
|
|
@@ -162,9 +231,9 @@ substrate cannot verify, keeping that local result outside verdict reports.
|
|
|
162
231
|
canonical reports must be byte-identical over the certified corpus — in
|
|
163
232
|
this repository and over the unpacked published package — enforced by the
|
|
164
233
|
reference repository's gates, together with a randomized differential
|
|
165
|
-
harness and
|
|
234
|
+
harness and its red-required mutation battery.
|
|
166
235
|
- **The certified corpus** ships in this package (`conformance/`), pinned by
|
|
167
|
-
|
|
236
|
+
an Elixir source commit and raw index SHA-256 checked at load.
|
|
168
237
|
- **Ed25519 key and R admission.** After `npm run build`, run
|
|
169
238
|
`npm run check:ed25519 -- /path/to/elixir/repository` to compare the source
|
|
170
239
|
and built predicates with Elixir at `911d84b` on 10,000 seeded inputs and
|
|
@@ -190,18 +259,149 @@ cross-verifies TypeScript-signed artifacts from raw bytes):
|
|
|
190
259
|
calls `prepareSigning` before the key is used and `finishSigning` after,
|
|
191
260
|
so every protocol check stays in this package.
|
|
192
261
|
|
|
193
|
-
The
|
|
194
|
-
verifier
|
|
195
|
-
the
|
|
262
|
+
The published signer's dependency range stops before verifier 2.0.0. Check the
|
|
263
|
+
signer's verifier dependency when upgrading both packages. For a paired release,
|
|
264
|
+
the maintainers publish and verify the verifier before publishing the signer.
|
|
265
|
+
|
|
266
|
+
## Upgrade to 2.0
|
|
267
|
+
|
|
268
|
+
Add a `"party_replacement"` branch to exhaustive switches on `SigningKind`
|
|
269
|
+
and `SigningPlan.kind`. This kind prepares a marked acceptance from the
|
|
270
|
+
departing party for a declared assignment.
|
|
196
271
|
|
|
197
272
|
## SemVer
|
|
198
273
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
274
|
+
The public JavaScript exports, TypeScript contracts and documented option
|
|
275
|
+
and error shapes follow Semantic Versioning. Removing or renaming a public
|
|
276
|
+
surface, or making an incompatible change to valid-input behavior, requires a
|
|
277
|
+
major release. New exports and optional options or fields are minor additions. An incompatible
|
|
278
|
+
change to a closed TypeScript union requires a major release. Compatible bug and
|
|
279
|
+
security fixes can tighten malformed-input handling; they are recorded in the
|
|
280
|
+
changelog. Package versions do not change an artifact's `protocol_revision`.
|
|
281
|
+
|
|
282
|
+
## Conformance reference and development
|
|
283
|
+
|
|
284
|
+
`reference.json` pins CAP 1.0.0 as the published archive for compatibility
|
|
285
|
+
checks. Verifier 2.0.0 implements CAP 1.1.0. Its corpus has 931 cases in 18 files
|
|
286
|
+
copied from the [canonical Elixir commit](https://github.com/baselabs/charter_agreement_protocol/tree/55cd0662d7fa5d3a4cf7633180ea1fdd08409e28/priv/conformance).
|
|
287
|
+
The verifier checks the SHA-256 of the index and every listed case file.
|
|
288
|
+
Legacy revisions require assent from both parties. One qualifying notice
|
|
289
|
+
can close a legacy charter. Every charter successor needs an accepted predecessor.
|
|
290
|
+
A signed legacy successor of an unsigned genesis can lose governing status
|
|
291
|
+
on replay. Revision 8 requires the revision's acceptance
|
|
292
|
+
quorum, the applicable predecessor quorum, and any required assignment
|
|
293
|
+
assent. Closure requires a termination quorum for the same governing
|
|
294
|
+
revision, reason, and effective instant. See the [core specification](https://github.com/baselabs/charter_agreement_protocol/blob/55cd0662d7fa5d3a4cf7633180ea1fdd08409e28/spec/core.md).
|
|
295
|
+
The browser bench can inspect a receipt with its retained artifact set and
|
|
296
|
+
optional grant digest. Its download contains the same JSON evidence that
|
|
297
|
+
`inspectReceipt` returns. The signed segments reconstruct the receipt
|
|
298
|
+
exactly when joined with periods.
|
|
299
|
+
|
|
300
|
+
Node and the browser bundle run all 931 cases. The browser uses the corpus's
|
|
301
|
+
explicit capability-limited outcomes for ML-DSA verification.
|
|
302
|
+
`npm run check:reference` fetches the exact Elixir source commit from
|
|
303
|
+
`reference.json`, compares all vendored files to its Git blobs, and checks
|
|
304
|
+
that the released cases are retained.
|
|
305
|
+
`npm run check:reference -- --report` compares their exact report rows;
|
|
306
|
+
it requires Elixir 1.19/1.20 on OTP 28/29 linked to OpenSSL 3.5 or newer.
|
|
307
|
+
|
|
308
|
+
Use Node >= 24.8.0 and npm; `.tool-versions` pins the development Node.
|
|
309
|
+
The lockfile records TypeScript 7 and the current Node declarations. Qualification
|
|
310
|
+
runs these commands on GitHub-hosted runners:
|
|
311
|
+
|
|
312
|
+
```console
|
|
313
|
+
npm ci
|
|
314
|
+
npm run check
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
`check` runs strict library and browser typechecks, the full native/browser and
|
|
318
|
+
resource-boundary suites, self-checks, both builds, corpus agreement, the
|
|
319
|
+
released-corpus check, and the packed-consumer documentation/declaration checks.
|
|
320
|
+
CI covers the exact Node in `.tool-versions` and the Node 24.8.0 compatibility
|
|
321
|
+
floor; both lanes require the exact Bun pin for its real substrate behavior.
|
|
322
|
+
The reference job also installs the exact Erlang/OTP and Elixir pins from that
|
|
323
|
+
file. Every runtime is checked after installation. `npm run check:package` proves package
|
|
324
|
+
contents and reproducible bytes, executes this quickstart and the installed CLI,
|
|
325
|
+
and writes the verified tarball to `artifacts/package.tgz`.
|
|
326
|
+
|
|
327
|
+
## Releases
|
|
328
|
+
|
|
329
|
+
The maintainers' release process runs covering checks on the build box where
|
|
330
|
+
configured, never on a workstation. This public repository has no build-box
|
|
331
|
+
checkout: its qualification runs on pinned GitHub-hosted runners at landing.
|
|
332
|
+
Prepare the version commit with matching `package.json` and `package-lock.json`
|
|
333
|
+
versions, stamp the changelog, and update the documented release and site badge.
|
|
334
|
+
Land the full commit through the maintainers' landing tool; it qualifies the commit
|
|
335
|
+
on `kci/**` before moving the default branch. Do not push the default branch or
|
|
336
|
+
version tags directly.
|
|
337
|
+
|
|
338
|
+
Send the release operator one message with the repository, full commit, version, what goes out,
|
|
339
|
+
and the green `qualified` run. The release operator obtains owner approval and dispatches
|
|
340
|
+
[publish.yml](https://github.com/baselabs/charter_agreement_protocol_typescript/blob/main/.github/workflows/publish.yml)
|
|
341
|
+
from the default branch with the full qualified SHA as `release_commit`.
|
|
342
|
+
The first job checks default-branch history, the successful `qualified` check and
|
|
343
|
+
the absence of a version tag before checkout. The build uses that commit and the
|
|
344
|
+
registry script comes from the workflow revision. The build refuses a package
|
|
345
|
+
name the registry lacks, a deprecated or unpublished version, and served bytes
|
|
346
|
+
that differ from the inspected archive. A first publication is the owner's
|
|
347
|
+
decision. The build produces the library and documentation site and inspects
|
|
348
|
+
the archive. The protected upload job verifies the archive checksum and stages
|
|
349
|
+
missing bytes with
|
|
350
|
+
`npm stage publish --provenance` through OIDC. No stored npm token is used.
|
|
351
|
+
The package becomes public only after the owner approves the staged release
|
|
352
|
+
on npmjs.com with 2FA.
|
|
353
|
+
|
|
354
|
+
A held release is finished by dispatching `publish.yml` again with the same
|
|
355
|
+
`release_commit` after approval. It stages only what is missing, skips an identical
|
|
356
|
+
served version, and refuses differing bytes or a retired version. npm's OIDC
|
|
357
|
+
credentials cannot read pending staged versions: a dispatch while approval
|
|
358
|
+
is still pending may attempt to stage again, which npm refuses without
|
|
359
|
+
replacing the staged version. Approve the pending stage before dispatching
|
|
360
|
+
again.
|
|
361
|
+
|
|
362
|
+
Read-back downloads the npm tarball and compares its bytes with the inspected
|
|
363
|
+
archive. After it verifies the signed release commit, the workflow exports
|
|
364
|
+
`charter-agreement-protocol-verifier-<version>.tgz`, the site docs archive and `SHA256SUMS`. The docs archive
|
|
365
|
+
contains root `index.html` and `release.json`. The release operator compares the
|
|
366
|
+
tarball with npm's bytes and tags the commit named by `release.json`.
|
|
367
|
+
For a paired release, publish and verify the verifier first.
|
|
368
|
+
|
|
369
|
+
### Release source attestation
|
|
370
|
+
|
|
371
|
+
npm provenance identifies the default-branch workflow revision. The release
|
|
372
|
+
workflow also signs a predicate containing the qualified `release_commit` over
|
|
373
|
+
the checked tarball's digest. Read-back checks that predicate against the
|
|
374
|
+
tarball downloaded from npm.
|
|
375
|
+
|
|
376
|
+
To verify a release, download the archives and `SHA256SUMS` from the matching
|
|
377
|
+
[`v<version>` GitHub release](https://github.com/baselabs/charter_agreement_protocol_typescript/releases) and run
|
|
378
|
+
`sha256sum --check SHA256SUMS` in their directory. Compare the tarball's SHA-512
|
|
379
|
+
with npm's `dist.integrity`, then verify its release source against the tag.
|
|
380
|
+
|
|
381
|
+
```sh
|
|
382
|
+
published_commit=$(gh api "repos/baselabs/charter_agreement_protocol_typescript/commits/v<version>" -q .sha)
|
|
383
|
+
gh attestation verify "charter-agreement-protocol-verifier-<version>.tgz" \
|
|
384
|
+
--repo baselabs/charter_agreement_protocol_typescript \
|
|
385
|
+
--signer-workflow baselabs/charter_agreement_protocol_typescript/.github/workflows/publish.yml \
|
|
386
|
+
--source-ref refs/heads/main \
|
|
387
|
+
--predicate-type 'https://github.com/baselabs/charter_agreement_protocol_typescript/blob/main/README.md#release-source-attestation' \
|
|
388
|
+
--format json |
|
|
389
|
+
jq -e --arg commit "$published_commit" \
|
|
390
|
+
'any(.[]; .verificationResult.statement.predicate.release_commit == $commit)'
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Site typechecking and building are required by `qualified`. The release operator dispatches
|
|
394
|
+
[pages.yml](https://github.com/baselabs/charter_agreement_protocol_typescript/blob/main/.github/workflows/pages.yml)
|
|
395
|
+
from the default branch to build and deploy the static site through GitHub's
|
|
396
|
+
`github-pages` environment. A default-branch push or version tag starts neither workflow.
|
|
397
|
+
|
|
398
|
+
## Contributing
|
|
399
|
+
|
|
400
|
+
Contributions are licensed under Apache-2.0, as section 5 of the license describes, and
|
|
401
|
+
every commit carries a Developer Certificate of Origin sign-off (`git commit -s`). See
|
|
402
|
+
IPR.md.
|
|
203
403
|
|
|
204
404
|
## License
|
|
205
405
|
|
|
206
|
-
Apache-2.0
|
|
207
|
-
|
|
406
|
+
Apache-2.0, maintained by BaseLabs Holdings LLC. See LICENSE and NOTICE, and
|
|
407
|
+
IPR.md for contributions.
|
package/SECURITY.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
| Version | Security fixes |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
|
|
|
8
|
-
|
|
|
7
|
+
| 2.x | supported |
|
|
8
|
+
| Earlier releases | upgrade to 2.x |
|
|
9
9
|
|
|
10
10
|
The [changelog](CHANGELOG.md) describes verification changes between releases.
|
|
11
11
|
Keep the package version with stored verification results so you can check
|
|
@@ -48,6 +48,8 @@ In scope: everything shipped in the npm package
|
|
|
48
48
|
|
|
49
49
|
- Decoding, canonicalization, digests, signature checks, descriptor, chain,
|
|
50
50
|
acceptance, termination and receipt verification, and the facts they return.
|
|
51
|
+
- Descriptor signer-scope matching, including predecessor continuity and
|
|
52
|
+
whether verified votes count toward an assignment or quorum.
|
|
51
53
|
- Signing input helpers, compact assembly, `prepareSigning` and `finishSigning`.
|
|
52
54
|
The caller supplies the context, time, limits, public key and signature.
|
|
53
55
|
- The corpus loader and CLI, including filesystem checks. They cap a corpus
|