Skip to main content

Module key_validator

Module key_validator 

Source
Expand description

Live API-key validation for Connectors → Accounts.

Each supported service has a probe that makes a single minimal authenticated request and maps the response to non-secret metadata (account name, scopes, etc.). This is the only outbound call the key flow makes, and it fires only on the user’s explicit Validate click (see docs/specs/archive/SPEC_TRUST_CENTER_2026_06_15.md §5.1, §6).

The plaintext key is passed in by value, used to build one request, and never logged. Callers must keep it out of logs/transcripts.

Structs§

ValidationOutcome
Outcome of a validation probe. metadata is non-secret JSON safe to persist on the account row + show in the UI; masked_tail is the last few chars for the locked display.

Constants§

GOOGLE_USERINFO_URL
Google’s OpenID Connect userinfo endpoint: answers for any access token that carries the openid scope, with the account’s email.

Functions§

masked_tail
Masked hint for the locked display: bullet run + last 4 chars. Stored alongside the account so the panel can render ••••••••3f9a without the secret. Keys shorter than 4 chars are fully masked (no tail leak).
validate
Validate key for provider. Makes one outbound HTTPS request. Returns a non-valid outcome (never errors the RPC) so the caller can surface a structured message and stay in the entry state. A stored OAuth token blob is validated by its access token (oauth_tokens::bearer_value); an expired one should be refreshed first (oauth_tokens::access_token_for).