#### [Abblix\.Jwt](https://www.abblix.com/en/docs/api/abblix-jwt 'index')
### [Abblix\.Jwt\.ExternalKeys](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys 'Abblix\.Jwt\.ExternalKeys')

## InMemoryKeyRing Class

A key ring whose keys are minted in this process and never leave it\.

```csharp
public sealed class InMemoryKeyRing : Abblix.Jwt.ExternalKeys.IKeyRing
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → InMemoryKeyRing

Implements [IKeyRing](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.IKeyRing 'Abblix\.Jwt\.ExternalKeys\.IKeyRing')

### Remarks
The default for a host that has no HSM or KMS, which is most of them\. It gives what a ring is for \-
rotation without breaking what the retired key produced \- and nothing more: the keys live in memory, so
they are gone when the process is, and no other process shares them\.

That last property is the whole of the difference from [Abblix\.Jwt\.ExternalKeys\.KeyRing](https://learn.microsoft.com/en-us/dotnet/api/abblix.jwt.externalkeys.keyring 'Abblix\.Jwt\.ExternalKeys\.KeyRing'), and it is a difference in
guarantee, not in strength\. A custodian\-backed ring puts the private half somewhere this process cannot
reach and every replica can; this one puts it somewhere only this process can reach\. Which is right
depends on how the host is deployed, so the host chooses rather than inheriting a default\.
### Constructors

## InMemoryKeyRing\(LocalKeys, IOptions\<KeyRingOptions\>, TimeProvider\) Constructor {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.InMemoryKeyRing(Abblix.Jwt.ExternalKeys.LocalKeys,Microsoft.Extensions.Options.IOptions_Abblix.Jwt.ExternalKeys.KeyRingOptions_,System.TimeProvider)}

Creates the ring\.

```csharp
public InMemoryKeyRing(Abblix.Jwt.ExternalKeys.LocalKeys policy, Microsoft.Extensions.Options.IOptions<Abblix.Jwt.ExternalKeys.KeyRingOptions> options, System.TimeProvider timeProvider);
```
#### Parameters

###### `policy` [LocalKeys](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.LocalKeys 'Abblix\.Jwt\.ExternalKeys\.LocalKeys') {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.InMemoryKeyRing(Abblix.Jwt.ExternalKeys.LocalKeys,Microsoft.Extensions.Options.IOptions_Abblix.Jwt.ExternalKeys.KeyRingOptions_,System.TimeProvider).policy}

###### `options` [Microsoft\.Extensions\.Options\.IOptions&lt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptions-1 'Microsoft\.Extensions\.Options\.IOptions\`1')[KeyRingOptions](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.KeyRingOptions 'Abblix\.Jwt\.ExternalKeys\.KeyRingOptions')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptions-1 'Microsoft\.Extensions\.Options\.IOptions\`1') {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.InMemoryKeyRing(Abblix.Jwt.ExternalKeys.LocalKeys,Microsoft.Extensions.Options.IOptions_Abblix.Jwt.ExternalKeys.KeyRingOptions_,System.TimeProvider).options}

###### `timeProvider` [System\.TimeProvider](https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider 'System\.TimeProvider') {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.InMemoryKeyRing(Abblix.Jwt.ExternalKeys.LocalKeys,Microsoft.Extensions.Options.IOptions_Abblix.Jwt.ExternalKeys.KeyRingOptions_,System.TimeProvider).timeProvider}
### Methods

## InMemoryKeyRing\.Get\(string, bool\) Method {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.Get(string,bool)}

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

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

###### `usage` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.Get(string,bool).usage}

Which role to serve, signature or encryption\.

###### `includePrivateKeys` [System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean') {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.Get(string,bool).includePrivateKeys}

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

Implements [Get\(string, bool\)](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.IKeyRing#Abblix.Jwt.ExternalKeys.IKeyRing.Get(string,bool) 'Abblix\.Jwt\.ExternalKeys\.IKeyRing\.Get\(string, bool\)')

#### Returns
[System\.Collections\.Generic\.IEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')[JsonWebKey](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.JsonWebKey 'Abblix\.Jwt\.JsonWebKey')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')

### 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\.

## InMemoryKeyRing\.RefreshAsync\(CancellationToken\) Method {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.RefreshAsync(System.Threading.CancellationToken)}

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

```csharp
public System.Threading.Tasks.Task RefreshAsync(System.Threading.CancellationToken cancellationToken);
```
#### Parameters

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.Jwt.ExternalKeys.InMemoryKeyRing.RefreshAsync(System.Threading.CancellationToken).cancellationToken}

Cancels the refresh\.

Implements [RefreshAsync\(CancellationToken\)](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.IKeyRing#Abblix.Jwt.ExternalKeys.IKeyRing.RefreshAsync(System.Threading.CancellationToken) 'Abblix\.Jwt\.ExternalKeys\.IKeyRing\.RefreshAsync\(System\.Threading\.CancellationToken\)')

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')
