Guide 09 · Federation & Self-Hosting

Self-Hosting a Protext Provider & Multi-Provider Discovery

Deploy your own MIT-licensed PROTEXT/0.1 provider with Next.js 15, Postgres, Drizzle, and PROTEXT_JWK, and implement /.well-known/protext.json multi-provider discovery.

SPEC.md §7SPEC.md §8SPEC.md §9SPEC.md §10README.mdapp/.well-known/protext.json/route.ts
Quick answer · PROTEXT/0.1

Anyone can run an independent Protext provider using the MIT-licensed reference implementation (Next.js 15, Postgres via Drizzle, and jose): configure DATABASE_URL, PROTEXT_JWK, and NEXT_PUBLIC_HOST, run migrations, and publish /.well-known/openid-configuration plus /.well-known/protext.json.

A person's federated Protext address is <handle>@<provider> or https://<provider>/<handle>. Relying parties resolve the provider's discovery documents, dynamically register via RFC 7591 if needed, and run the standard PKCE flow without central gatekeeping.

Self-hosted reference provider configuration and conformance checklist

ComponentSetting / FileRequirement
Domain / IssuerNEXT_PUBLIC_HOSTSets ISSUER (https://<host> or http://localhost:<port>) across discovery, JWT iss, and profile URLs
Signing keyPROTEXT_JWK (via node scripts/keygen.mjs)Persistent 2048-bit RSA private JWK with stable kid for RS256 signing
DatabaseDATABASE_URL + npm run db:migratePostgres schema managed by Drizzle (drizzle/0000_init.sql)
OIDC discovery/.well-known/openid-configurationStandard OIDC discovery plus protext_context_endpoint and protext_metadata (§8)
Protext metadata/.well-known/protext.jsonPublishes protext version, issuer, categories, kinds, personhood_issuers, and sdk URL (§8)
Conformance testBASE=... node tests/e2e.mjs & prod-smoke.mjsVerifies §3–§6 and §8 end-to-end (claim, import, RFC 7591, PKCE, replay, refresh, revoke, export)
Wire format & code example

Bootstrapping a self-hosted PROTEXT/0.1 reference provider

Commands taken directly from README.md and package.json.

# 1. Clone the MIT-licensed reference provider
git clone https://github.com/FlicLabs/protext.git
cd protext
npm install

# 2. Generate a persistent RS256 signing key (PROTEXT_JWK)
node scripts/keygen.mjs

# 3. Configure .env.local with DATABASE_URL, PROTEXT_JWK, NEXT_PUBLIC_HOST
# 4. Run Drizzle migrations + production build + start
npm run build
npm start

# 5. Verify conformance against your running provider
BASE=https://your-provider.example node tests/prod-smoke.mjs

Multi-provider discovery and /.well-known/protext.json

protext.org is the reference provider, not a central registry. Every conformant provider serves both /.well-known/openid-configuration and /.well-known/protext.json with Access-Control-Allow-Origin: *.

When a relying party supports multiple providers, it asks the user for their Protext address (<handle>@<provider> or https://<provider>/<handle>), fetches https://<provider>/.well-known/protext.json and /.well-known/openid-configuration, registers dynamically via RFC 7591 if it does not yet hold a client_id there, and passes that issuer into its OIDC client or sdk.js data-issuer attribute.

Reserved personhood slot (§7) and PROTEXT/0.2 roadmap (§9)

Every bundle includes a personhood array reserved for optional third-party proof-of-personhood credentials (World ID, Human Passport, EU Digital Identity wallets, or mobile driver's licences via the W3C Digital Credentials API). A provider must never make sign-in conditional on holding a personhood credential; if an RP requires one, it asks on its own screen after sign-in.

Version 0.1 uses password authentication with bcrypt (cost 11) and HTTP-only session cookies on the provider vault. SPEC.md §9 documents the planned 0.2 milestones: WebAuthn passkeys as the primary provider credential, SD-JWT VC selective disclosure for individual items, W3C Digital Credentials API presentation from the provider page, and an MCP server on the vault so a person's own AI agents can read context under the same item-level grants.

  • Conformance (§10): a Protext provider implements §3–§6 and §8 and passes the repository test suite.
  • Every provider must expose a full vault export equivalent to /api/v0/export (§6.4).
  • No proprietary token, blockchain, or new cryptographic primitive is required anywhere in the protocol (§1.5).
Next step

Verify against the normative specification or register your client.

Read PROTEXT/0.1 SpecDeveloper Quickstart10 Languages
FAQ

Frequently asked questions

What license is the Protext specification and reference provider under?

Both SPEC.md and the reference provider implementation at github.com/FlicLabs/protext are open-source under the MIT license.

What stack does the reference Protext provider run on?

It is built with Next.js 15, Postgres via Drizzle ORM, jose for RS256 JWT signing and JWKS, and bcryptjs for 0.1 vault passwords.

What happens if PROTEXT_JWK is omitted in production?

lib/oidc.ts falls back to an ephemeral in-memory RSA key per process with an ephemeral-* kid, causing tokens to fail verification across instances. Always generate and set PROTEXT_JWK with node scripts/keygen.mjs in production.

How do relying parties discover a self-hosted provider?

From a person's address (<handle>@<provider> or https://<provider>/<handle>), the RP fetches https://<provider>/.well-known/protext.json and /.well-known/openid-configuration, registers via RFC 7591 if needed, and starts the standard PKCE flow.

Can a Protext provider require a proof-of-personhood credential to sign in?

No. SPEC.md §1.6 and §7 explicitly state that personhood is a slot, not a gate: a provider must never make sign-in conditional on a personhood credential.

What features are on the PROTEXT/0.2 roadmap in SPEC.md?

SPEC.md §9 lists WebAuthn passkeys as the primary provider credential, SD-JWT VC selective-disclosure presentation of bundles, W3C Digital Credentials API presentation, and an MCP server on the vault governed by the same grants.

Related guides

Continue exploring PROTEXT/0.1

Guide 01 · OIDC & OAuth 2.1

OpenID Connect & OAuth 2.1 PKCE Integration

Integrate Sign in with Protext using OpenID Connect Core discovery, OAuth 2.1 authorization code flow with S256 PKCE, RFC 9207 iss checks, and RS256 ID tokens.

Read guide →
Guide 04 · RFC 7591 Registration

RFC 7591 Dynamic Client Registration

Register public PKCE or confidential OIDC relying parties immediately at POST https://protext.org/oidc/register using RFC 7591 without creating a provider account first.

Read guide →
Guide 05 · Cryptographic Verification

Signed context_token & JWKS Verification

Verify RS256 signed id_token and context_token JWS payloads against /.well-known/jwks.json using standard JOSE libraries for verifiable third-party bundle handoff.

Read guide →