SharpPwned.NET icon indicating copy to clipboard operation
SharpPwned.NET copied to clipboard

C# bindings for HiBP REST API

SharpPwned.NET

This library wraps HaveIBeenPwned.com v3 RESTful API in .NET Standard.

Remarks

HaveIBeenPwned.com API version 2 was superseded by version 3.

Breaking changes were introduced, which made version 2 unusable.

Main change was introduction of API key because of continuous abuse (Troy's blog post) of the HaveIBeenPwned service.

Paid API key can be obtained here.

Usage:

var client = new HaveIBeenPwnedRestClient(yourApiKey);
var response = await client.IsPasswordPwned("hunter2");
Console.WriteLine(response);

This will return a bool value, depending on if the password is indeed pwned.

using SharpPwned.NET.Model;

var client = new HaveIBeenPwnedRestClient(yourApiKey);
var response = await client.GetAccountBreaches("[email protected]");
foreach(Breach x in response)
	{
		Console.WriteLine(x.Domain);
	}

GetAccountBreaches will return a list Breach objects, each Breach represents a single breached site and holds values as Name, Domain, Account Count etc. For full list of values, visit API Documentation.

This project targets .NET Standard 2.1

Nuget Package:

PM> Install-Package SharpPwned.NET