HaveIBeenPwned.Client
1.0.2
See the version list below for details.
dotnet add package HaveIBeenPwned.Client --version 1.0.2
NuGet\Install-Package HaveIBeenPwned.Client -Version 1.0.2
<PackageReference Include="HaveIBeenPwned.Client" Version="1.0.2" />
paket add HaveIBeenPwned.Client --version 1.0.2
#r "nuget: HaveIBeenPwned.Client, 1.0.2"
// Install HaveIBeenPwned.Client as a Cake Addin #addin nuget:?package=HaveIBeenPwned.Client&version=1.0.2 // Install HaveIBeenPwned.Client as a Cake Tool #tool nuget:?package=HaveIBeenPwned.Client&version=1.0.2
A .NET HTTP client for the "Have I Been Pwned" API.
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:
builder.Services.AddPwnedServices(
builder.Configuration.GetSection(nameof(HibpOptions)));
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
Configuration
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 Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Http.Polly (>= 5.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
- System.Net.Http.Json (>= 5.0.0)
-
net5.0
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Http.Polly (>= 5.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
- System.Net.Http.Json (>= 5.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HaveIBeenPwned.Client:
Package | Downloads |
---|---|
HaveIBeenPwned.Client.PollyExtensions
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 (1)
Showing the top 1 popular GitHub repositories that depend on HaveIBeenPwned.Client:
Repository | Stars |
---|---|
IEvangelist/learning-blazor
The application for the "Learning Blazor: Build Single Page Apps with WebAssembly and C#" O'Reilly Media book by David Pine.
|
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 33 | 11/14/2024 |
8.0.3 | 1,509 | 8/16/2024 |
8.0.2 | 130 | 5/2/2024 |
8.0.1 | 206 | 2/8/2024 |
8.0.0 | 322 | 11/16/2023 |
7.0.0 | 3,306 | 1/19/2023 |
2.0.2 | 5,580 | 3/11/2022 |
2.0.1 | 735 | 3/5/2022 |
2.0.0 | 3,827 | 11/25/2021 |
1.0.4 | 2,659 | 9/1/2021 |
1.0.4-preview2 | 226 | 9/1/2021 |
1.0.4-preview1 | 219 | 9/1/2021 |
1.0.4-preview | 224 | 9/1/2021 |
1.0.3 | 299 | 9/1/2021 |
1.0.2 | 310 | 9/1/2021 |
0.0.7 | 327 | 8/31/2021 |