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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hrithik.Security.ReplayProtection" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hrithik.Security.ReplayProtection" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Hrithik.Security.ReplayProtection" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hrithik.Security.ReplayProtection --version 1.0.1
                    
#r "nuget: Hrithik.Security.ReplayProtection, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hrithik.Security.ReplayProtection@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hrithik.Security.ReplayProtection&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Hrithik.Security.ReplayProtection&version=1.0.1
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1 123 1/30/2026
1.0.0 111 1/30/2026