Lightning.Credentials.Resolver (Lightning v2.14.5-pre1)

View Source

Provides 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

error_reason()

@type error_reason() :: :not_found | Lightning.Credentials.oauth_refresh_error()

resolve_error()

@type resolve_error() :: {error_reason(), Lightning.Credentials.Credential.t()}

Functions

resolve_credential(credential)

Resolves a credential into a ResolvedCredential ready for worker consumption.

Can be called with either:

  • resolve_credential(credential) for direct credential resolution
  • resolve_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.

resolve_credential(run, id)

@spec resolve_credential(Lightning.Run.t(), credential_id :: String.t()) ::
  {:ok, Lightning.Credentials.ResolvedCredential.t() | nil}
  | {:error, :not_found | resolve_error()}