Skip to main content

Module private

Module private 

Source
Expand description

lockdocs Pro “private sources”: read packages and docs from the private registries and git hosts the user has already configured, with the user’s own credentials, each sent only to the host it belongs to.

Nothing here decides whether the caller may use Pro: the binary checks the licence and sets Options::private. This module only knows two things: how to find the user’s existing configuration (.npmrc, uv/pip config, .cargo/config.toml, GOPROXY, ~/.netrc, token variables, git credential fill), and how to keep a credential on its own host:

  • a Credential carries the exact origin (scheme, host, port) it was configured for, and Creds::for_url returns it only for that origin;
  • Http follows redirects itself, one hop at a time, and asks Creds again for every hop, so a redirect to another host loses the header;
  • Auth and Credential print as ***, and every error that reaches the user passes through Creds::redact.

Modules§

cargo
Cargo alternate registries (sparse protocol), from .cargo/config.toml, $CARGO_HOME/credentials.toml, CARGO_REGISTRIES_<NAME>_* variables, the registry Cargo.lock recorded per package and the registry = "name" key of Cargo.toml dependencies.
git
Git hosts (GitHub, GitHub Enterprise, GitLab, Bitbucket, any https git host): where a repository’s archive lives, and the credential for exactly that host: a token variable, else what git credential fill returns.
go
Go private modules: GOPROXY, GOPRIVATE, GONOPROXY, GONOSUMDB (from the environment or the go env file) and ~/.netrc. A module a private proxy serves is read from that proxy; a private module without one is read straight from its git host at the version’s tag, like go does.
npm
npm private registries, from the user’s own .npmrc files and NPM_CONFIG_* variables, and from package-lock.json’s recorded URLs.
pypi
Python private indexes, from uv (uv.toml, [[tool.uv.index]], UV_INDEX_*), pip (PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, pip.conf), credentials in the URL, UV_INDEX_<NAME>_USERNAME/_PASSWORD or ~/.netrc, and the index uv.lock recorded per package.

Structs§

Candidate
One place a package may be read from.
Credential
A secret bound to one origin (and optionally a path prefix on it).
Creds
The credentials in play for one operation.
Env
The process environment, or a fixed one for tests.
Http
Origin
Scheme, host and port: the unit a credential is bound to.
Plan
PrivateRequired
A request needed a private source and the licence does not cover it.
Reply
Url
A parsed http(s) URL. Only what credential binding needs.

Enums§

Auth
How a secret is presented. Prints as ***.
Outcome
How a private download ended.

Constants§

FEATURE
The feature name a Pro-less call reports in the pro_required answer.

Functions§

fetch_into
Run the plan: private candidates first (when allowed), then hand over to the public path. Without allowed, a definitively private package fails at once with PrivateRequired, without any network.
needs_private
Does reading dep need a private source for sure (no network)?
netrc_for
The netrc credential for url’s host, bound to that URL’s origin.
parse_netrc
machine HOST login L password P entries (and default) of a netrc file.
plan
Where dep would be read from, per the user’s own configuration and lockfiles.
strip_userinfo
https://user:pw@host/x becomes https://***@host/x.