Skip to content

v4: pair relay devices with one-time QR tokens - #50

Merged
Phloraxx merged 1 commit into
mainfrom
v4/qr-device-pairing
Sep 1, 2026
Merged

v4: pair relay devices with one-time QR tokens#50
Phloraxx merged 1 commit into
mainfrom
v4/qr-device-pairing

Conversation

@Phloraxx

@Phloraxx Phloraxx commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Scope

Eighth stacked PayGate v4 implementation slice. Depends on PR #49.

Implements

  • authenticated server-side creation primitive for short-lived one-time pairing sessions
  • cryptographically random 256-bit URL-safe pairing token; only SHA-256 token hash is stored
  • default 2-minute TTL and single-use atomic consumption
  • explicit replaceExisting intent for the one-active-relay-device model
  • refuses silent replacement of an already-active phone
  • replacement atomically disables the previous device before enabling the new one
  • derives device ID from SHA-256 of P-256 SubjectPublicKeyInfo DER
  • reuses existing P-256 ECDSA request-signing model; server stores public key only
  • preserves device metadata and exposes active-device/revoke primitives
  • older unconsumed pairing sessions are invalidated when a new pairing session is created
  • no admin password, permanent relay secret, or matching state is encoded in the pairing token

Tests

Focused tests cover one-time use, expiry, invalid token, active-device refusal, explicit replacement, same-key re-enrollment, P-256 validation, token entropy/length, active-device lookup and revoke behavior. Full internal/v4/... unit tests, race tests, vet and diff checks pass locally.

Safety

Still no production HTTP route registration or Android rollout. This is an isolated service layer for the future QR/App-Link pairing UX.

@Phloraxx
Phloraxx changed the base branch from v4/signed-relay-ingestion to main September 1, 2026 05:29
@Phloraxx
Phloraxx marked this pull request as ready for review September 1, 2026 05:49
@Phloraxx
Phloraxx merged commit 0b96e1f into main Sep 1, 2026
1 check 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