How openwallet-foundation-labs/openid-federation-ts works
Project Type and Purpose
• This is a TypeScript-based, open-source library (monorepo) implementing the core of the OpenID Federation specification.
• There is no UI or server “application” per se—this is a reusable package that other services import to create, fetch, validate, and resolve OpenID Federation entity configurations and statements, manipulate metadata policies, verify JSON Web Tokens, and resolve trust chains.
File–Structure Analysis
• Top-level: a pnpm workspace with one package under packages/core.
• packages/core/src/ is divided into modules:
• entityConfiguration/ · create & fetch entity configurations (JWT)
• entityStatement/ · create & fetch entity statements (JWT)
• jsonWeb/ · JWT creation, parsing, verification, JWK management
• metadata/ · entity metadata definitions & policy operators/merging
• resolveTrustChains/ · trust-chain resolution and policy application
• trustMark/ · trust mark creation and consumption
• error/ · domain-specific error types
• utils/ · shared utilities (fetch wrappers, encoding, schemas, validation)
• Test suites mirror these modules to validate each piece.
README Insights
• Reinforces that @openid-federation/core is the sole package — it exposes an API surface for federation flows.
• No deployment or runtime servers; the library assumes a host environment capable of HTTP fetches and cryptographic primitives.
Diagramming the Architecture
• Consumer Application (the host service importing the library)
• Core Library Boundary
– EntityConfiguration Module
– EntityStatement Module
– JSONWeb Module
– Metadata & Policy Operator Module
– ResolveTrustChains Module
– TrustMark Module
– Utils & Error Modules
• External Dependencies
– HTTP Endpoints (to fetch remote configurations/statements)
– Cryptographic Service (WebCrypto or Node.js crypto)
1. Consumer invokes “create” or “fetch” functions in EntityConfiguration/EntityStatement.
2. Those modules call HTTP fetch via Utils → retrieve JWT from remote endpoint.
3. JSONWeb verifies/parses the JWT using keys fetched or provided.
4. Metadata module loads the entity metadata and applies policy operators.
5. ResolveTrustChains consumes a set of statements & policies, applies merges, and outputs a resolved chain.
6. TrustMark module issues or consumes trust marks based on resolved metadata & claims.
c. Architectural Patterns
• Layered, modular design: each concern (JWT, metadata, policy, trust chains) lives in its own layer.
• Functional API surface: pure functions that compose together.
• Strategy pattern for metadata operators.
d. Key Technologies
• TypeScript (static types, module boundaries)
• Fetch API (HTTP client)
• JSON Web Token & Key (JWK) handling
• JSON Schema for policy validation
• pnpm workspace for monorepo management