Skip to content

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/crypto

Bring your crypto engine and keyring. Use durable storage for a deployed authority.

trust-anchor.ts
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;
}

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.

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.