hackagent.core.credentials
Resolve the single api_key input and serialize only safe references.
CredentialError Objects
class CredentialError(ValueError)
A selected credential is empty, missing or invalid.
resolve_api_key
def resolve_api_key(api_key: Optional[str] = None,
*,
use_default: bool = False,
required: bool = False,
purpose: str = "API key",
env: Optional[Mapping[str, str]] = None) -> Optional[str]
Resolve a value or explicit ${VARIABLE}; never guess variable names.
Only platform connections opt into the HACKAGENT_API_KEY default. A selected reference or explicit empty value never falls back elsewhere.
credential_reference
def credential_reference(api_key: Optional[str]) -> Optional[str]
Return only the original reference; a runtime value is never exported.
validate_file_credentials
def validate_file_credentials(value: Any) -> None
Validate file references without resolving sources a caller may override.
prepare_credentials
def prepare_credentials(value: Any,
*,
from_file: bool = False,
env: Optional[Mapping[str, str]] = None) -> Any
Copy input data, rejecting file secrets before validation can echo them.
is_gateway_endpoint
def is_gateway_endpoint(endpoint: Optional[str], base_url: str) -> bool
Match the exact configured gateway origin and path, excluding lookalikes.