EricksonLopez.Webhooks
dotnet-webhooks · Integraciones y Protocolos
En esta página (20 secciones)
1. Identidad, Nivel y Perfil de Madurez#
2. Propuesta de Valor y Problema que Resuelve#
Production-ready webhook engine for .NET 8/9/10: resilient outbound delivery with Polly v8 & socket-level SSRF mitigation, Redis distributed DLQ & anti-replay defense, and ASP.NET Core inbound verification middleware with Native AOT & OpenTelemetry.
La entrega y recepción de webhooks expone a ataques SSRF/DNS-rebinding, repetición de peticiones, canales laterales temporales y fuga de secretos HMAC.
3. Instalación Rápida#
Paquete principal: EricksonLopez.Webhooks
dotnet add package EricksonLopez.Webhooks --version 1.0.0<PackageReference Include="EricksonLopez.Webhooks" Version="1.0.0" /><PackageVersion Include="EricksonLopez.Webhooks" Version="1.0.0" />4. Métricas Verificadas del Ecosistema#
Instantánea recuperada UTC: 2026-12-01
5. Cuándo Usar y Cuándo NO Usar#
Cuándo usar
- Envías o recibes webhooks firmados y necesitas defensa SSRF en socket, verificación HMAC en tiempo constante, anti-replay y DLQ en Redis.
Cuándo NO usar
- Te comunicas únicamente entre servicios internos mediante un broker AMQP/Kafka; usa EricksonLopez.Messaging.
6. Capacidades Principales e Invariantes de Diseño#
Defensa SSRF en Socket y Tiempo Constante
SafeSocketsHttpHandler valida IPs resueltas en ConnectCallback; WebhookSigner usa CryptographicOperations.FixedTimeEquals.
Anti-Replay, DLQ y Esquemas de Pago
TimestampedWebhookVerifier, redacción WebhookSecret, almacenes Redis replay/DLQ y middleware receptor ASP.NET Core.
7. Paquetes NuGet y Adaptadores Incluidos#
| ID del Paquete | Estado | NuGet / Local | TFMs | Estado AOT | Descargas | Descripción |
|---|---|---|---|---|---|---|
| EricksonLopez.WebhooksPrincipal | Publicado | v1.0.0 / v2.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 168 | Enterprise-grade webhook delivery engine for .NET. Features HMAC-SHA256 request signing, anti-replay timestamps, exponential backoff with jitter, dead-letter queue (DLQ) support, and Native AOT compatibility. |
| EricksonLopez.Webhooks.AspNetCore | Publicado | v1.0.0 / v2.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 133 | ASP.NET Core integration for receiving and cryptographically verifying inbound webhooks. Protects against replay attacks, enforces HMAC-SHA256 signature verification, and integrates with Minimal APIs and Controllers. |
| EricksonLopez.Webhooks.Redis | Publicado | v1.0.0 / v2.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 131 | Redis-backed distributed replay detector and persistent dead-letter queue (DLQ) provider for EricksonLopez.Webhooks. |
| EricksonLopez.Webhooks.PaymentGateways | No publicado | — / v2.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 0 | Cryptographic inbound webhook signature verification schemes for Stripe, CardNet, Azul, PayPal, Binance Pay, and Meta WhatsApp with anti-replay protection and Native AOT compatibility. |
8. Ejemplo Quick Start#
Basado en APIs públicas verificadas de EricksonLopez.Webhooks. Compila con `<ImplicitUsings>disable</ImplicitUsings>` e importaciones explícitas.
using System;
using EricksonLopez.Webhooks;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddWebhooks(options =>
{
options.Timeout = TimeSpan.FromSeconds(10);
options.MaxPayloadSizeBytes = 10 * 1024 * 1024;
options.EnableSsrfProtection = true;
options.Protocol = WebhookSenderProtocol.EricksonLopez;
});9. Arquitectura y Flujo de Dependencias#
Renderizando diagrama…
flowchart LR lib_webhooks["EricksonLopez.Webhooks (L3)"] lib_result["EricksonLopez.Result (L0)"] lib_webhooks --> lib_result lib_security["EricksonLopez.Security (L3)"] lib_webhooks --> lib_security
Ver descripción textual y tabla accesible
2 dependencias hacia librerías aguas arriba y 0 librerías dependientes aguas abajo verificadas en dependencies.json.
| Dirección | Librería | Nivel | Tipos de Relación |
|---|---|---|---|
| Aguas arriba | EricksonLopez.Result | L0 | Tiempo de compilación, Paquete NuGet |
| Aguas arriba | EricksonLopez.Security | L3 | Tiempo de compilación, Paquete NuGet |
flowchart LR
lib_webhooks["EricksonLopez.Webhooks (L3)"]
lib_result["EricksonLopez.Result (L0)"]
lib_webhooks --> lib_result
lib_security["EricksonLopez.Security (L3)"]
lib_webhooks --> lib_security10. Target Frameworks y Matriz Native AOT / Trimming#
Inspección MSBuild `.csproj` sobre 4 paquetes: 4 Full, 0 Partial, 0 Incompatible, 0 NotApplicable (analizadores/generadores).
| ID del Paquete | IsAotCompatible | EnableTrimAnalyzer | Estado AOT Verificado | Target Frameworks |
|---|---|---|---|---|
| EricksonLopez.Webhooks | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Webhooks.AspNetCore | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Webhooks.Redis | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Webhooks.PaymentGateways | true | true | Full | net8.0, net9.0, net10.0 |
11. Dependencias Aguas Arriba y Dependientes Aguas Abajo#
Dependencias Aguas Arriba (2)
Dependientes Aguas Abajo (0)
Ninguna otra librería EricksonLopez.* depende actualmente de esta familia.
12. Adaptadores Opcionales e Integraciones Externas#
Aristas de Adaptadores Internos y Paquetes de Integración
No se registran aristas de adaptadores opcionales ni paquetes de integración para esta librería.
Dependencias NuGet Externas Verificadas (6)
13. Resumen de Configuración y Registro en DI#
Puntos de Entrada DI y Configuración Verificados
WebhookServiceCollectionExtensions.AddWebhooksRegisters the `IWebhookSender` and supporting infrastructure into the dependency injection container.
WebhookAspNetCoreExtensions.AddInMemoryReplayDetectorRegisters the `InMemoryWebhookReplayDetector` to protect against replay attacks in single-node environments.
WebhookAspNetCoreExtensions.AddWebhookReceiverRegisters the `IWebhookValidator` and receiver options into the service collection.
WebhookAspNetCoreExtensions.UseWebhookReceiverAdds the `WebhookReceiverMiddleware` to the application request pipeline.
WebhookReceiverOptions.AddSecretAdds an active secret key to `SecretKeys` to support cryptographic key rotation.
PaymentGatewayWebhookServiceCollectionExtensions.AddPaymentGatewayWebhookSchemesRegisters `ITimestampedWebhookVerifier` and built-in `IWebhookSignatureScheme` implementations (`StripeWebhookSignatureScheme`, `CardNetWebhookSignatureScheme`, `AzulWebhookSignatureScheme`, `PayPalWebhookSignatureScheme`, `BinancePayWebhookSignatureScheme`, and `MetaWhatsAppWebhookSignatureScheme`).
RedisWebhookServiceCollectionExtensions.AddRedisWebhookDeadLetterSinkRegisters a distributed, Redis-backed dead-letter queue sink into the service collection.
RedisWebhookServiceCollectionExtensions.AddRedisWebhookReplayDetectorRegisters a distributed, Redis-backed webhook replay detector into the service collection.
Tipos Públicos y Contratos Clave
EricksonLopez.Webhooks.ITimestampedWebhookVerifier (interface)Defines a cryptographic verifier for inbound webhooks that binds the delivery timestamp directly into the HMAC-SHA256 signature input (`"{timestamp}.{rawPayload}"`), compares digests in constant time, enforces a drift window, and optionally records nonces in a replay store.
EricksonLopez.Webhooks.IWebhookDeadLetterSink (interface)Defines a storage contract for failed, unrecoverable webhook deliveries that have exceeded retry limits.
EricksonLopez.Webhooks.IWebhookReplayDetector (interface)Defines a contract for detecting and preventing replay attacks by tracking processed webhook message identifiers.
EricksonLopez.Webhooks.IWebhookSender (interface)Defines outbound webhook delivery capabilities with cryptographic signing and automated retry management.
EricksonLopez.Webhooks.InMemoryWebhookDeadLetterSink (class)Represents an in-memory thread-safe bounded dead-letter sink for development and testing environments.
EricksonLopez.Webhooks.InMemoryWebhookReplayDetector (class)Represents an in-memory replay attack detector for single-node webhook processing.
EricksonLopez.Webhooks.NoOpWebhookDeadLetterSink (class)Represents a dead-letter sink that silently discards failed messages without persistence.
EricksonLopez.Webhooks.TimestampedWebhookVerifier (class)Verifies inbound webhook payloads using timestamp-bound HMAC-SHA256 (`"{timestamp}.{rawPayload}"`), `CryptographicOperations.FixedTimeEquals`, configurable clock-skew tolerance, and optional `IWebhookReplayDetector` deduplication.
EricksonLopez.Webhooks.WebhookDeliveryResult (record)Represents the outcome and diagnostic telemetry of a webhook transmission attempt.
EricksonLopez.Webhooks.WebhookDiagnostics (class)Provides diagnostic sources, telemetry meters, and activity sources for distributed tracing and observability.
EricksonLopez.Webhooks.WebhookErrors (class)Provides factory methods for constructing strongly-typed domain errors for webhook operations.
EricksonLopez.Webhooks.WebhookHeaders (class)Defines standard HTTP header constants used in enterprise webhook transmission and signature verification.
14. Benchmarks de Rendimiento Verificados#
Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).
| Suite | Método | Runtime | Media (ns) | Asignado (B) | Estado |
|---|---|---|---|---|---|
| WebhookSignerBenchmarks | ComputeSignature_SmallPayload | .NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 281,300 | 0 | measured |
| WebhookSignerBenchmarks | ComputeSignature_MediumPayload | .NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 290,100 | 0 | measured |
| WebhookSignerBenchmarks | VerifySignature_ConstantTime | .NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 754,700 | 0 | measured |
| DeadLetterSinkBenchmarks | DeadLetterSink_EnqueueAsync | .NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 2,862,000 | 0 | measured |
| WebhookSenderBenchmarks | WebhookSender_SendAsync_Success | .NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 171,800,000 | 15,749 | measured |
15. Historial de Versiones y Estado NuGet vs Repositorio#
Desfase de versiones detectado: la última versión publicada en NuGet.org es v1.0.0, mientras el HEAD del repositorio local está en v2.1.0.
| Versión | Origen | Fecha de Publicación | Resumen |
|---|---|---|---|
| v1.0.0 ↗ | github | 2026-09-24 | Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.Webhooks` | `1.0.0` | | `EricksonLopez.Webhooks.AspNetCore` | `1.0.0` | | `EricksonLopez.Webhooks.Redis` | `1.0.0` | --- For detailed changes, see [CHANGELOG.md](https://github.com/ericksonlopezf/dotnet-webhooks/blob/v1.0.0/CHANGELOG.md). |
| v1.0.0 ↗ | nuget | 2026-09-24 | Published EricksonLopez.Webhooks 1.0.0 to NuGet.org. |
16. Librerías Complementarias y Relacionadas#
Librerías en el mismo nivel, capa arquitectónica o vinculadas directamente mediante aristas de dependencia.
17. Documentación, API Reference y Enlaces del Portal#
Documentación Conceptual (Starlight) →
Referencia de API XML Extraída →
5 namespaces · 44 tipos · 180 miembros
Mapa de Dependencias del Ecosistema →
Centro de Aprendizaje y Manual →
Las páginas conceptuales por librería en Starlight se completan en M4; las páginas de API Reference en M3.2.
18. Repositorio Fuente, Licencia y Contribución#
Publicado bajo Licencia MIT. Todos los ensamblados cumplen los invariantes de compilación EricksonLopez.*: importaciones explícitas, firma fuerte (`EricksonLopez.snk`) y metadatos de autor en ASCII (`Erickson Lopez`).
19. Resolución de Problemas, Riesgos y Migración#
- Mantén EnableSsrfProtection=true en producción para bloquear rangos loopback, link-local y redes privadas RFC 1918.
- Desfase de versiones detectado: la última versión publicada en NuGet.org es v1.0.0, mientras el HEAD del repositorio local está en v2.1.0.
20. Evidencia de Calidad y Verificación#
- Firma Fuerte (`EricksonLopez.snk`)
- EricksonLopez.snk
- `ImplicitUsings=disable`
- disable
- Extracción de Documentación XML
- Verificado (5 namespaces, 44 tipos, 180 miembros)
- Atributos MSBuild AOT / Trimming
- 4 Full / 0 Partial / 0 Incompatible / 0 N/A
- Artefactos BenchmarkDotNet
- 5 total (5 measured, 0 na_error)
Límites Explícitos de Verificación y Alcance
- Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).
- 1 no publicados