HaveIBeenPwned.Client.Abstractions 1.0.0

.NET 5.0 .NET Standard 2.0
There is a newer version of this package available.
See the version list below for details.
Install-Package HaveIBeenPwned.Client.Abstractions -Version 1.0.0
dotnet add package HaveIBeenPwned.Client.Abstractions --version 1.0.0
<PackageReference Include="HaveIBeenPwned.Client.Abstractions" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HaveIBeenPwned.Client.Abstractions --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HaveIBeenPwned.Client.Abstractions, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install HaveIBeenPwned.Client.Abstractions as a Cake Addin
#addin nuget:?package=HaveIBeenPwned.Client.Abstractions&version=1.0.0

// Install HaveIBeenPwned.Client.Abstractions as a Cake Tool
#tool nuget:?package=HaveIBeenPwned.Client.Abstractions&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

';-- have i been pwned? — .NET HTTP Client logo.

build code analysis NuGet

A .NET HTTP client for the "have i been pwned" API service from Troy Hunt. This library is comprised of two packages:

  • HaveIBeenPwned.Client
  • HaveIBeenPwned.Client.Abstractions

Consumers of the API can use the abstractions for the models returned from the API, while server APIs can consume and wrap the client.

Get started

Install from the .NET CLI:

dotnet add package HaveIBeenPwned.Client

Alternatively add manually to your consuming .csproj:

<PackageReference Include="HaveIBeenPwned.Client" Version="{VersionNumber}" />

Or, install using the NuGet Package Manager:

Install-Package HaveIBeenPwned.Client

Dependency injection

To add all of the services to the dependency injection container, call one of the AddPwnedServices overloads. From Minimal APIs for example, with using a named configuration section:


From a ConfigureServices method, with an IConfiguration instance:

services.AddPwnedServices(options =>
        options.ApiKey = _configuration["HibpOptions:ApiKey"];
        options.UserAgent = _configuration["HibpOptions:UserAgent"];

Then you can require any of the available DI-ready types:

  • IPwnedBreachesClient: Breaches API.
  • IPwnedPastesClient: Pastes API.
  • IPwnedPasswordsClient: Pwned Passwords API.
  • IPwnedClient: Marker interface, for conveniently injecting all of the above clients into a single client.

Example Minimal APIs

Minimal APIs example code.


To configure the HaveIBeenPwned.Client, the following table identifies the well-known configuration object:

Well-known keys

Depending on the .NET configuration provider your app is using, there are several well-known keys that map to the HibpOptions that configure your usage of the HTTP client. When using environment variables, such as those in Azure App Service configuration or Azure Key Vault secrets, the following keys map to the HibpOption instance:

Key Data type Default value
HibpOptions__ApiKey string null
HibpOptions__UserAgent string ".NET HIBP Client/1.0"

The ApiKey is required, to get one — sign up here: https://haveibeenpwned.com/api/key

Example appsettings.json

  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
  "AllowedHosts": "*",
  "HibpOptions": {
    "ApiKey": "<YourApiKey>",
    "UserAgent": "<YourUserAgent>"

For more information, see JSON configuration provider.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net5.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on HaveIBeenPwned.Client.Abstractions:

Package Downloads

This is an unofficial .NET HTTP client library exposing various "Have I Been Pwned" APIs, including Breaches, Pastes, and of course Pwned Passwords.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 952 3/11/2022
2.0.1 139 3/5/2022
2.0.0 3,432 11/25/2021
1.0.4 781 9/1/2021
1.0.4-preview2 138 9/1/2021
1.0.0 190 9/1/2021