HumanAttestation 0.4.4

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

human-attestation

NuGet CI .NET License

Official HAP (Human Attestation Protocol) SDK for .NET.

HAP is an open standard for verified human effort. It enables Verification Authorities (VAs) to cryptographically attest that a sender took deliberate, costly action when communicating with a recipient.

Installation

dotnet add package HumanAttestation

Or via Package Manager:

Install-Package HumanAttestation

Quick Start

Verifying a Claim (For Recipients)

using BlueScroll.HumanAttestation;

using var verifier = new Verifier();

// Verify a claim from a HAP ID
var claim = await verifier.VerifyClaimAsync("hap_abc123xyz456", "ballista.jobs");

if (claim != null)
{
    // Check if not expired
    if (Verifier.IsClaimExpired(claim))
    {
        Console.WriteLine("Claim has expired");
        return;
    }

    // Verify it's for your organization
    if (!Verifier.IsClaimForRecipient(claim, "yourcompany.com"))
    {
        Console.WriteLine("Claim is for a different recipient");
        return;
    }

    Console.WriteLine($"Verified {claim.Method} application to {claim.To.Name}");
}

Verifying from a URL

// Extract HAP ID from a verification URL
var url = "https://www.ballista.jobs/v/hap_abc123xyz456";
var hapId = Verifier.ExtractIdFromUrl(url);

if (hapId != null)
{
    using var verifier = new Verifier();
    var claim = await verifier.VerifyClaimAsync(hapId, "ballista.jobs");
    // ... handle claim
}

Verifying Signature Manually

using var verifier = new Verifier();

// Fetch the claim
var response = await verifier.FetchClaimAsync("hap_abc123xyz456", "ballista.jobs");

if (response.Valid && response.Jws != null)
{
    // Verify the cryptographic signature
    var result = await verifier.VerifySignatureAsync(response.Jws, "ballista.jobs");

    if (result.Valid)
    {
        Console.WriteLine($"Signature verified! Claim: {result.Claim}");
    }
    else
    {
        Console.WriteLine($"Signature invalid: {result.Error}");
    }
}

Signing Claims (For Verification Authorities)

using BlueScroll.HumanAttestation;
using System.Text.Json;

// Generate a key pair (do this once, store securely)
var (privateKey, publicKey) = Signer.GenerateKeyPair();

// Export public key for /.well-known/hap.json
var jwk = Signer.ExportPublicKeyJwk(publicKey, "my_key_001");
var wellKnown = new WellKnown
{
    Issuer = "my-va.com",
    Keys = new List<Jwk> { jwk }
};
Console.WriteLine(JsonSerializer.Serialize(wellKnown, new JsonSerializerOptions { WriteIndented = true }));

// Create and sign a claim
var claim = Signer.CreateClaim(
    method: "physical_mail",
    description: "Priority mail packet with handwritten cover letter",
    recipientName: "Acme Corp",
    issuer: "my-va.com",
    domain: "acme.com",
    expiresInDays: 730, // 2 years
    cost: new ClaimCost { Amount = 1500, Currency = "USD" },
    time: 1800,
    physical: true
);

var jws = Signer.SignClaim(claim, privateKey, "my_key_001");
Console.WriteLine($"Signed JWS: {jws}");

API Reference

Verifier Class

Method Description
VerifyClaimAsync(hapId, issuer) Fetch and verify a claim, returns claim or null
FetchClaimAsync(hapId, issuer) Fetch raw verification response from VA
VerifySignatureAsync(jws, issuer) Verify JWS signature against VA's public keys
FetchPublicKeysAsync(issuer) Fetch VA's public keys from well-known endpoint
ExtractIdFromUrl(url) Extract HAP ID from verification URL (static)
IsClaimExpired(claim) Check if claim has passed expiration (static)
IsClaimForRecipient(claim, domain) Check if claim targets specific recipient (static)

HumanAttestation Class (Static Utilities)

Method Description
HumanAttestation.IsValidId(id) Check if string matches HAP ID format
HumanAttestation.GenerateId() Generate cryptographically secure HAP ID

Signer Class

Method Description
GenerateKeyPair() Generate Ed25519 key pair
ExportPublicKeyJwk(key, kid) Export public key as JWK
SignClaim(claim, privateKey, kid) Sign a claim, returns JWS
CreateClaim(...) Create claim with defaults

Types

using BlueScroll.HumanAttestation;

// Main types
Claim claim;
ClaimCost cost;
ClaimTarget target;

// Response types
VerificationResponse response;
WellKnown wellKnown;
Jwk jwk;

Requirements

  • .NET 8.0+

License

Apache-2.0

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
0.4.4 30 1/23/2026
0.4.2 31 1/22/2026
0.4.1 30 1/22/2026
0.3.7 31 1/22/2026
0.3.6 34 1/22/2026
0.3.5 28 1/22/2026
0.3.4 29 1/22/2026
0.3.3 34 1/22/2026
0.3.2 29 1/22/2026
0.3.1 28 1/22/2026
0.3.0 33 1/22/2026