@charter-agreement-protocol/signer 0.2.1 → 0.3.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 CHANGED
@@ -3,6 +3,153 @@
3
3
  All notable public changes to `@charter-agreement-protocol/signer` are
4
4
  documented here.
5
5
 
6
+ ## [0.3.0] — October 14, 2026
7
+
8
+ ### Breaking
9
+
10
+ - `signAcceptance` and `signTermination` now take `(claims, keyHandle, chain,
11
+ opts)`. The verifier derives context from that chain; `revisionText` and
12
+ `descriptorCompacts` are removed from the signer input. Migration:
13
+
14
+ ```ts
15
+ // Before
16
+ await signAcceptance(claims, keyHandle, { revisionText, descriptorCompacts, chain }, opts);
17
+ // Now
18
+ await signAcceptance(claims, keyHandle, chain, opts);
19
+ await signTermination(terminationClaims, keyHandle, chain, opts);
20
+ ```
21
+
22
+ - The holder's own descriptor key is checked before signing. A wrong kid,
23
+ public key, or key algorithm returns
24
+ `{ ok: false, error: "refused", code: "signing_key_mismatch" }`.
25
+ `signing_key_invalid` maps to `invalid_key_handle`. For otherwise valid
26
+ descriptor claims, an absent or null successor predecessor, a valid predecessor
27
+ supplied to a genesis, broken signed lineage, or digest aliases that disagree
28
+ with the reverified lineage return `invalid_input`/`descriptor_chain_invalid`.
29
+ A non-object predecessor, both digest aliases absent, or missing, null, empty,
30
+ or non-string lineage return `invalid_input`/`invalid_type`. Throwing reads also
31
+ return `invalid_type`. History excluded by a profile or requiring unavailable
32
+ crypto preserves the profile or substrate code.
33
+ - Context, claims/context mismatches, profile exclusions, and compact size
34
+ limits reject before the signing callback. Missing or malformed context
35
+ types return `invalid_input`/`invalid_type`; malformed sets preserve the
36
+ verifier's code, including `compact_invalid`. `verification_failed` now
37
+ means only that `finishSigning` rejected what preparation approved.
38
+ - Unavailable crypto returns the top-level
39
+ `{ ok: false, error: "algorithm_unsupported_on_substrate" }` before signing,
40
+ including an ML-DSA-65 request on the browser bundle.
41
+ - Rename `invalid_handle` to `invalid_key_handle`. Update error comparisons
42
+ and exhaustive switches; the result shape is unchanged. Add the new substrate
43
+ error and refusal code to exhaustive handling.
44
+ - Options must be absent or a plain object containing only `algorithm`,
45
+ `limits`, `profile`, and (for `signDescriptor`) `predecessor`. Unknown keys,
46
+ non-plain objects, and unreadable getters return `invalid_input`/`invalid_type`.
47
+ Malformed limits and profiles preserve `invalid_limits` and `invalid_profile`.
48
+ Previously, a misspelled option key silently fell back to Ed25519.
49
+
50
+ ### Added
51
+
52
+ - `signDescriptor` accepts the verifier's `DescriptorPredecessor` as
53
+ `opts.predecessor`, with retained signed `lineage`, for successor descriptors.
54
+ - All four functions accept verifier `limits` and `profile` options. Limits
55
+ include the final compact and context artifacts and also apply to the custody
56
+ guard and completion. Profiles check the new artifact and retained context.
57
+ - `signReceipt` accepts bare revision text as well as a chain view. With a
58
+ bare revision, the custody guard checks the snapshot key and verifier facts
59
+ list `signature` in `not_verified`.
60
+ - Export `SigningOptions` and `DescriptorOptions`. Real-key tests cover
61
+ Ed25519 and ML-DSA-65 successors and pre-sign refusals, with zero signing calls
62
+ asserted on rejection. The browser bundle test runs the complete workshop flow.
63
+ - Include `SECURITY.md`, `CODE_OF_CONDUCT.md`, and `CONTRIBUTING.md` in the
64
+ npm package with this package's reporting and contribution practices.
65
+ - Run the shared signer table from `charter_agreement_signer` 0.5.0, copied byte for byte with
66
+ a SHA-256 check. All 121 rows use real seed keys and compare result shapes,
67
+ codes, snapshot counts, and custody counts. Twelve Ed25519 successes match
68
+ exact compacts; five ML-DSA-65 successes pass public verification. The explicit
69
+ list of unexpressible rows is empty, and the run count is asserted. Eight
70
+ shared requests or contexts needing ML-DSA-65 refuse before browser custody.
71
+
72
+ ### Changed
73
+
74
+ - Delegate preparation and completion to verifier 0.7.0's `prepareSigning`
75
+ and `finishSigning`; remove the signer's context derivation,
76
+ producer calls, assembly calls, and choice of post-sign verification function.
77
+ - Require `@charter-agreement-protocol/verifier` ^0.7.0. Its signing preparation
78
+ corpus uses the public input shapes, and signing plans can only be made through
79
+ `prepareSigning`. The signer already uses that path.
80
+ - Accept signature bytes from any JavaScript realm, including Buffer and plain
81
+ `Uint8Array`. Ed25519 snapshot keys with noncanonical y coordinates, no curve
82
+ point, x = 0 with the sign bit set, or small order return `invalid_key_handle`.
83
+ Invalid descriptor claim keys can fail earlier with `signing_input_invalid`.
84
+ The verifier checks option values before either key callback. Sparse profile
85
+ algorithm lists return `invalid_input`/`invalid_profile`; nonfinite or
86
+ explicitly undefined limit values return `invalid_input`/`invalid_limits`.
87
+ - Copy claims into plain JSON before the first `await`, without array
88
+ constructor hooks. Read defined context and predecessor members once and
89
+ retain artifact lists for the verifier. Lineage arrays have no JSON bounds.
90
+ Claims entry guards use the verifier's maximum JSON bounds. Caller limits and final compact size are
91
+ checked by `prepareSigning`; oversize claims return `signing_input_invalid`.
92
+ Predecessor lineage has no signer item limit.
93
+ - Read defined option members once with ordinary property access, including
94
+ inherited members and accepted class or Map properties. Keep invalid member
95
+ values opaque for the verifier's checks. Return every verifier option error,
96
+ including copy errors. Long algorithm lists retain an invalid length without
97
+ walking their entries.
98
+ - Run all 121 shared rows in Node and the browser bundle with no skips.
99
+ `ml-successor-ok` and `ml-successor-wrong` now use their table
100
+ `expected_limited`: `algorithm_unsupported_on_substrate`, one snapshot, and
101
+ zero custody calls because the browser cannot verify ML-DSA-65 predecessor
102
+ history. Node retains successor success and
103
+ `invalid_input`/`descriptor_chain_invalid`, respectively. Removing the duplicate
104
+ `termination-excluded-context` row
105
+ reduces the exact Ed25519 success count from 13 to 12 in each lane.
106
+ Existing row outcomes and the signer API remain unchanged with this build.
107
+ - Resolve limits, then profile, then algorithm, before taking the key snapshot.
108
+ Absent, `undefined`, and `null` algorithms select Ed25519. Explicit values are
109
+ `Ed25519` and `ML-DSA-65`; others return `invalid_input`/`algorithm_unsupported`
110
+ before either callback. The snapshot checks only a non-empty string kid and
111
+ a string public key; the verifier checks key encoding and shape.
112
+ - Keep version 0.3.0 and the workshop badge. Builds remove stale library output;
113
+ CI typechecks and builds the workshop on Linux with Node 24.8.0 and Node 24.
114
+ - SECURITY.md uses GitHub private vulnerability reporting. Evidence descriptions
115
+ name the checks that run; this signer has no telemetry.
116
+ - See the [profile scope](README.md#profile-scope) for the shared ruling.
117
+
118
+ ### Migration from CAP 0.4 to 0.5
119
+
120
+ - Revisions must name two distinct parties from different descriptor histories.
121
+ Replace fixtures that use one descriptor for both roles with two real parties.
122
+ Chain views supply explicit `revisions`, `acceptances`, `descriptors`, and
123
+ `terminations` arrays, including empty lists.
124
+
125
+ ### Migration from verifier 0.5 to 0.6
126
+
127
+ - Producer build failures surface as `invalid_input`/`signing_input_invalid`.
128
+ Termination claims omit `extensions` and other extra members.
129
+ - Digests are canonical base64url SHA-256 values and revision JSON is canonical.
130
+ Descriptor keys use canonical encodings with the selected algorithm's byte
131
+ length. Mixed party histories and unknown claims reject.
132
+ - Direct verifier callers pass retained signed `lineage` in predecessor facts
133
+ to `verifyDescriptor`; `{ digest, claims }` alone is insufficient. Genesis
134
+ calls omit the predecessor. This signer exposes that predecessor in options.
135
+ - Profiles and limits can reject context as well as the new artifact.
136
+
137
+ ## [0.2.2] — October 6, 2026
138
+
139
+ ### Changed
140
+
141
+ - Update the build compiler from TypeScript 5.9.3 to 7.0.2 (`^7.0.2`),
142
+ removing the `~5.9.0` pin; update `@types/node` to 26.6.4 (`^26.6.4`).
143
+ - Reconcile README and workshop documentation with verifier 0.5.0 and signer
144
+ 0.2.2. Make the Node quickstart executable, document development and trusted
145
+ publisher staging, and clarify the workshop's chain/receipt verification,
146
+ artifact kinds, refusal ordering, and Node-only ML-DSA support.
147
+ - Observed on October 6, 2026: `npm ci`, `typecheck`, all 18 tests, `build`,
148
+ `typecheck:web`, `build:site`, and `npm pack --dry-run` pass.
149
+ `diff -ru` against the TypeScript 5.9.3 baseline reports no differences:
150
+ all four emitted JavaScript and declaration files are byte-identical.
151
+ `npm outdated --json` returns `{}`.
152
+
6
153
  ## [0.2.1] — 2026-09-24
7
154
 
8
155
  Dependency-line release: this package now tracks the published verify
@@ -11,9 +158,8 @@ No API change: verifier 0.5.0 added consumer-side surface only (the
11
158
  capability probe, the signature registry identity, the descriptor
12
159
  timestamp floor, the 104-case corpus); the producer surface this package
13
160
  delegates to is unchanged. Typecheck strict, 18/18 tests against the
14
- resolved 0.5.0. The producer-side capability alignment (mirrored
15
- `capabilities()` with refuse-before-mint, declared minting metadata,
16
- profile-bound signing) is the next feature release on this line.
161
+ resolved 0.5.0. Corrected in 0.3.0: 0.2.2 did not add signer capability metadata,
162
+ profile options, or telemetry.
17
163
 
18
164
  ## [0.2.0] — 2026-09-17
19
165
 
@@ -0,0 +1,87 @@
1
+ <!-- Adapted from the Contributor Covenant version 2.1 (https://www.contributor-covenant.org),
2
+ the canonical text with the reporting contact substituted for this repository. -->
3
+
4
+ # Contributor Covenant Code of Conduct
5
+
6
+ ## Our Pledge
7
+
8
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
9
+
10
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment for our community include:
15
+
16
+ * Demonstrating empathy and kindness toward other people
17
+ * Being respectful of differing opinions, viewpoints, and experiences
18
+ * Giving and gracefully accepting constructive feedback
19
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
20
+ * Focusing on what is best not just for us as individuals, but for the overall community
21
+
22
+ Examples of unacceptable behavior include:
23
+
24
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
25
+ * Trolling, insulting or derogatory comments, and personal or political attacks
26
+ * Public or private harassment
27
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
28
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at the repository maintainer PRIVATELY at palermo777@gmail.com — conduct reports are kept
43
+ confidential; please do not open public issues for conduct reports. All complaints will be reviewed and investigated promptly and fairly.
44
+
45
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
46
+
47
+ ## Enforcement Guidelines
48
+
49
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
50
+
51
+ ### 1. Correction
52
+
53
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
54
+
55
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
56
+
57
+ ### 2. Warning
58
+
59
+ **Community Impact**: A violation through a single incident or series of actions.
60
+
61
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
62
+
63
+ ### 3. Temporary Ban
64
+
65
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
66
+
67
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
68
+
69
+ ### 4. Permanent Ban
70
+
71
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
72
+
73
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
74
+
75
+ ## Attribution
76
+
77
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
80
+
81
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
82
+
83
+ [homepage]: https://www.contributor-covenant.org
84
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
85
+ [Mozilla CoC]: https://github.com/mozilla/diversity
86
+ [FAQ]: https://www.contributor-covenant.org/faq
87
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,71 @@
1
+ # Contributing
2
+
3
+ Contributions must preserve the signer's boundaries: the library depends
4
+ only on the public verifier package, key identity comes from one atomic
5
+ snapshot, errors contain no caller values, and test handles do not ship.
6
+ Private keys stay behind the caller's callbacks.
7
+
8
+ ## Toolchain
9
+
10
+ Use Node 24, at least 24.8.0, and npm. `package-lock.json` pins the build
11
+ tools and verifier version. CI runs on Linux with Node 24.8.0 and the current
12
+ Node 24 line.
13
+
14
+ ## Before a pull request
15
+
16
+ Install with the frozen lockfile, then run the local checks:
17
+
18
+ ```console
19
+ npm ci
20
+ npm test
21
+ npm run typecheck
22
+ npm run typecheck:web
23
+ npm run build
24
+ npm run build:site
25
+ npm pack --dry-run
26
+ ```
27
+
28
+ The checks after installation run locally without a network connection.
29
+ The suite builds a browser bundle with the workshop's shims and exercises
30
+ real Ed25519 and ML-DSA-65 keys. The library build writes `dist/`; the site
31
+ build writes `site-dist/`.
32
+
33
+ ## Windows
34
+
35
+ Developer platforms are macOS and Linux. Windows developers use WSL2,
36
+ clone inside its filesystem and follow the Linux commands. CI runs on
37
+ Linux only. Native ML-DSA tests require the supported Node crypto runtime.
38
+
39
+ ## Commits
40
+
41
+ Use explicit paths when staging or committing. Keep tool directories and
42
+ local process state out of commits. Work on `main` in small commits with
43
+ plain messages unless the maintainer asks otherwise. Do not use `git stash`.
44
+
45
+ ## Tests and checks
46
+
47
+ - For behavior changes, write the test, observe it fail for the intended
48
+ reason, then make it pass. Record the observed failure in the commit.
49
+ - New checks must fail under a named temporary mutation. Restore the
50
+ original code and run the suite again before committing.
51
+ - Use real keys and real signing callbacks. Do not use mocks, fake crypto
52
+ or handles that return invented signatures.
53
+ - Search for tests of the old contract before changing behavior.
54
+
55
+ The local suite runs the [shared signer table](test/fixtures/README.md)
56
+ against the TypeScript verifier this checkout installs. It compares recorded
57
+ Elixir outcomes and exact Ed25519 compacts with real seed keys, then checks
58
+ every success through verification. It does not execute Elixir locally.
59
+ Keep the source table byte for byte and report disagreements with both outcomes.
60
+
61
+ ## Protocol dependency changes
62
+
63
+ Move the verifier requirement and lockfile together. Read its changelog,
64
+ test against the published package and document changes to input rules
65
+ or error codes. Keep signing fixtures canonical.
66
+
67
+ ## Docs
68
+
69
+ Update documentation with the behavior it describes. Keep error names,
70
+ supported options, package metadata and the workshop's version badge in
71
+ sync. Describe only checks that run and features that ship.