.NET consumer for the HaveIBeenPawned API
codewrinkles / codewrinkles.hibpclient Goto Github PK
View Code? Open in Web Editor NEW.NET consumer for the HaveIBeenPawned API
License: MIT License
.NET consumer for the HaveIBeenPawned API
License: MIT License
In order to be able to manually test the functionality and compatibility with different .NET versions we need to create some sample apps. For now I think we to take into consideration two scenarios:
Therefore, as part of this story:
Right now we don't need any functionality in the apps. We just need to have them set up.
When sending a request to the HIBP API to get a breach or a list of breaches, the API returns a response documented here: https://haveibeenpwned.com/API/v3
We need to create a class that models that response.
The HIBP API returns some error responses in certain scenarios. We need to have appropriate exceptions for each of the possible error response. The possible error response codes are documented here: https://haveibeenpwned.com/API/v3#ResponseCodes
The HibpClient
class will be the most important class in this project. It will grow presumably as we add support for each Hibp endpoint. But for now we need a basic skeleton for the class. There are several things you should keep in mind at this stage:
HttpClient
via .NET Core dependency injection, but also the possibility to create the HttpClient
by ourselves (if our library is used in a non DI .NET app). This means you should probably play around with constructorsHttpClient
by ourselves, me need to make sure we dispose it when the HibpClient is disposed.HibpClient
class should also support ILogger
. Also keep in mind that we'll either get the ILogger
via DI (like the HttpClient
) or we might need to create it ourselves. The Logger shouldn't be implemented as part of the story. Just make sure that HibpClient
has a field for itFor cases when consumers will use our app in a .NET application that doesn't support dependency injection, we need to be able to create ILogger
instances by ourselves.
As part of this story you need to implement a mechanism that can generate named ILoggers. Feel free to investigate and propose an approach that you find suitable.
When sending a request to the HIBP Pastes API, it returns a response documented here: https://haveibeenpwned.com/API/v3#PasteModel
We need to create a class that models the response.
Class should be named "Paste"
It should pe placed in the "Responses" folder
Properties should be implemented as per documentation
In the project there is already an empty HibpOptions
class.
The HIBP has some API level options that it specifies: for instance how to add the API key, custom headers and so on. The HIBP documentation is here: https://haveibeenpwned.com/API/v3
We will need this class to configure our HibpClient later.
Constants
class. We don't want to have strings scattered throughout the code base. All string constants need to be in one placeA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.