Console

Pair through a relay

Reach a daemon on another machine through Viewport Relay. The relay routes ciphertext only.

The daemon registers its hub on a relay. Console connects to the hub, and the two run the same encrypted channel they would run over Direct. The relay sees hub ids, sizes and timing, never the session protocol.

On the daemon's machine:

viewport-daemon up --relay wss://relay.example.com --relay-token-file ~/.viewport/daemon/relay-token
viewport-daemon pair --role controller --relay wss://relay.example.com --console https://console.example.com
#  prints a link; open it where Console is signed in, or paste it into `viewport-console pair "<link>"`

--role controller lets Console start and steer sessions and answer approvals. A link made without a role pairs Console as a viewer, which can only watch.

The same flow in one process: an in-process relay, a daemon registered on it, and Console redeeming the link.

examples/ts/pair-through-relay/main.ts
const relay = await createTestRelay(); // open, loopback; a real relay asks for tokens
const supervisor = createTestSupervisor({ runners: [fakeRunner("agent", [say("over the relay"), exit(0)])] });
const hub = await connectRelay(supervisor, { url: relay.url, serve: { name: "build-box" } });
const offer = await hub.server.pair({ role: "controller", relayUrl: relay.url }); // what `viewport-daemon pair --role controller --relay` prints
examples/ts/pair-through-relay/main.ts
const preview = await app.daemons.preview(offer.link); // parsed locally, no network
console.log("Name (from the link, unverified) ", preview.name);
console.log("Daemon fingerprint               ", preview.daemon_fingerprint.join(" "));
console.log("This Console                     ", preview.console_fingerprint.join(" "));
console.log("Reach it via                     ", preview.targets.relay);
examples/ts/pair-through-relay/main.ts
const paired = await app.daemons.pair(offer.link);
console.log("Paired over the", app.services.hub.state(paired.daemon.daemon_id));

Relay tokens

  • A daemon presents its own relay token to register its hub.
  • Viewers reach the hub with a viewer token. It goes into the link as t only when the daemon is given one (--relay-viewer-token-file) or shares its token (--relay-shared-token). Console stores t sealed and uses it only for the relay.
  • On an open relay (loopback, as in the example) the link has no t and Console stores no relay secret.
  • A relay token grants use of the relay, never access to the daemon: the daemon still checks Console's key.

On this page