Skip to main content

resolve_urls

Function resolve_urls 

Source
fn resolve_urls(url: &Url, config: Option<&ConfigFile>) -> (String, String)
Expand description

Resolve the API and identity base URLs to talk to for a given Send link.

Both are needed: the send-access token is minted at {identity}/connect/token and the send itself is read from {api}. Precedence:

  1. A known Bitwarden cloud host (exact match — see CLOUD_HOSTS).
  2. The locally configured deployment (bw config server) when the link’s origin matches it — explicit api/identity overrides win, otherwise the base is suffixed.
  3. Otherwise <origin>/api + <origin>/identity, the single-domain self-host convention and the legacy CLI’s final fallback.

Pure so the precedence can be unit-tested without a client or a config file on disk.