Boost: build the pairing core in a new packages/boost

Open
#63 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
react-native, typescript

Research direction

Start with the pairing design in blocked issue #53; it must be accepted before this work can proceed, and the issue says the QR fields and code test vectors come from that design. Then read the layouts of other packages, packages/core/src/schema.ts, packages/core/src/erase.ts, and the named schema test. Done means tests cover each listed behavior, the migration applies forward, and the listed gates pass.

Written by the indexing model from the issue text.

Description

agent-friendly help wanted privacy

Why

Both sides of pairing (US-BOOST-01, FR-MOVE-01) need the same rules: the QR payload, the 6-digit code from the handshake, a flow that fails closed, and a record of paired devices (ENT-PairedDevice). Written once in a pure package, they're tested on Node and shared by the phone, the desktop app and, later, changing phones (EP-13).

What to do

Create packages/boost (new), or the name the pairing design picked: pure TypeScript, no network and no React Native, depending on @hermit/core. Lint already refuses fetch, XMLHttpRequest and WebSocket under packages/ (eslint.config.js). Follow the other packages' layout: package.json, tsconfig.json, src/, test/, vitest.

Tests first, in packages/boost/test/:

  1. The QR payload. Encode and decode the fields the design fixed, with a version. Refuse unknown versions, missing fields and payloads too big for the QR.
  2. The 6-digit code. Derive it from a handshake hash exactly as the design says, and pass the design's test vectors, with leading zeros kept.
  3. The flow. A small state machine: waiting, connected, codes shown, confirmed, failed. A mismatch, a cancel, a timeout or a second connection ends in failed. Paired needs both confirmations.
  4. Paired devices. A store over SqlPort for paired_devices (id, kind, public key, paired at), with a new forward-only migration in packages/core/src/schema.ts that takes the next free id. Make sure Delete everything removes it (packages/core/src/erase.ts).
  5. Signed log events, if the design records pairing: the new event in packages/cage/src/audit.ts, with a hash of the device key and never a name or an address.

The transport stays out. The core takes a handshake hash and bytes, and returns decisions. The adapters on each side bring the network.

Done when

  • pnpm --filter @hermit/boost test passes, with a test for each point above, written before the code.
  • The migration applies forward from the current schema, as packages/core/test/schema.test.ts checks.
  • The gates pass.

How to check

pnpm --filter @hermit/boost test
pnpm --filter @hermit/core test
pnpm check:privacy && pnpm typecheck && pnpm lint && pnpm test
node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt

Depends on

  • Blocked by the design in #53.

Keep in mind

  • Keys never leave the phone. The store keeps public keys only; private keys stay in the platform's secure store, in the adapters.
  • Pin new dependencies exactly. The packages already use @noble/curves and @noble/hashes.
  • Test keys and vectors are generated in the test or taken from the design. Never a real key.
  • The multi-bot work adds migrations too. Rebase, and take the next free id.
  • A change in packages/cage gets a maintainer's review (CODEOWNERS).
  • Open a pull request only once everything under Depends on is accepted or merged, and a maintainer has said so here (AGENTS.md: code for a feature without an accepted issue may be closed).
Dominant language
TypeScript
Stars
11
Forks
0
Avg merge
10m
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DojoCodingLabs/hermit

All issues in DojoCodingLabs/hermit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.