agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
29 lines (28 loc) • 1.42 kB
TypeScript
/**
* staticTokens — a dev/test {@link CredentialProvider} backed by canned credentials.
*
* No network, no SDK. Use it to develop tools that need credentials without
* standing up AgentCore Identity (or any IdP). Production swaps it for
* `agentCoreIdentity()` — the tool code never changes.
*
* // a plain string is treated as a bearer token (the common case):
* const credentials = staticTokens({ github: 'ghp_dev_xxx' });
* // …or give an explicit kind:
* const credentials = staticTokens({ internal: apiKey('k', 'x-internal-key') });
*
* const r = await credentials.getCredential({ service: 'github' });
* if (isCredentialIssued(r)) callGithub({ headers: r.credential.toHeaders() });
*/
import type { Credential, CredentialProvider } from './types.js';
export interface StaticTokensOptions {
/** Optional id (defaults to 'static-tokens'). */
readonly id?: string;
/** Optional fixed expiry (unix seconds) applied to every credential. */
readonly expiresAt?: number;
}
/**
* Build a {@link CredentialProvider} from a `service → credential` map. A plain
* string value is treated as a bearer token; a {@link Credential} is used as-is.
* Always 2-legged (issues directly); throws if a requested service has none.
*/
export declare function staticTokens(creds: Readonly<Record<string, string | Credential>>, options?: StaticTokensOptions): CredentialProvider;