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
                    
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="APF.HmacValidator" Version="7.1.1.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="APF.HmacValidator" Version="7.1.1.10" />
                    
Directory.Packages.props
<PackageReference Include="APF.HmacValidator" />
                    
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 APF.HmacValidator --version 7.1.1.10
                    
#r "nuget: APF.HmacValidator, 7.1.1.10"
                    
#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 APF.HmacValidator@7.1.1.10
                    
#: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=APF.HmacValidator&version=7.1.1.10
                    
Install as a Cake Addin
#tool nuget:?package=APF.HmacValidator&version=7.1.1.10
                    
Install as a Cake Tool

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);
  • secretKey is your shared secret (base64-encoded)
  • Returns true if valid, false otherwise

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:

  1. Extracts specific fields from the deserialized object
  2. Orders them deterministically
  3. Converts values into a normalized string format
  4. Joins values using :
  5. Computes the HMAC-SHA256 hash
  6. Compares the result to the Signature field

Canonicalization Rules

Field Selection

Included fields:

  • EventCode
  • EventDateTime
  • All fields from EventBody

Excluded fields:

  • Signature
  • Version

Field Order

Field order is fixed and must match the model exactly.

Top-level fields:

  1. EventCode
  2. EventDateTime

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.0505)

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:

  1. Reconstruct the canonical string exactly as defined above
  2. Base64-decode your shared secret
  3. Compute:
HMAC-SHA256(canonical_string, decoded_key)
  1. Base64-encode the result
  2. Compare it to the Signature field

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 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. 
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
7.1.1.10 162 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
Loading failed