Skip to content

Nearby link: ask for more time and suggest limits over Wi-Fi, with no server #45

Description

@jsconu

A local build has no way for a kid's phone to ask a parent's phone for anything — the "Suggest a change" and "more time" flows only exist in the cloud build. For the case that actually matters, both phones at home on the same Wi-Fi, they don't need a server to talk.

Design

A nearby link: a 32-byte key the two phones agree in person, and messages sealed under it.

  • Pairing — the parent's phone shows a QR carrying a fresh key; the kid's phone scans it once. A QR code is a private channel between two phones held by the same person in the same room, and it's the same shape of secret an end-to-end-encrypted cloud would need later.
  • Messages — MoreTimeRequest, LimitSuggestion, Answer. Deliberately tiny: no usage data crosses the link, only a request and its answer.
  • Envelope — AES-GCM under the link key. Anyone else on the Wi-Fi can reach the same port, so a message that's tampered with or sent without the key must not open at all.
  • Replay — ids are claimed once. Sealing proves who wrote a message, not when; without this, a captured "grant 15 minutes" could be replayed every evening.
  • Discovery — mDNS/NSD, advertising a name derived from a hash of the key, so only the linked phone can find it and nobody can tell whose is whose.

What it cannot do, and must say so on screen

  • Both phones must be on the same network — mobile data on one breaks it
  • Guest Wi-Fi that isolates clients will never work, and nothing in an app can fix that
  • The parent's phone must be awake and listening, so a request is kept and retried, never shown as delivered
  • It does nothing when the kid is at school — that's what the cloud build is for

Done

The transport-independent layer, in :shared under nearby/, with 12 unit tests covering round trip, wrong key, a flipped bit, truncation, version skew, nonce freshness, replay and the QR payload. The Wi-Fi transport (LanNearbyTransport) is written but has not run on hardware.

Left to build

  • QR display screen in the parent app, and camera scanning in the kid app (ZXing core — not a Play Services dependency)
  • A queue on the kid phone: hold a request, retry, and never imply an answer is coming
  • Listening on the parent phone, tied to its existing foreground service
  • Approve/decline UI and a notification on the parent phone
  • Applying an Answer to the local profile
  • Manifest permissions and the first-run explanation of what this does and doesn't reach
  • Verification on two physical phones, including a network with client isolation
  • Bluetooth LE behind the same NearbyTransport interface

Design notes are in the KDoc of each file, and the wider context is in docs/LOCAL_AND_CLOUD.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions