HmacManager.StackExchangeRedis
1.0.0
dotnet add package HmacManager.StackExchangeRedis --version 1.0.0
NuGet\Install-Package HmacManager.StackExchangeRedis -Version 1.0.0
<PackageReference Include="HmacManager.StackExchangeRedis" Version="1.0.0" />
<PackageVersion Include="HmacManager.StackExchangeRedis" Version="1.0.0" />
<PackageReference Include="HmacManager.StackExchangeRedis" />
paket add HmacManager.StackExchangeRedis --version 1.0.0
#r "nuget: HmacManager.StackExchangeRedis, 1.0.0"
#:package HmacManager.StackExchangeRedis@1.0.0
#addin nuget:?package=HmacManager.StackExchangeRedis&version=1.0.0
#tool nuget:?package=HmacManager.StackExchangeRedis&version=1.0.0
HmacManager.StackExchangeRedis
Atomic, Redis-backed replay protection for HmacManager.
The built-in Distributed nonce cache works through IDistributedCache, which
has no conditional write, so two copies of a request reaching two instances at
the same moment can both be accepted. This package claims each nonce with one
SET NX instead: exactly one copy is accepted, however many instances share the
Redis.
Targets net8.0 and net10.0.
Install
dotnet add package HmacManager.StackExchangeRedis
Use it
Policies on UseDistributedCache are protected by Redis; policies on
UseMemoryCache keep the in-process cache.
builder.Services.AddHmacManager(options =>
{
options.AddPolicy("MyPolicy", policy =>
{
policy.UsePublicKey(publicKey);
policy.UsePrivateKey(privateKey);
policy.UseDistributedCache(maxAgeInSeconds: 60);
});
});
builder.Services.AddStackExchangeRedisNonceCache(options =>
options.Configuration = "localhost:6379");
The options match AddStackExchangeRedisCache's — Configuration,
ConfigurationOptions, ConnectionMultiplexerFactory and InstanceName — and
the keys match the built-in cache's, so nonces recorded before switching stay
claimed after it.
Log events
| Id | Level | Event |
|---|---|---|
| 1400 | Warning |
A nonce claim failed: Redis unreachable, timed out or errored. The request fails. |
| 1401 | Warning |
The Redis connection was lost |
| 1402 | Information |
The Redis connection was restored |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- HmacManager (>= 2.12.0)
- StackExchange.Redis (>= 2.13.17)
-
net8.0
- HmacManager (>= 2.12.0)
- StackExchange.Redis (>= 2.13.17)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 118 | 10/14/2026 |