Path: redb-identity/src/redb.Identity.Core/Keys/ISigningKeyStore.cs Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Core/Keys/ISigningKeyStore.cs ---- using System.Collections.Immutable; using Microsoft.IdentityModel.Tokens; namespace redb.Identity.Core.Keys; /// /// In-memory representation of a signing / encryption key loaded from PROPS storage /// (). /// public sealed record SigningKeyMaterial( string Kid, string KeyKind, string Algorithm, SecurityKey SecurityKey, DateTimeOffset NotBefore, DateTimeOffset NotAfter, bool IsActive); /// /// Persistent store for OpenIddict signing / encryption keys backed by redb PROPS /// (). A3 replaces ephemeral in-memory keys so that /// cluster replicas share the same JWKS and tokens survive restarts. /// public interface ISigningKeyStore { /// Returns all keys currently in the store with NotAfter still in the future (active + still-valid rotated-out). Task> GetAllAsync(CancellationToken ct = default); /// /// Returns every key row in the store, regardless of whether /// is in the past (i.e. including retired keys). Used by the admin /signing-keys list endpoint to /// surface the full audit trail; the JWKS endpoint must still use so /// retired keys do not get advertised to RPs. /// Task> ListAllIncludingRetiredAsync(CancellationToken ct = default); /// /// Generates an initial active key for the given kind if the store contains no active key. /// Idempotent: once an active key of the requested kind exists, the call is a no-op. /// Task EnsureBootstrappedAsync(string keyKind, CancellationToken ct = default); /// /// Generates a fresh key of the given kind and marks every currently-active key of the same kind /// as inactive (so OpenIddict will pick the new one for future signing). The previously-active key /// is NOT retired — its is left untouched so RPs that /// cached the JWKS continue to validate any in-flight tokens that were signed with it. Call /// once the RP cache TTL (typically 1 h) has elapsed. /// /// The newly-created key material. Task RotateAsync(string keyKind, CancellationToken ct = default); /// /// Immediately ends the validity window of by setting NotAfter to "now". /// The key disappears from JWKS on the next request. Tokens previously signed with this key will /// fail signature validation against the live JWKS — call this only after the rotation grace /// window has elapsed. /// /// true when the key was found and retired; false when no key with that kid exists. Task RetireAsync(string kid, CancellationToken ct = default); }