Skip to main content

Module credentials

Module credentials 

Source
Expand description

The on-disk credential (~/.config/tracevault/credentials.json) and the two kinds of authentication the CLI supports.

There are exactly two, and they are not interchangeable:

  • tvk_ API key — what automation and CI use, forever. Never expires, never refreshes, comes from TRACEVAULT_API_KEY, a project config.toml, or the token field of this file.
  • Keycloak session — what a human gets from tracevault login (RFC 8628 device flow). Short-lived access token plus an offline_access refresh token, stored under the auth object, and refreshed transparently so unattended git hooks never prompt.

The file shape is additive: a pre-Keycloak file ({"server_url","token","email"}, possibly still carrying a pre single-tenant org_slug) keeps working untouched.

Structs§

Credentials
credentials.json.
KeycloakSession
A live Keycloak session for the human who ran tracevault login.

Enums§

Credential
How a request authenticates itself.

Constants§

REFRESH_WINDOW_SECS
How long before expiry an access token is proactively refreshed. Sized to comfortably cover a slow request that is issued just under the wire: a token that would expire mid-flight is refreshed first instead.

Functions§

resolve_credentials
Resolve server URL and credential from multiple sources. Priority: env var > credentials file > project config.toml Returns (server_url, credential).
resolve_credentials_quiet
resolve_credentials without the config-conflict warning.
same_server
Whether two TraceVault base URLs identify the same instance.