Skip to main content

Module auth

Module auth 

Source
Expand description

Tempo wallet device-code authorization flow.

Implements the CLI side of the tempoxyz/accounts cli-auth device-code protocol: generates a local secp256k1 access key, creates a PKCE-protected device code, opens wallet.tempo.xyz/cli-auth?code=<CODE> in the browser, polls until the user authorizes the key on their passkey wallet, and writes the resulting keyAuthorization to ~/.tempo/wallet/keys.toml.

StructsΒ§

AccessKeyOutcome
Result of ensure_access_key.
CreateCodeRequest πŸ”’
CreateCodeResponse πŸ”’
EnsureAccessKeyConfig
Configuration for ensure_access_key.
PollRequest πŸ”’

EnumsΒ§

PollResponse πŸ”’
Matches tempoxyz/wallet poll response shape.

ConstantsΒ§

DEFAULT_CLI_AUTH_URL πŸ”’
Default device-code service URL (production wallet.tempo.xyz).
DEFAULT_POLL_INTERVAL πŸ”’
DEFAULT_TIMEOUT πŸ”’
TEMPO_CLI_AUTH_URL_ENV πŸ”’
Env var to override the device-code service URL (for tests / staging).

StaticsΒ§

AUTH_LOCK πŸ”’
Per-process serialization of concurrent ensure_access_key calls.

FunctionsΒ§

create_code_with_retry πŸ”’
POST /code with exponential backoff on transient errors, bounded by timeout.
ensure_access_key
Run the device-code flow, persist the resulting key to keys.toml, and return the new entry’s identifying fields.
is_known_tempo_endpoint πŸ”’
Returns true if url’s host is tempo.xyz or a subdomain of it.
is_transient_error πŸ”’
is_transient_status πŸ”’
open_browser πŸ”’
Open url via the OS default browser handler. On platforms without a known opener, this is a no-op (the URL is still printed by ensure_access_key).
random_code_verifier πŸ”’
serialize_u64_hex πŸ”’
sha256_b64url πŸ”’