Full M2M path
Trustline ships a provider, a client, a guard, and framework adapters so you can issue tokens, call downstream services, and verify requests end to end.
Issue, fetch, cache, and verify machine-to-machine tokens with one library.
Trustline solves service-to-service authentication inside your infrastructure. It gives a receiving service a consistent way to verify who called it, what that caller is allowed to do, and whether the token belongs to the correct environment.
The project has three parts:
trustline: provider, guard, and shared core exportstrustline/client: token fetching, caching, and auto-refresh for outgoing callstrustline/frameworks/*: framework adapters for incoming callstrustline/adapters/*: SQL storage adaptersEach piece is independently useful. You can use the full Trustline stack, or you can use the guard by itself against any standards-compliant issuer such as Keycloak or Auth0.
createProvider, createClient, createGuard, memoryStorage(), framework subpaths under trustline/frameworks/*, and SQL adapter subpaths under trustline/adapters/*jti, client disable and token cutoffs, signing key rotation overlap windows, token caching with refresh deduplication, local JWT verification, and Express/Fastify/Hono adaptersimport { createProvider, memoryStorage } from "trustline";
import { createClient } from "trustline/client";
import { createGuard } from "trustline";
const provider = createProvider({
issuer: "https://auth.internal",
storage: memoryStorage(),
env: "production",
});
const caller = createClient({
tokenUrl: "https://auth.internal/token",
clientId: process.env.TRUSTLINE_CLIENT_ID!,
clientSecret: process.env.TRUSTLINE_CLIENT_SECRET!,
audience: "inventory-service",
});
const guard = createGuard({
issuer: "https://auth.internal",
audience: "inventory-service",
});
const token = await caller.getToken();
const identity = await guard.verify(token);Continue with Get Started for setup, Operations for Phase 1 controls, and Reference for the current public API.