#### [Abblix\.Oidc\.Server](https://www.abblix.com/en/docs/api/abblix-oidc-server 'index')
### [Abblix\.Oidc\.Server\.Features\.Nonces](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Nonces 'Abblix\.Oidc\.Server\.Features\.Nonces')

## INonceService Interface

Issues and validates server\-issued opaque, time\-bounded nonces\. The current
consumer is DPoP\-Nonce per RFC 9449 §8 / §9 — the server returns a nonce
via the `DPoP-Nonce` response header and the client echoes it back in
the `nonce` claim of a subsequent DPoP proof to prove freshness — but
the primitive is intentionally generic: any future feature needing
challenge\-response freshness checks can resolve the same service\.

```csharp
public interface INonceService
```

Derived  
↳ [RollingHmacNonceService](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Nonces.RollingHmacNonceService 'Abblix\.Oidc\.Server\.Features\.Nonces\.RollingHmacNonceService')

### Remarks
The default implementation is stateless modulo a short\-lived rotating HMAC
secret stored in `IDistributedCache`\. No per\-nonce state is kept, so
[ValidateAsync\(string, CancellationToken\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Nonces.INonceService#Abblix.Oidc.Server.Features.Nonces.INonceService.ValidateAsync(string,System.Threading.CancellationToken) 'Abblix\.Oidc\.Server\.Features\.Nonces\.INonceService\.ValidateAsync\(string, System\.Threading\.CancellationToken\)') does not enforce single\-use; replay protection
at the proof level is handled separately by the `jti` replay cache\.
### Methods

## INonceService\.IssueAsync\(CancellationToken\) Method {#Abblix.Oidc.Server.Features.Nonces.INonceService.IssueAsync(System.Threading.CancellationToken)}

Mints a fresh nonce string suitable for the `DPoP-Nonce` response
header\. The returned value is opaque to callers — clients must echo it
verbatim\.

```csharp
System.Threading.Tasks.Task<string> IssueAsync(System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.Oidc.Server.Features.Nonces.INonceService.IssueAsync(System.Threading.CancellationToken).cancellationToken}

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')

## INonceService\.ValidateAsync\(string, CancellationToken\) Method {#Abblix.Oidc.Server.Features.Nonces.INonceService.ValidateAsync(string,System.Threading.CancellationToken)}

Verifies that [nonce](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Nonces.INonceService#Abblix.Oidc.Server.Features.Nonces.INonceService.ValidateAsync(string,System.Threading.CancellationToken).nonce 'Abblix\.Oidc\.Server\.Features\.Nonces\.INonceService\.ValidateAsync\(string, System\.Threading\.CancellationToken\)\.nonce') was issued by this deployment
and is still within the acceptance window\.

```csharp
System.Threading.Tasks.Task<System.Nullable<Abblix.Oidc.Server.Features.Nonces.NonceValidationFailure>> ValidateAsync(string nonce, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `nonce` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.Nonces.INonceService.ValidateAsync(string,System.Threading.CancellationToken).nonce}

The nonce string echoed by the client in its DPoP
            proof `nonce` claim\.

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.Oidc.Server.Features.Nonces.INonceService.ValidateAsync(string,System.Threading.CancellationToken).cancellationToken}

Cancellation token\.

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[System\.Nullable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[NonceValidationFailure](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Nonces.NonceValidationFailure 'Abblix\.Oidc\.Server\.Features\.Nonces\.NonceValidationFailure')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
`null` when the nonce is acceptable, otherwise a
            [NonceValidationFailure](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Nonces.NonceValidationFailure 'Abblix\.Oidc\.Server\.Features\.Nonces\.NonceValidationFailure') describing why it is not\.
