Lightning.Credentials.Resolver (Lightning v2.14.5-pre1)
View SourceProvides credential resolution abstraction for workflow execution.
Handles the complexities of preparing credentials for worker consumption, including OAuth token refresh, credential body merging, and empty value cleanup. Supports regular credentials, OAuth credentials, and future keychain credentials.
Returns a ResolvedCredential containing the final worker-ready body and original credential reference for scrubbing setup.
Summary
Functions
Resolves a credential into a ResolvedCredential ready for worker consumption.
Types
@type error_reason() :: :not_found | Lightning.Credentials.oauth_refresh_error()
@type resolve_error() :: {error_reason(), Lightning.Credentials.Credential.t()}
Functions
@spec resolve_credential(Lightning.Credentials.Credential.t()) :: {:ok, Lightning.Credentials.ResolvedCredential.t()} | {:error, resolve_error()}
@spec resolve_credential(Lightning.Credentials.Credential.t()) :: {:ok, Lightning.Credentials.ResolvedCredential.t()}
Resolves a credential into a ResolvedCredential ready for worker consumption.
Can be called with either:
resolve_credential(credential)
for direct credential resolutionresolve_credential(run, id)
for credential lookup and resolution
For regular credentials, returns the body as-is. For OAuth credentials, refreshes tokens if needed and merges into body.
@spec resolve_credential(Lightning.Run.t(), credential_id :: String.t()) :: {:ok, Lightning.Credentials.ResolvedCredential.t() | nil} | {:error, :not_found | resolve_error()}