techgaun / ex_pwned

Elixir client for haveibeenpwned.com
Apache License 2.0
25 stars 4 forks source link

Pwned Password API Support? #2

Closed Grantimus9 closed 6 years ago

Grantimus9 commented 6 years ago

Hello,

Do you have any intent to add support for checking if a password was in a breach using HIPB's new password checker API?

I think it'd add some great functionality, and would be useful for the Elixir community. I might see if I can work up a PR.

techgaun commented 6 years ago

@Grantimus9 would be great if you can make a PR. Otherwise, I can knock out this one over the weekend. Feel free to take this issue if you wanna work on it.

Grantimus9 commented 6 years ago

I'll take a stab at it.

The simple endpoint is being retired, so we'll be using the "range" one: https://haveibeenpwned.com/API/v2#PwnedPasswords

How about:

# returns true or false 
ExPwned.password_breached?(password) 

# Returns number of times this password appears in a breach. Zero +  
ExPwned.password_breached_count(password) 
techgaun commented 6 years ago

@Grantimus9 yep that sounds good to me :+1:

techgaun commented 6 years ago

closed by #3