Skip to content

IKeyRing Interface

Hands out the keys it holds to whoever asks for them.

C#
public interface IKeyRing

Derived
InMemoryKeyRing

Remarks

The ring knows how keys are minted, sealed, shared and rotated, and nothing about what they are then used for. An OpenID Provider asks it for the keys it signs with and publishes; a client asks it for the keys it protects stored sessions with. Both get the same answer from the same ring, which is why this contract names neither of them.

Methods

IKeyRing.Get(string, bool) Method

Returns the keys for a role, the one to produce with leading.

C#
System.Collections.Generic.IEnumerable<Abblix.Jwt.JsonWebKey> Get(string usage, bool includePrivateKeys);

Parameters

usage System.String

Which role to serve, signature or encryption.

includePrivateKeys System.Boolean

Whether the caller needs the private half, which only signing and decryption do. Publication must not.

Returns

System.Collections.Generic.IEnumerable<JsonWebKey>

Remarks

The ordering carries meaning: whoever produces takes the first key for an algorithm, while every key stays in the result so consumers can still verify or decrypt across a rotation.

IKeyRing.RefreshAsync(CancellationToken) Method

Brings the ring up to date: mints what the current period lacks, retires what has expired, and reloads what other instances have minted.

C#
System.Threading.Tasks.Task RefreshAsync(System.Threading.CancellationToken cancellationToken);

Parameters

cancellationToken System.Threading.CancellationToken

Cancels the refresh.

Returns

System.Threading.Tasks.Task