adk_provider_credential (erlang_adk v0.8.0)

View Source

Credential resolver for trusted model-provider profiles.

Normal callers resolve a binary profile ID. Direct credential sources are accepted only through resolve(Source, trusted), which is intended for trusted Erlang integration code and deterministic tests. Errors never carry credential values.

Summary

Functions

Validate and project a source without returning credential material.

Resolve the credential source owned by a configured binary profile.

Resolve an explicit source only at a trusted-code boundary. The untrusted form is deliberately fail-closed, including for environment sources, so callers cannot probe arbitrary process/application variables.

Resolve from the same immutable profile generation used to select the adapter, endpoint and model. The environment is read once; a changed raw profile fails before its credential source is touched.

Types

descriptor/0

-type descriptor() :: #{source := none | env | application_env | literal}.

source/0

-type source() ::
          none | {env, binary() | string()} | {application_env, atom(), atom()} | {literal, binary()}.

Functions

describe(Source)

-spec describe(term()) -> {ok, descriptor()} | {error, term()}.

Validate and project a source without returning credential material.

resolve(ProfileId)

-spec resolve(term()) -> {ok, none | binary()} | {error, term()}.

Resolve the credential source owned by a configured binary profile.

resolve(Source, Trust)

-spec resolve(term(), trusted | untrusted) -> {ok, none | binary()} | {error, term()}.

Resolve an explicit source only at a trusted-code boundary. The untrusted form is deliberately fail-closed, including for environment sources, so callers cannot probe arbitrary process/application variables.

resolve_snapshot(ProfileId, ExpectedSnapshot)

-spec resolve_snapshot(term(), term()) -> {ok, none | binary()} | {error, term()}.

Resolve from the same immutable profile generation used to select the adapter, endpoint and model. The environment is read once; a changed raw profile fails before its credential source is touched.