Join or run an OpenID Federation in TypeScript
Resolve trust chains, apply metadata policy, and verify Trust Marks with one library. Works for OIDC, OAuth, and wallet ecosystems, and uses your own keys and protocol stack.
Start with a federation participant
Set up a Trust Anchor
Publish a root of trust and serve signed Subordinate Statements for the participants you enroll.
npm install @oidfed/authority @oidfed/core @oidfed/cryptoBring your crypto engine and keyring. Use durable storage for a deployed authority.
import { TrustAnchor } from "@oidfed/authority";
import { MemoryFederationStorage, type CryptoContext } from "@oidfed/core";
export async function createAnchor(crypto: CryptoContext) {
const entityId = "https://anchor.example";
const anchor = await TrustAnchor.create({
entityId,
crypto,
storage: new MemoryFederationStorage({ namespace: entityId }),
metadata: {
federation_entity: {
federation_fetch_endpoint: `${entityId}/fetch`,
federation_list_endpoint: `${entityId}/list`,
},
},
});
return anchor;
}Delegate trust to an Intermediate
Point to an immediate superior and issue Subordinate Statements for the participants below you. Have the superior enroll your Intermediate.
npm install @oidfed/authority @oidfed/core @oidfed/cryptoBring your crypto engine and keyring. Use durable storage for a deployed authority.
import { Intermediate } from "@oidfed/authority";
import {
MemoryFederationStorage, type CryptoContext, type TrustAnchorSet,
} from "@oidfed/core";
export async function createIntermediate(
crypto: CryptoContext, trustAnchors: TrustAnchorSet,
) {
const entityId = "https://authority.example";
const intermediate = await Intermediate.create({
entityId, crypto, trustAnchors,
authorityHints: ["https://anchor.example"],
storage: new MemoryFederationStorage({ namespace: entityId }),
metadata: {
federation_entity: {
federation_fetch_endpoint: `${entityId}/fetch`,
federation_list_endpoint: `${entityId}/list`,
},
},
});
return intermediate;
}Publish a Leaf’s federation identity
Publish a signed Entity Configuration that points to the authority that enrolled you. Add protocol roles as your application needs them.
npm install @oidfed/leaf @oidfed/core @oidfed/cryptoBring your crypto engine and keyring.
import { Leaf } from "@oidfed/leaf";
import type { CryptoContext, TrustAnchorSet } from "@oidfed/core";
export async function createLeaf(
crypto: CryptoContext, trustAnchors: TrustAnchorSet,
) {
const leaf = await Leaf.create({
entityId: "https://participant.example",
authorityHints: ["https://authority.example"],
crypto,
trustAnchors,
metadata: {
federation_entity: { organization_name: "Example participant" },
},
});
return leaf;
}Compose OIDC and wallet roles
Use one Leaf as an OpenID Connect Relying Party and a Credential Verifier. Supply a protocol signer for Request Objects and wire in your OIDC and presentation engines.
npm install @oidfed/leaf @oidfed/oidc @oidfed/wallet @oidfed/core @oidfed/cryptoBring your crypto engine and keyring.
import { Leaf } from "@oidfed/leaf";
import { OidcRelyingPartyRole } from "@oidfed/oidc";
import { CredentialVerifierRole } from "@oidfed/wallet";
import type { CryptoContext, JWKSet, TrustAnchorSet } from "@oidfed/core";
export async function createParticipant(
crypto: CryptoContext, trustAnchors: TrustAnchorSet,
verifierKeys: JWKSet,
) {
const participant = await Leaf.create({
entityId: "https://portal.example",
authorityHints: ["https://authority.example"],
crypto, trustAnchors,
metadata: { federation_entity: { organization_name: "Example portal" } },
roles: [
new OidcRelyingPartyRole({
signing: { requestObject: "request_object" },
metadata: {
redirect_uris: ["https://portal.example/callback"],
client_registration_types_supported: ["automatic"],
},
}),
new CredentialVerifierRole({
metadata: {
jwks: verifierKeys,
vp_formats_supported: {
mso_mdoc: { issuerauth_alg_values: [-7], deviceauth_alg_values: [-7] },
},
response_uris: ["https://portal.example/presentation"],
},
}),
],
});
return participant;
}The OidFed packages
Construct a host with create(), add the roles it serves, and mount its HTTP handler. Use Core on its own for trust-chain discovery, metadata policy, and Trust Mark checks.
- @oidfed/core
Discover and validate trust chains, apply metadata policy, and verify Trust Marks.
- @oidfed/crypto
Connect Web Crypto, a native keystore, or a remote signing service.
- @oidfed/authority
Run a Trust Anchor or Intermediate, manage subordinates, and issue statements.
- @oidfed/leaf
Publish an Entity Configuration and attach protocol roles to a federation participant.
- @oidfed/oidc
Connect OpenID Providers and Relying Parties, OAuth clients, authorization servers, and protected resources.
- @oidfed/wallet
Add trust discovery and attestation checks for Wallet Providers, Credential Issuers, and Credential Verifiers.
How federation establishes trust
Organizations publish signed statements about themselves and their subordinates. A participant can follow those statements to a Trust Anchor it already trusts, then apply the federation’s policies.
- Learn OpenID Federation
Fifteen interactive lessons, from the first trust chain to federation design.
- Open the Explorer
Inspect signed statements and trace trust chains from live entities.
- Browse demo federations
See hierarchies, multiple Trust Anchors, and metadata policies in action.
- See where federation is used
Review deployments, pilots, and interoperability reports.
- Read the Trust Journal
Follow standards updates and find practical guides from federation operators.