qrcode

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package qrcode generates a pairing QR code + connection info for the rmoted daemon. The QR encodes a JSON payload understood by compatible clients: {"ip","port","token"}. Scanning it pre-fills the server profile fields (host, port, auth token) — the fastest is the fastest path from "daemon installed" to "client connected".

The token is ALSO printed as plain text so users who can't scan a QR (terminal over SSH, no camera) can copy-paste it. This matches the Mac server's QR + manual-token pairing flow.

CLI entry: `rmoted qrcode`.

Index

Constants

View Source
const LongHelp = `` /* 669-byte string literal not displayed */
View Source
const ShortHelp = "Print a pairing QR code for iOS (host + port + secret)"

usage strings for the CLI help text. Kept here so the qrcode logic + its help description live together.

Variables

This section is empty.

Functions

func Print

func Print(w interface{ Write([]byte) (int, error) }) error

Print renders the QR + connection info to the given writer. Used by the `rmoted qrcode` subcommand. Prints:

  1. The QR code (Unicode half-blocks).
  2. The connection info (IP, port).
  3. The raw token (for manual copy when QR scanning isn't available).

The token is printed in full — the user is already authenticated on the host (they ran the command), and the token is only useful for pairing iOS to THIS daemon. Printing it is the explicit purpose of the command.

func PrintWithHost added in v0.3.0

func PrintWithHost(w interface{ Write([]byte) (int, error) }, host string) error

PrintWithHost renders the QR and connection details using one selected host.

Types

type Payload

type Payload struct {
	IP    string `json:"ip"`
	Port  int    `json:"port"`
	Token string `json:"token"`
}

Payload is the stable pairing JSON shape:

ip    — the host's LAN IP (or Tailscale IP if that's all that's up)
port  — the daemon's listen port (17783)
token — the 64-hex-char bearer from ~/.rmote/agent/secret

func Generate

func Generate() (qr string, payload Payload, err error)

Generate reads the daemon secret + detects the host's primary LAN IP, builds the pairing payload, and renders a terminal QR code. Returns the QR string, the payload (for display), or an error if the secret can't be read or no usable IP is found.

The QR uses Unicode half-block characters (▀▄█) for compactness — fits in ~45 terminal columns. Quiet-zone padding is included by the library.

func GenerateWithHost added in v0.3.0

func GenerateWithHost(override string) (qr string, payload Payload, err error)

GenerateWithHost renders a pairing QR using override when provided. An empty override preserves automatic LAN-IP selection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL