mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 11:24:57 -05:00
A confidential client with inline `jwks` can now replace its keys at `POST /oauth2/client/rotate-keys` without a user session. The request carries the complete new JWK Set and a client assertion signed by a current key, addressed to the rotation endpoint itself, so an assertion minted for the token endpoint or the issuer cannot be redirected here. Enabled with `allowClientKeyRotation`. Keys left out of the new set stop verifying at once. A client rolls a key in two steps, the way a jwks_uri client does: it sends the old and new keys together, then drops the old key once every instance signs with the new one. Only current keys can authorize a rotation, matching RFC 7592, node-oidc-provider, Ory Hydra, and Keycloak, where only the current management credential can change a client. The write is guarded on the exact key set the assertion was verified against, so a concurrent rotation fails with 409 instead of overwriting. No schema change is needed.