{"id":15650749,"url":"https://github.com/ievangelist/pwned-client","last_synced_at":"2025-10-04T19:15:55.900Z","repository":{"id":45869546,"uuid":"401539295","full_name":"IEvangelist/pwned-client","owner":"IEvangelist","description":"A .NET HTTP client library for the \"';-- Have I Been Pwned\" API: https://haveibeenpwned.com/api/v3","archived":false,"fork":false,"pushed_at":"2025-03-05T21:20:08.000Z","size":2053,"stargazers_count":34,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T21:16:18.221Z","etag":null,"topics":["csharp","dependency-injection","dotnet","hacktoberfest","hibp","hibp-api","hibpwned","http-client","pwned","pwned-api","pwned-passwords","pwnedpasswords"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IEvangelist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"IEvangelist","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2021-08-31T01:46:35.000Z","updated_at":"2025-01-14T04:01:52.000Z","dependencies_parsed_at":"2024-01-02T20:26:04.540Z","dependency_job_id":"14f2b054-764c-4510-a2e9-1a9c18a5be15","html_url":"https://github.com/IEvangelist/pwned-client","commit_stats":{"total_commits":111,"total_committers":7,"mean_commits":"15.857142857142858","dds":"0.36036036036036034","last_synced_commit":"c616aee618b58c1dc39f36e5277756ed0bb9241e"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpwned-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpwned-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpwned-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpwned-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IEvangelist","download_url":"https://codeload.github.com/IEvangelist/pwned-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248800113,"owners_count":21163404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dependency-injection","dotnet","hacktoberfest","hibp","hibp-api","hibpwned","http-client","pwned","pwned-api","pwned-passwords","pwnedpasswords"],"created_at":"2024-10-03T12:35:43.531Z","updated_at":"2025-10-04T19:15:50.796Z","avatar_url":"https://github.com/IEvangelist.png","language":"C#","funding_links":["https://github.com/sponsors/IEvangelist"],"categories":[],"sub_categories":[],"readme":"# ![';-- have i been pwned? — .NET HTTP client.](https://raw.githubusercontent.com/IEvangelist/pwned-client/main/assets/pwned-header.png)\n\n[![build](https://github.com/IEvangelist/pwned-client/actions/workflows/build-validation.yml/badge.svg)](https://github.com/IEvangelist/pwned-client/actions/workflows/build-validation.yml) [![code analysis](https://github.com/IEvangelist/pwned-client/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/IEvangelist/pwned-client/actions/workflows/codeql-analysis.yml) [![NuGet](https://img.shields.io/nuget/v/HaveIBeenPwned.Client.svg?style=flat)](https://www.nuget.org/packages/HaveIBeenPwned.Client) ![nuget downloads](https://img.shields.io/nuget/dt/HaveIBeenPwned.Client?color=blue\u0026label=nuget%20downloads\u0026logo=nuget) \n\n`HaveIBeenPwned.Client` is a .NET HTTP client for the \"have i been pwned\" API service from Troy Hunt. This library is comprised of three NuGet packages:\n\n- [`HaveIBeenPwned.Client`](https://www.nuget.org/packages/HaveIBeenPwned.Client)\n- [`HaveIBeenPwned.Client.Abstractions`](https://www.nuget.org/packages/HaveIBeenPwned.Client.Abstractions)\n- [`HaveIBeenPwned.Client.PollyExtensions`](https://www.nuget.org/packages/HaveIBeenPwned.Client.PollyExtensions)\n\n\u003e Consumers of the API can use the abstractions for the models returned from the API, while server APIs can consume and wrap the client.\n\n## Getting started\n\nInstall from the .NET CLI:\n\n```shell\ndotnet add package HaveIBeenPwned.Client\n```\n\nAlternatively add manually to your consuming _.csproj_:\n\n```xml\n\u003cPackageReference Include=\"HaveIBeenPwned.Client\" Version=\"{VersionNumber}\" /\u003e\n```\n\nOr, install using the NuGet Package Manager:\n\n```powershell\nInstall-Package HaveIBeenPwned.Client\n```\n\n### Dependency injection\n\nTo 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:\n\n```csharp\nbuilder.Services.AddPwnedServices(\n    builder.Configuration.GetSection(nameof(HibpOptions)));\n```\n\nFrom a `ConfigureServices` method, with an `IConfiguration` instance:\n\n```csharp\nservices.AddPwnedServices(options =\u003e\n    {\n        options.ApiKey = _configuration[\"HibpOptions:ApiKey\"];\n        options.UserAgent = _configuration[\"HibpOptions:UserAgent\"];\n    });\n```\n\nThen you can require any of the available DI-ready types:\n\n- `IPwnedBreachesClient`: [Breaches API](https://haveibeenpwned.com/API/v3#BreachesForAccount).\n- `IPwnedPastesClient`: [Pastes API](https://haveibeenpwned.com/API/v3#PastesForAccount).\n- `IPwnedPasswordsClient`: [Pwned Passwords API](https://haveibeenpwned.com/API/v3#PwnedPasswords).\n- `IPwnedClient`: Marker interface, for conveniently injecting all of the above clients into a single client.\n\n### Without dependency injection\n\nIf you're not using the DI approach, simply instantiate `PwnedClient` with your API key and use it as you see fit.\n\n```csharp\nIPwnedClient client = new PwnedClient(\"\u003cAPI Key\u003e\");\n// TODO: Use client...\n```\n\n### Example Minimal APIs\n\n![Minimal APIs example code.](https://raw.githubusercontent.com/IEvangelist/pwned-client/main/assets/minimal-api.svg)\n\n## Configuration\n\nTo configure the `HaveIBeenPwned.Client`, the following table identifies the well-known configuration object:\n\n### Well-known keys\n\nDepending on the [.NET configuration provider](https://docs.microsoft.com/dotnet/core/extensions/configuration-providers?WC.m_id=dapine) 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:\n\n| Key                      | Data type | Default value                              |\n|--------------------------|-----------|--------------------------------------------|\n| `HibpOptions__ApiKey`    | `string`  | `null`                                     |\n| `HibpOptions__UserAgent` | `string`  | `\".NET HIBP Client/{AssemblyFileVersion}\"` |\n\nThe `ApiKey` is required, to get one \u0026mdash; sign up here: \u003chttps://haveibeenpwned.com/api/key\u003e\n\n### Example `appsettings.json`\n\n```json\n{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Information\",\n      \"Microsoft\": \"Warning\",\n      \"Microsoft.Hosting.Lifetime\": \"Information\"\n    }\n  },\n  \"AllowedHosts\": \"*\",\n  \"HibpOptions\": {\n    \"ApiKey\": \"\u003cYourApiKey\u003e\",\n    \"UserAgent\": \"\u003cYourUserAgent\u003e\"\n  }\n}\n```\n\nFor more information, see [JSON configuration provider](https://docs.microsoft.com/dotnet/core/extensions/configuration-providers?WC.m_id=dapine#json-configuration-provider).\n\n\u003c!--\nNotes for tagging releases:\n  https://rehansaeed.com/the-easiest-way-to-version-nuget-packages/#minver\n\ngit tag -a 0.0.3 -m \"Build version 0.0.3\"\ngit push upstream --tags\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fievangelist%2Fpwned-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fievangelist%2Fpwned-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fievangelist%2Fpwned-client/lists"}