Skip to content

feat(tsp-js): merged-spec (AAC) vectors, re-packed byte for byte - #252

Merged
stormer78 merged 2 commits into
feat/tsp-rev2-rev3-dual-handlerfrom
test/tsp-js-aac-vectors-deterministic
Sep 16, 2026
Merged

stormer78 merged 2 commits into
feat/tsp-rev2-rev3-dual-handlerfrom
test/tsp-js-aac-vectors-deterministic

Conversation

@stormer78

Copy link
Copy Markdown
Contributor

This PR targets feat/tsp-rev2-rev3-dual-handler, like #249, #250 and #251.

1. Vectors move to the merged spec. tests/fixtures/spec-rev3-vectors.json held the pre-merge YTSP-ABA vectors. It now holds the Appendix A vectors from trustoverip/tswg-tsp-specification@f5b8668 (YTSP-AAC), which changed every message and the control-message digests.

  • Tests that hard-coded ABA are updated.
  • A new test pins one old ABA message, so reading Rev 3 at MINOR 64 stays covered.
  • Library behaviour is unchanged.

2. Byte-exact re-pack. tsp-js could open the vectors but not reproduce them, so an encoder bug that two implementations share went undetected. A new subpath, @openvtc/vti-tsp-js/unsafe-testing, exports __unsafeDeterministic* packers.

  • They derive the HPKE ephemeral from the vector's published ikmE (RFC 9180 DeriveKeyPair).
  • They can write the NULL ESSR sender, which every published vector uses.
  • The root entry point is unchanged and exposes none of this. The module header explains why a fixed ephemeral breaks confidentiality and integrity.

Reviewer decision: the subpath is listed in package.json exports, so it ships in the published package, clearly named. If you'd rather it not ship at all, the alternative is a test-only import from dist/.

Results:

  • All six HPKE-Base vectors now re-pack byte for byte: direct-hpke-base, control-rfi-direct, control-rfa-direct, control-rfd, nested-direct, routed.
  • direct-sealed-box, control-rfi-sealed-box and direct-signed-only aren't covered, because tsp-js has no packer for those schemes.
  • direct-hpke-base-pq publishes no ephemeral material.

Tests:

  • tsp-js npm test: 124 pass.
  • core tests/tsp.*.mjs: 33 pass.
  • With the matching conformance-driver change, the suite's pack-exact cases pass for tsp-js on the same six vectors.

The merged specification (trustoverip/tswg-tsp-specification f5b8668) moved the vectors to YTSP-AAC, changing every message and the control vectors' SAID digests. Replace the pre-merge YTSP-ABA fixture, fix the tests that asserted MINOR 64, and pin one pre-merge ABA message so reading it stays covered. Comment and changelog text only; library behaviour is unchanged.

Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
Add a test-only ./unsafe-testing subpath whose __unsafeDeterministicPack* functions derive the HPKE-Base ephemeral from a caller-fixed ikmE (RFC 9180 DeriveKeyPair) and can write the NULL VID in the ESSR sender field. The main entry point's packers are unchanged and never forward either knob; a fixed ephemeral key breaks confidentiality, and the subpath exists only to reproduce published vectors.

All six HPKE-Base vectors (direct-hpke-base, control-rfi-direct, control-rfa-direct, control-rfd, nested-direct, routed) now re-pack byte for byte, with every input derived from the vector's printed payload. The sealed-box, signed-only and post-quantum vectors are named with the reason they cannot be.

Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
@stormer78
stormer78 merged commit 435893e into feat/tsp-rev2-rev3-dual-handler Sep 16, 2026
4 checks passed
@stormer78
stormer78 deleted the test/tsp-js-aac-vectors-deterministic branch September 16, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant