Credentials for Brave Search.
Per-call credentials. Every API-calling function in ::brave::search
takes an optional trailing opts Map, resolved by resolve: opts
first, then the brave.api.key context variable. Nothing from opts
is written to ctx, so one run can act for many tenants and parallel
flows don't share credentials. Credentials in opts are masked in
call records. An api-key present but blank or null is an error,
never a fallback to context.
api-key: the API key for this call
Context Vars
brave.api.key
Functions
non-blank
fn (value: Any): Str?
resolve
fn (opts: Map): Map
The credentials for one call (see resolve-from). An api-key from
opts is masked in this run's records and never written to ctx.
Example
::brave::search::api/resolve({api-key: "tenant-b-token"}).api-key // "tenant-b-token"
brave.api.key
resolve-from
fn (opts: Map, ctx-values: Map): Map
The one resolver, pure: {api-key} for a call from opts first, then ctx-values (a Map of context variables). An Err when no API key is set, or when api-key is in opts but blank or null (that never falls back to context). Exposed for testing; resolve feeds it the context.