@openagentid/oidc API
Exported TypeScript types, signatures and source documentation.
Package manifest, subpaths, and integration guide.
This reference resolves exported symbols from the package entry point with the TypeScript parser/type checker. It includes declarations and inferred types, not implementation bodies. External dependencies unavailable to the extraction environment can remain unresolved; this is source documentation, not proof that all packages typecheck or are published.
OidcBridge
The OIDC bridge -- maps between human OIDC tokens and OAS agent identities.
export declare class OidcBridge {
constructor(input: OidcConfig | SingleProviderInput): OidcBridge;
getConfig(): Readonly<OidcConfig>;
deriveAgentFromJwt(token: string, agentName: string): Promise<DerivedAgent>;
actToJwt(claims: ActJwtClaims, signingKey: jose.KeyLike | Uint8Array, algorithm: string, kid?: string): Promise<string>;
wrapActAsJwt(opts: { agentDid: string; bridgeIssuer: string; audience?: string; scopes: readonly string[]; lineageDepth: number; parentHmr: string; actB64: string; signingKey: jose.KeyLike | Uint8Array; algorithm: string; kid?: string; }): Promise<string>;
exchangeToken(humanJwt: string, requestedScopes: readonly string[], signingKey?: jose.KeyLike | Uint8Array, algorithm?: string, bridgeIssuer?: string): Promise<TokenExchangeResponse>;
executeExchange(request: TokenExchangeRequest, signingKey: jose.KeyLike | Uint8Array | undefined, algorithm: string, bridgeIssuer: string): Promise<TokenExchangeResponse>;
validateJwt(token: string): Promise<ValidatedClaims>;
refreshAllJwks(): Promise<void>;
}Source: openagent-sdk/bridges/oidc/typescript/src/bridge.ts:67.
ProviderConfig
export type ProviderConfig = z.infer<typeof providerConfigSchema>;Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:26.
OidcConfig
export type OidcConfig = z.infer<typeof oidcConfigSchema>;Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:42.
SingleProviderInput
Shorthand input for single-provider setup.
/** Shorthand input for single-provider setup. */
export interface SingleProviderInput {
/** Provider name. */
name?: string;
/** OIDC issuer URL. */
issuer: string;
/** Expected audience. */
audience?: string;
/** JWKS URL override. */
jwksUrl?: string;
/** HMR claim name. */
hmrClaim?: string;
/** Scope mapping. */
scopeMapping?: Record<string, string[]>;
/** OAS namespace. */
namespace?: string;
/** JWT TTL seconds. */
jwtTtlSeconds?: number;
/** HTTP timeout ms. */
httpTimeoutMs?: number;
/** Custom fetch. */
fetch?: typeof globalThis.fetch;
}Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:45.
providerConfigSchema
Configuration for a single OIDC provider.
export declare const providerConfigSchema: z.ZodObject<{ name: z.ZodString; issuer: z.ZodString; audience: z.ZodOptional<z.ZodString>; jwksUrl: z.ZodOptional<z.ZodString>; hmrClaim: z.ZodDefault<z.ZodString>; scopeMapping: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>; }, z.core.$strip>;Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:11.
oidcConfigSchema
Top-level OIDC bridge configuration.
export declare const oidcConfigSchema: z.ZodObject<{ providers: z.ZodArray<z.ZodObject<{ name: z.ZodString; issuer: z.ZodString; audience: z.ZodOptional<z.ZodString>; jwksUrl: z.ZodOptional<z.ZodString>; hmrClaim: z.ZodDefault<z.ZodString>; scopeMapping: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>; }, z.core.$strip>>; namespace: z.ZodDefault<z.ZodString>; jwtTtlSeconds: z.ZodDefault<z.ZodNumber>; httpTimeoutMs: z.ZodDefault<z.ZodNumber>; fetch: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>; }, z.core.$strip>;Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:29.
singleProviderConfig
Build an OidcConfig from a single-provider shorthand input.
export declare const singleProviderConfig: (input: SingleProviderInput) => OidcConfig;Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:69.
findProvider
Find the provider config whose issuer matches the given string.
export declare const findProvider: (config: OidcConfig, issuer: string) => ProviderConfig | undefined;Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:89.
resolveFetch
Resolve the fetch implementation from config or globalThis.
export declare const resolveFetch: (config: OidcConfig) => typeof globalThis.fetch;Source: openagent-sdk/bridges/oidc/typescript/src/config.ts:97.
DiscoveryDocument
export type DiscoveryDocument = z.infer<typeof discoveryDocumentSchema>;Source: openagent-sdk/bridges/oidc/typescript/src/discovery.ts:23.
DiscoveryClient
OIDC discovery client with per-issuer caching.
export declare class DiscoveryClient {
constructor(fetchImpl: typeof globalThis.fetch, timeoutMs?: number, cacheTtlMs?: number): DiscoveryClient;
discover(issuer: string): Promise<DiscoveryDocument>;
invalidate(issuer: string): void;
invalidateAll(): void;
}Source: openagent-sdk/bridges/oidc/typescript/src/discovery.ts:40.
discoveryDocumentSchema
Subset of the OpenID Connect Discovery document we need.
export declare const discoveryDocumentSchema: z.ZodObject<{ issuer: z.ZodString; authorization_endpoint: z.ZodDefault<z.ZodString>; token_endpoint: z.ZodDefault<z.ZodString>; jwks_uri: z.ZodString; response_types_supported: z.ZodDefault<z.ZodArray<z.ZodString>>; subject_types_supported: z.ZodDefault<z.ZodArray<z.ZodString>>; id_token_signing_alg_values_supported: z.ZodDefault<z.ZodArray<z.ZodString>>; scopes_supported: z.ZodDefault<z.ZodArray<z.ZodString>>; token_exchange_endpoint: z.ZodOptional<z.ZodString>; }, z.core.$strip>;Source: openagent-sdk/bridges/oidc/typescript/src/discovery.ts:11.
wellKnownUrl
Build the .well-known/openid-configuration URL from an issuer.
export declare const wellKnownUrl: (issuer: string) => string;Source: openagent-sdk/bridges/oidc/typescript/src/discovery.ts:31.
OidcBridgeError
Base error class for all OIDC bridge errors.
export declare class OidcBridgeError {
code: OidcErrorCode;
constructor(code: OidcErrorCode, message: string): OidcBridgeError;
config(message: string): OidcBridgeError;
discovery(message: string): OidcBridgeError;
jwks(message: string): OidcBridgeError;
jwtValidation(message: string): OidcBridgeError;
unknownIssuer(issuer: string): OidcBridgeError;
mapping(message: string): OidcBridgeError;
exchange(message: string): OidcBridgeError;
signing(message: string): OidcBridgeError;
transport(message: string): OidcBridgeError;
}Source: openagent-sdk/bridges/oidc/typescript/src/errors.ts:18.
OidcErrorCode
Error codes for OIDC bridge errors.
/**
* Error types for the OIDC bridge.
*/
/** Error codes for OIDC bridge errors. */
export type OidcErrorCode = 'DISCOVERY_ERROR' | 'JWKS_ERROR' | 'JWT_VALIDATION_ERROR' | 'UNKNOWN_ISSUER' | 'MAPPING_ERROR' | 'EXCHANGE_ERROR' | 'SIGNING_ERROR' | 'CONFIG_ERROR' | 'TRANSPORT_ERROR';Source: openagent-sdk/bridges/oidc/typescript/src/errors.ts:6.
TokenExchangeRequest
export type TokenExchangeRequest = z.infer<typeof tokenExchangeRequestSchema>;Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:41.
TokenExchangeResponse
Token exchange response (RFC 8693 Section 2.2).
/** Token exchange response (RFC 8693 Section 2.2). */
export interface TokenExchangeResponse {
readonly accessToken: string;
readonly issuedTokenType: string;
readonly tokenType: 'Bearer';
readonly expiresIn: number;
readonly scope?: string;
}Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:44.
TokenExchangeError
RFC 8693 error response.
/** RFC 8693 error response. */
export interface TokenExchangeError {
readonly error: string;
readonly errorDescription?: string;
}Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:53.
tokenExchangeRequestSchema
Token exchange request (RFC 8693 Section 2.1).
export declare const tokenExchangeRequestSchema: z.ZodObject<{ grantType: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:token-exchange">; subjectToken: z.ZodString; subjectTokenType: z.ZodEnum<{ "urn:ietf:params:oauth:token-type:jwt": "urn:ietf:params:oauth:token-type:jwt"; "urn:ietf:params:oauth:token-type:access_token": "urn:ietf:params:oauth:token-type:access_token"; }>; requestedTokenType: z.ZodOptional<z.ZodEnum<{ "urn:ietf:params:oauth:token-type:jwt": "urn:ietf:params:oauth:token-type:jwt"; "urn:ietf:params:oauth:token-type:access_token": "urn:ietf:params:oauth:token-type:access_token"; "urn:openagent:token-type:act": "urn:openagent:token-type:act"; }>>; scope: z.ZodOptional<z.ZodString>; audience: z.ZodOptional<z.ZodString>; resource: z.ZodOptional<z.ZodString>; actorToken: z.ZodOptional<z.ZodString>; actorTokenType: z.ZodOptional<z.ZodString>; }, z.core.$strip>;Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:29.
GRANT_TYPE_TOKEN_EXCHANGE
Standard grant type for RFC 8693 Token Exchange.
export declare const GRANT_TYPE_TOKEN_EXCHANGE: "urn:ietf:params:oauth:grant-type:token-exchange";Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:12.
TOKEN_TYPE_JWT
Standard token type for JWT subject tokens.
export declare const TOKEN_TYPE_JWT: "urn:ietf:params:oauth:token-type:jwt";Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:16.
TOKEN_TYPE_ACT
Custom token type for OpenAgent ACTs.
export declare const TOKEN_TYPE_ACT: "urn:openagent:token-type:act";Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:19.
TOKEN_TYPE_ACCESS
Standard token type for access tokens.
export declare const TOKEN_TYPE_ACCESS: "urn:ietf:params:oauth:token-type:access_token";Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:22.
createJwtToActRequest
Create a token exchange request for JWT -> ACT exchange.
export declare const createJwtToActRequest: (subjectToken: string, scopes?: readonly string[]) => TokenExchangeRequest;Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:59.
validateExchangeRequest
Validate a token exchange request.
export declare const validateExchangeRequest: (request: TokenExchangeRequest) => void;Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:73.
parseScopes
Parse scopes from a space-delimited string.
export declare const parseScopes: (scope: string | undefined) => string[];Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:83.
successResponse
Build a successful token exchange response.
export declare const successResponse: (accessToken: string, issuedTokenType: string, expiresIn: number, scope?: string) => TokenExchangeResponse;Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:89.
exchangeErrors
Create standard OAuth2 error responses.
export declare const exchangeErrors: { readonly invalidRequest: (desc: string) => TokenExchangeError; readonly invalidGrant: (desc: string) => TokenExchangeError; readonly unsupportedTokenType: (desc: string) => TokenExchangeError; readonly invalidTarget: (desc: string) => TokenExchangeError; };Source: openagent-sdk/bridges/oidc/typescript/src/exchange.ts:105.
JwksClient
JWKS client with per-URI caching and rotation-aware refresh.
export declare class JwksClient {
constructor(fetchImpl: typeof globalThis.fetch, timeoutMs?: number, cacheTtlMs?: number): JwksClient;
fetchJwks(jwksUri: string): Promise<jose.JSONWebKeySet>;
refresh(jwksUri: string): Promise<jose.JSONWebKeySet>;
selectKey(jwks: jose.JSONWebKeySet, kid: string | undefined, alg: string | undefined): jose.JWK;
invalidate(jwksUri: string): void;
}Source: openagent-sdk/bridges/oidc/typescript/src/jwks.ts:17.
ValidatedClaims
Claims extracted from a validated human JWT.
/** Claims extracted from a validated human JWT. */
export interface ValidatedClaims {
/** Issuer (`iss` claim). */
readonly issuer: string;
/** Subject (`sub` claim). */
readonly subject: string;
/** Audience (`aud` claim). */
readonly audience: readonly string[];
/** Expiration (epoch seconds). */
readonly exp: number;
/** Issued-at (epoch seconds). */
readonly iat: number;
/** The claim value that maps to the HMR. */
readonly hmrValue: string;
/** OIDC scopes extracted from the token. */
readonly scopes: readonly string[];
/** All original claims. */
readonly rawClaims: Readonly<Record<string, unknown>>;
}Source: openagent-sdk/bridges/oidc/typescript/src/jwt.ts:12.
ActJwtClaims
Claims for an outbound JWT wrapping an Arsenal ACT (Flow 2).
/** Claims for an outbound JWT wrapping an Arsenal ACT (Flow 2). */
export interface ActJwtClaims {
/** Subject: the agent's DID. */
readonly sub: string;
/** Issuer: the bridge's own issuer identifier. */
readonly iss: string;
/** Audience. */
readonly aud?: string;
/** Expiration (epoch seconds). */
readonly exp: number;
/** Issued-at (epoch seconds). */
readonly iat: number;
/** JWT ID. */
readonly jti: string;
/** Arsenal scope strings. */
readonly scope: string;
/** Lineage depth (hops from HMR root). */
readonly lineage_depth: number;
/** Parent HMR DID. */
readonly parent_hmr: string;
/** Serialized ACT (base64url). */
readonly act: string;
}Source: openagent-sdk/bridges/oidc/typescript/src/jwt.ts:32.
decodeJwtHeader
Decode the JWT header without verification (to get kid/alg).
export declare const decodeJwtHeader: (token: string) => { kid?: string; alg?: string; };Source: openagent-sdk/bridges/oidc/typescript/src/jwt.ts:56.
extractUnverifiedIssuer
Extract the unverified iss claim from a JWT.
export declare const extractUnverifiedIssuer: (token: string) => string;Source: openagent-sdk/bridges/oidc/typescript/src/jwt.ts:62.
validateJwt
Validate and decode a JWT using the given JWK.
Performs standard OIDC validation: issuer, audience, expiry, signature.
export declare const validateJwt: (token: string, jwk: jose.JWK, provider: ProviderConfig) => Promise<ValidatedClaims>;Source: openagent-sdk/bridges/oidc/typescript/src/jwt.ts:75.
buildActClaims
Build ACT JWT claims.
export declare const buildActClaims: (opts: { agentDid: string; bridgeIssuer: string; audience?: string; scopes: readonly string[]; lineageDepth: number; parentHmr: string; actB64: string; ttlSeconds: number; }) => ActJwtClaims;Source: openagent-sdk/bridges/oidc/typescript/src/jwt.ts:128.
signActJwt
Sign a JWT wrapping an Arsenal ACT for OAuth2-only services.
export declare const signActJwt: (claims: ActJwtClaims, signingKey: jose.KeyLike | Uint8Array, algorithm: string, kid?: string) => Promise<string>;Source: openagent-sdk/bridges/oidc/typescript/src/jwt.ts:154.
DerivedAgent
Result of deriving an agent DID from a human JWT.
/** Result of deriving an agent DID from a human JWT. */
export interface DerivedAgent {
/** Agent DID (did:oas:<ns>:agent:<name>). */
readonly agentDid: string;
/** Agent keypair (Ed25519 public + private key bytes). */
readonly agentKeypair: {
readonly publicKey: Uint8Array;
readonly privateKey: Uint8Array;
};
/** Lineage proof (JSON structure). */
readonly lineageProof: Record<string, unknown> | null;
/** Parent HMR DID. */
readonly parentHmrDid: string;
/** Lineage depth (0 for HMR, 1 for direct child). */
readonly lineageDepth: number;
}Source: openagent-sdk/bridges/oidc/typescript/src/mapping.ts:12.
deriveAgentFromClaims
Derive an agent DID from validated OIDC claims.
This is the core of Flow 1: Human JWT -> Agent DID.
In a production deployment, this would use the OAS SDK's create_hmr
and derive_child functions (available via the WASM crypto module).
Here we produce the correct DID format and structure, with placeholder
keypairs that would be replaced by the real OAS SDK integration.
export declare const deriveAgentFromClaims: (namespace: string, claims: ValidatedClaims, agentName: string) => DerivedAgent;Source: openagent-sdk/bridges/oidc/typescript/src/mapping.ts:52.
hmrIdentifierFromClaims
Deterministic identifier for an HMR derived from an OIDC subject.
Uses issuer + subject to produce a stable, collision-resistant identifier that doesn't leak PII.
export declare const hmrIdentifierFromClaims: (issuer: string, hmrValue: string) => string;Source: openagent-sdk/bridges/oidc/typescript/src/mapping.ts:34.
mapScopes
Map OIDC scopes/roles to Arsenal capability scopes.
Unmapped scopes are passed through as-is.
export declare const mapScopes: (oidcScopes: readonly string[], scopeMapping: Readonly<Record<string, readonly string[]>>) => string[];Source: openagent-sdk/bridges/oidc/typescript/src/mapping.ts:101.
VERSION
SDK version.
export declare const VERSION: "0.1.1";Source: openagent-sdk/bridges/oidc/typescript/src/index.ts:98.