Skip to content

Internal client administration

Client registration, exact redirect replacement, secret rotation, and retirement are internal Arc commands. Like the existing account-linking commands, they are excluded from endpoint/proxy discovery. This increment does not connect the facts to OpenIddict stores or add an HTTP endpoint. Every command requires the authenticated, explicitly configured issuer security owner policy.

AddClients() binds Identity:ClientSecrets:Key, Identity:ClientSecrets:Revision, and Identity:ClientSecrets:MaxOverlap. Supply the key through protected server configuration, never through a client command. A supplied key must be base64-encoded and contain at least 32 bytes; its revision must be positive. Startup validation rejects malformed supplied keys or invalid supplied-key revisions. An unset or empty key permits host startup, but secret-producing client commands still fail closed when the digest producer is resolved without a key. There is no development fallback. Keep this key separate from upstream lookup and token-signing keys. Changing key material requires changing the revision and retaining the old key in the future verification boundary for any retained digest that must still be verified. This increment produces digests; it does not implement that verifier or key-ring management.

The producer computes HMAC-SHA-256 over UTF-8 cratis.identity.client-secret.v1, a NUL separator, and the command secret. The stored form is v<revision>.<unpadded base64url digest>, as required by SecretDigest. Plaintext is marked NotAudited, command ToString() is redacted, and events and read models contain only non-redeemable secret references and keyed digests. Do not log or serialize command objects as diagnostic payloads.

Confidential registration returns ClientRegistered, ClientRedirectUrisChanged, and the initial ClientSecretRotated in one batch on a generated registration stream. Public registration has no secret fact. Confidential commands require at least 16 secret characters and refuse whitespace-only material. This compatibility-conscious minimum is not an entropy estimate: generate random secrets of at least 32 characters when provisioning clients. Reusing the current or currently effective digest is refused.

D3 adds strict redirect admission before the unchanged ClientRegistrationRules: web redirects must use HTTPS; native redirects must use HTTP with the loopback IP literal 127.0.0.1 or [::1]. Fragments, user information, and a null allowlist are refused. Existing descriptors keep their current validation rules.

D3 client identifiers contain 1..128 RFC 6749 VSCHAR (ASCII space through tilde) characters, excluding : and leading/trailing whitespace. Identifiers are exact and case-sensitive, with no trimming, normalization, or case folding. Registration reads ClientDescriptors during Provide() and refuses any exact configured-client collision. The client-id event constraint reserves each Internal id permanently, including after retirement.

The dependency-free ClientRegistrationReducer folds Internal facts. Mutations read its state under Arc read protection and refuse absent or retired clients. A rotation cannot precede the latest activation or place the old-secret deadline before the new activation. Activation must be within 24 hours of the trusted server time, in either direction; MaxValue dates are refused. Overlap defaults to a maximum of seven days and can be changed through the nonnegative MaxOverlap TimeSpan option (for example, 7.00:00:00). Equal deadlines mean zero overlap, not immediate invalidation: the previous revision remains valid until the future activation instant.

The model retains superseded revision intervals so successive scheduled rotations cannot discard a still-valid digest. ValidSecretHashesAt() uses inclusive activation and exclusive expiration; raw SecretHash is the latest scheduled revision, not necessarily the one effective now. Expired history is not accepted by that method. Retirement uses the closed owner_retired reason and clears all current and retained digest state; replay does not restore credentials after retirement.

RegisterResource, RegisterResourceScope, and RetireResourceScope use the same issuer security owner policy and discovery exclusion. AddResources() registers the configured catalog and its trusted decision read. Registration refuses configured indicators (including normalized aliases), audiences and scope namespaces. HTTPS indicators have no credentials, query or fragment; URI normalization uses lowercase Uri.IdnHost punycode hosts, removes trailing DNS dots, default ports and dot segments, and removes trailing slashes before permanent uniqueness checks. The same canonical form is applied to configured indicators when checking collisions; Unicode and punycode aliases cannot claim separate registrations. Audience and scope segments follow identity-contract-v1 §4; admin and approve scopes are refused. Business text is non-person, Internal-only, nonblank, control-free and bounded to 256 characters.

Commands append only ResourceRegistrationRecorded, ResourceScopeRegistrationRecorded, and ResourceScopeRetirementRecorded, with generated FactId references on a resource UUID stream. The Internal reducer retains scope descriptions and permanent retirement tombstones. Scope mutations require a guarded registration for the selected resource. Event constraints permanently reserve normalized indicators, audiences, scope prefixes and scope names; retirement never releases a reservation. These facts do not update the protocol resource catalog or expose new endpoints.

Not yet implemented (D4b) — resource Public-event publication: a later train, with its own deep review, must implement the §4.1 outbox publication of ResourceRegistered, ResourceScopeRegistered, and ResourceScopeRetired, including FactId deduplication, original context, per-resource ordering, retry and alerting. D4 deliberately contains no publication reactor or code stubs; existing Public contracts remain unchanged.