Skip to content

feat(cloud): P0C1 atomic QR pairing and D1 tenant admission policy - #4

Draft
Nardo021 wants to merge 10 commits into
feature/mote-cloud-p0b-auth-20261116from
feature/mote-cloud-p0c-pairing-20261116
Draft

Nardo021 wants to merge 10 commits into
feature/mote-cloud-p0b-auth-20261116from
feature/mote-cloud-p0c-pairing-20261116

Conversation

@Nardo021

@Nardo021 Nardo021 commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

P0C1 PARTIAL — Stacked Draft PR, base: feature/mote-cloud-p0b-auth-20261116 (PR #3), which builds on P0A #2. No production deployment or merge.

Verified source scope

  • cloud/migrations/0003_pairing_claim.sql uses a single atomic SQLite UPDATE+trigger: valid QR approval inserts exactly one account-owned device; duplicate credential constraints fail/roll back. This is validated in local Node SQLite, not yet real Cloudflare D1.
  • CloudPairingRepository: random 256-bit one-use claim, hashed secrets, 5-minute expiry, 6-digit on-screen confirmation, separate desktop polling proof.
  • Cloud Staging only: QR create, account-authenticated preview/approve, proof-authenticated desktop status. Existing self-host Relay untouched.
  • tenantAdmission.ts: server-side D1 account/device/credential checks for future WSS; only a nonforgeable verified admission yields tenant routing key. Actual DO WSS and dispatch not implemented.
  • Offline integration tests cover QR success, two-account race, replay, expiry, secret/credential collision rollback, unauthorized access, device/account revocation, forged routing admission.

CI evidence

GitHub Actions CI #32 (all nine jobs SUCCESS), head 90c78979d96224728369408bc8e1ad6badcbdf8c. Relay tests, typecheck, staged Worker dry-run, repository, macOS/Windows/E2E and unsigned Windows release test artifact checks passed. Previous CI #29 had two test-fixture/status assertion failures, corrected. #32 verifies source and tests only, not real iOS/Apple/D1/WebSocket.

Blocked

No live Cloudflare staging D1 migration, Apple real identity test, per-account DO WSS, real remote command/lock, native iOS, signed public binaries, public rate limits or account deletion. Private test-only staging gate cannot ship in customer clients. Public SaaS remains blocked.

Next

P0C2: separate tenant DO and authenticated Protocol v1 WebSocket, verified phone lock dispatch with 10s TTL, revocation and no-offline-queue E2E; then genuine Cloudflare D1 staging tests. Full operator notes: docs/cloud-p0c1-pairing.md.

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