Skip to main content

Module ui_deeplink

Module ui_deeplink 

Source
Expand description

Deep-link dispatch for red ui <uri> (ADR 0051, issue #1046, PRD #1041).

The default red ui <uri> (no --server) prefers the installed desktop app via the redui:// URL scheme and falls back to the served browser bridge (super::ui_bridge) when no handler is registered. This module owns the decision, the canonicalised deep-link string, and the OS handoff — all behind a DeepLinkEnv seam so both branches (handoff vs fallback) and the deep-link URL are unit-testable without touching the OS.

The dispatched redui://?connect=<canonical-uri> URL carries the target only — never a credential. Auth handoff is a separate slice (ADR 0051: the token crosses via a local secret channel, never the deep-link URL).

Structs§

OsDeepLinkEnv
The production DeepLinkEnv: probes the OS for the redui:// handler and opens URLs via the platform default handler.

Enums§

DispatchMode
Which dispatch path red ui should take, before consulting the OS.
DispatchOutcome
What the caller (red ui) should do once dispatch has run.

Traits§

DeepLinkEnv
The OS-touching seam dispatch runs over: probing whether the redui:// handler is registered, and opening a URL with the platform handler. Both branches of dispatch are driven through this trait so tests assert the decision and the emitted deep-link string without any OS state.

Functions§

build_deep_link
Build the redui://?connect=<canonical-uri> deep link (ADR 0051). The canonical URI is percent-encoded so query-breaking characters (spaces, &, ?, #, …) survive, while the readable URI shape (file:///…, red://…) is preserved. The link carries the target only — never a token.
build_deep_link_with_handoff
Build a deep link that also tells the desktop app where to fetch the held credential from (issue #1048). The handoff query value is the loopback handoff URLhttp://127.0.0.1:<port>/handoff/<nonce> — which carries the single-use nonce, never the secret. The desktop app fetches the token from there over the local secret channel; nothing sensitive rides the deep link, so the token never lands in ps, shell history, or URL logs.
canonicalize_target_uri
Canonicalise a red ui target URI for embedding in the deep link.
dispatch
Decide-and-dispatch. Pure decision logic over the DeepLinkEnv seam: