Hrithik.Security.ReplayProtection
1.0.1
dotnet add package Hrithik.Security.ReplayProtection --version 1.0.1
NuGet\Install-Package Hrithik.Security.ReplayProtection -Version 1.0.1
<PackageReference Include="Hrithik.Security.ReplayProtection" Version="1.0.1" />
<PackageVersion Include="Hrithik.Security.ReplayProtection" Version="1.0.1" />
<PackageReference Include="Hrithik.Security.ReplayProtection" />
paket add Hrithik.Security.ReplayProtection --version 1.0.1
#r "nuget: Hrithik.Security.ReplayProtection, 1.0.1"
#:package Hrithik.Security.ReplayProtection@1.0.1
#addin nuget:?package=Hrithik.Security.ReplayProtection&version=1.0.1
#tool nuget:?package=Hrithik.Security.ReplayProtection&version=1.0.1
Hrithik.Security.ReplayProtection
Enterprise-grade Replay Attack Protection for .NET APIs.
Specially designed for Banking, Fintech, and secure distributed systems.
❓ What is a Replay Attack?
Jab koi attacker ek valid API request ko copy karke
use dubara server par bhej deta hai, usse Replay Attack kehte hain.
Ye especially dangerous hota hai:
- Banking APIs
- Payment systems
- Secure transactions
✅ What does this library do?
- Validates Nonce + Timestamp
- Prevents duplicate requests (replay attacks)
- Supports distributed systems
- Works with ASP.NET Core
- Cloud-ready (Redis / Distributed Cache)
🚀 Quick Start
1️⃣ Register services
services.AddReplayProtection(options ⇒ { options.AllowedClockSkew = TimeSpan.FromMinutes(5); });
2️⃣ Add middleware app.UseReplayProtection();
📩 Required Request Headers
Every protected request must include:
X-Request-Id → Unique nonce (UUID recommended) X-Timestamp → Unix timestamp (UTC, seconds)
Example:
X-Request-Id: 550e8400-e29b-41d4-a716-446655440000 X-Timestamp: 1738231456
🔐 Security Note (IMPORTANT)
This library prevents replay attacks only.
It does NOT:
Authenticate callers
Authorize requests
Validate request signatures
Use it together with:
JWT / OAuth / mTLS
Request signing (HMAC / RSA)
🧱 Production Usage (Redis)
For distributed systems, use IDistributedCache (Redis):
services.AddStackExchangeRedisCache(options ⇒ { options.Configuration = "localhost:6379"; });
services.AddSingleton<INonceStore, DistributedCacheNonceStore>();
📧 Contact
Author: Hrithik Email: hrithikkalra11@gmail.com
NuGet: Hrithik.Security.ReplayProtection
☕ Support my work
If you find this package helpful, consider buying me a coffee ❤️
👉 Buy Me a Coffee
| 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 was computed. 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. |
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.9)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Options (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.