Skip to content

feat: App Connect v2 protocol module and vendor sync tool - #5

Merged
PastaPastaPasta merged 5 commits into
mainfrom
feat/app-connect-module
Oct 26, 2026
Merged

PastaPastaPasta merged 5 commits into
mainfrom
feat/app-connect-module

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Summary

Makes this repo the canonical source for the App Connect v2 protocol core and adds a tool for apps to keep in-repo (vendored) copies of shared modules.

  • src/app-connect/: the App Connect v2 protocol core (request TLV encoding and dash-key: URIs, payload crypto, response poller, candidate verifier, session and signing-key selection, Platform error classification, contract-group trust). It is upstreamed from Yappr's vendor/platform-auth copy (staging c762777b), which is also what EvoVote v2 copied by hand.
    • It no longer depends on the rest of the package. The six helpers it borrowed from key-exchange/yappr-protocol now live in app-connect/primitives.ts with neutral names (AppConnectNetworkName, APP_CONNECT_NETWORK_IDS, deriveSharedSecret, getPublicKey, decodeIdentityId). It has an internal base58 implementation, so it doesn't import bs58.
    • Its only external dependencies are @noble/hashes and @noble/secp256k1.
    • It is exported from the root and from the ./app-connect subpath.
  • docs/APP_CONNECT_PROFILE.md moved here from Yappr. The vector test checks that the JSON embedded in the doc matches vectors.json, and skips that check in vendored copies that don't carry the doc.
  • noUncheckedIndexedAccess is now on repo-wide, so consumers that build with it (Forge) can typecheck vendored code. The guards don't change behaviour, and the vectors still match byte for byte.
  • deriveYapprSharedSecret gains an optional info parameter and zeroes its buffers. Existing callers are unaffected.
  • tools/vendor.mjs copies src/<module>/ from a git ref into an app's directory and writes a deterministic VENDORED.json manifest (upstream commit and per-file sha256). It checks that imports stay inside the vendored module set and records external packages.
    • status reports local edits and upstream changes.
    • Divergence is allowed: it is reported, never blocked.
    • The CLI and the policy are documented in docs/vendoring.md.

Why

Yappr, EvoVote and govhub each had their own copy of the login code, and Forge was about to make a fourth. Security fixes were landing in only one copy. With this PR the shared code has one upstream, each app still owns its own copy, and vendor.mjs status shows how far a copy has drifted.

First consumer: dash-forge feat/app-connect-login, which vendors app-connect from commit a627708. Please merge with a merge commit (not squash), so the commit recorded in that manifest stays reachable from main.

Open question for review

errors.ts marks Platform code 40208 (IdentityPublicKeyIsDisabledError) as paid: true. Forge's write path treats every key-limit refusal as unpaid. Drive raises 40208 in identity_key_limits_update state validation (and the payout path), so this needs a check against Drive's fee handling for that transition. The mapping is unchanged from Yappr in this PR.

Test plan

  • npm run lint
  • npm test: 17 vitest files, 356 tests, plus 18 node --test tool tests
  • npm run build
  • Smoke test: vendored app-connect into a scratch directory (--from WORKTREE). Its externals are noble only, and its own tests pass there (108 passed, 1 skipped: the doc check)
  • Forge vendors it and its full suite passes

🤖 Generated with Claude Code

PastaPastaPasta and others added 5 commits October 24, 2026 21:12
Add explicit guards where indexed access is provably in bounds; no
behaviour change. Needed so the App Connect module (and apps that vendor
it under this flag) type-check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Headless request codec, response encryption, candidate polling,
verifier, session records and error mapping, with test vectors and the
wire profile. Depends only on @noble/hashes and @noble/secp256k1:
primitives.ts holds the six helpers plus a small base58 codec, so the
module can be vendored on its own. Exposed from the package root and as
the ./app-connect subpath.

deriveYapprSharedSecret gains an optional HKDF info parameter and zeroes
its intermediate buffers (backward compatible).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
tools/vendor.mjs copies src/<module>/ from a git ref (or the worktree)
into an app repo, checks imports without rewriting them, and records a
deterministic VENDORED.json with per-file sha256 hashes. Local edits block
a plain sync (--keep-local / --force override); `status` reports local and
upstream drift and always exits 0 on divergence. `npm test` now also runs
the node:test suite for the tool.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove before write (case-only renames, file/dir swaps), refuse paths
through symlinks and validate every path before the first write, scan
imports with a comment/string-aware scanner (multi-line imports with
trailing comments, vi.mock, template imports), validate manifest commit
and hash formats with prototype-safe maps, and read package.json before
writing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d035df8a-9c03-4661-ad5b-fd9f63aaf6eb
Commits

Reviewing files that changed from the base of the PR and between 18b3c51 and a627708.

Files ignored due to path filters: 1
  • src/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
Files selected for processing: 38
  • README.md
  • docs/APP_CONNECT_PROFILE.md
  • docs/vendoring.md
  • package.json
  • src/__fixtures__/webauthn.ts
  • src/app-connect/crypto.test.ts
  • src/app-connect/crypto.ts
  • src/app-connect/errors.test.ts
  • src/app-connect/errors.ts
  • src/app-connect/group.ts
  • src/app-connect/index.ts
  • src/app-connect/poller.test.ts
  • src/app-connect/poller.ts
  • src/app-connect/primitives.test.ts
  • src/app-connect/primitives.ts
  • src/app-connect/request.test.ts
  • src/app-connect/request.ts
  • src/app-connect/session.test.ts
  • src/app-connect/session.ts
  • src/app-connect/test-helpers.ts
  • src/app-connect/types.ts
  • src/app-connect/vectors.json
  • src/app-connect/vectors.test.ts
  • src/app-connect/verify.test.ts
  • src/app-connect/verify.ts
  • src/browser/passkey-prf.test.ts
  • src/browser/passkey-prf.ts
  • src/browser/secret-store.ts
  • src/core/controller.test.ts
  • src/index.test.ts
  • src/index.ts
  • src/key-exchange/yappr-hooks.test.tsx
  • src/key-exchange/yappr-protocol.test.ts
  • src/key-exchange/yappr-protocol.ts
  • tools/vendor.mjs
  • tools/vendor.test.mjs
  • tsconfig.json
  • tsup.config.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta
PastaPastaPasta merged commit c787874 into main Oct 26, 2026
2 checks passed
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