APF.HmacValidator
7.1.1.10
dotnet add package APF.HmacValidator --version 7.1.1.10
NuGet\Install-Package APF.HmacValidator -Version 7.1.1.10
<PackageReference Include="APF.HmacValidator" Version="7.1.1.10" />
<PackageVersion Include="APF.HmacValidator" Version="7.1.1.10" />
<PackageReference Include="APF.HmacValidator" />
paket add APF.HmacValidator --version 7.1.1.10
#r "nuget: APF.HmacValidator, 7.1.1.10"
#:package APF.HmacValidator@7.1.1.10
#addin nuget:?package=APF.HmacValidator&version=7.1.1.10
#tool nuget:?package=APF.HmacValidator&version=7.1.1.10
AndDone Webhook HMAC Validator
Overview
The AndDone Webhook HMAC Validator library provides a simple way to validate webhook payloads received from AndDone.
It verifies that the webhook data:
- Was sent by AndDone
- Has not been altered in transit
The library handles all canonicalization and HMAC computation internally. In most cases, no manual signature logic is required.
Installation
NuGet Package
Install via .NET CLI:
dotnet add package APF.HmacValidator
Or via Package Manager Console:
Install-Package APF.HmacValidator
NuGet Package: https://www.nuget.org/packages/APF.HmacValidator
Usage
1. Deserialize the Webhook Payload
Deserialize the incoming JSON payload into the provided model:
var webhook = JsonConvert.DeserializeObject<WebhookNotification<WebhookTransaction>>(json);
2. Validate the Signature
var validator = new HmacValidator();
var isValid = validator.ValidateHmac(webhook, secretKey);
secretKeyis your shared secret (base64-encoded)- Returns
trueif valid,falseotherwise
How It Works
This library validates the webhook by computing an HMAC-SHA256 hash over a canonical representation of the payload.
The signature is not based on the raw JSON body.
Instead, the library:
- Extracts specific fields from the deserialized object
- Orders them deterministically
- Converts values into a normalized string format
- Joins values using
: - Computes the HMAC-SHA256 hash
- Compares the result to the
Signaturefield
Canonicalization Rules
Field Selection
Included fields:
EventCodeEventDateTime- All fields from
EventBody
Excluded fields:
SignatureVersion
Field Order
Field order is fixed and must match the model exactly.
Top-level fields:
EventCodeEventDateTime
EventBody fields:
MerchantId
MerchantReference
TransactionId
TransactionDate
TimeZone
PSPReference
PaymentIntentId
PaymentMethod
TransactionStatus
TransactionOrigin
SettlementDate
MaskAccount
RoutingNumber
Amount
CardType
FirstName
LastName
AddressLine1
AddressLine2
City
State
Country
PostalCode
Success
ErrorMessage
ReasonCode
AccountToken
CreateAccountToken
QuoteKey (only if Version >= 2)
SubTotal (only if Version >= 2)
Value Formatting
- Values are converted to strings
- Values are joined using
: - Field names are not included
Formatting rules:
null→ empty value ("")- Booleans →
True/False - Numbers → normalized (e.g.,
505.0→505)
Important Notes
- The signature is not based on raw JSON
- JSON formatting, whitespace, and property order do not affect validation
- Validation depends on:
- exact field order
- consistent value formatting
Any deviation will result in a signature mismatch.
Manual Validation (Reference Only)
This library performs HMAC validation internally.
If you are not using this library, you must:
- Reconstruct the canonical string exactly as defined above
- Base64-decode your shared secret
- Compute:
HMAC-SHA256(canonical_string, decoded_key)
- Base64-encode the result
- Compare it to the
Signaturefield
Summary
Deserialize → Validate → Done
The library handles canonicalization and HMAC validation internally.
7.1.1.10
- Updated the Webhook OutboundPayment
- Updated the Webhook VendorManagement
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- Newtonsoft.Json (>= 13.0.3)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
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 |
|---|---|---|
| 7.1.1.10 | 161 | 7/7/2026 |
| 7.1.1.9 | 118 | 7/1/2026 |
| 7.1.1.8 | 895 | 11/10/2025 |
| 7.1.1.7 | 356 | 7/11/2025 |
| 7.1.1.6 | 598 | 6/13/2025 |
| 7.1.1.5 | 439 | 5/26/2025 |
| 7.1.1.4 | 282 | 5/19/2025 |
| 7.1.1.3 | 258 | 5/9/2025 |
| 7.1.1.2 | 986 | 3/28/2025 |
| 7.1.1.1 | 263 | 3/28/2025 |
| 7.1.1 | 288 | 3/28/2025 |
| 7.1.0.1 | 1,025 | 3/25/2025 |
| 7.1.0-Beta-04 | 221 | 3/20/2025 |
| 7.1.0-Beta-03 | 311 | 3/3/2025 |
| 7.1.0-Beta-02 | 262 | 3/3/2025 |
| 7.1.0-beta | 195 | 2/18/2025 |
| 7.0.0.7 | 1,136 | 7/17/2024 |
| 7.0.0.6 | 577 | 4/30/2024 |
| 7.0.0.5 | 303 | 4/30/2024 |
| 7.0.0.4 | 419 | 3/6/2024 |