Package com.codahale.passpol
Interface BreachDatabase
-
public interface BreachDatabaseA database of passwords found in data breaches.
-
-
Method Summary
Modifier and Type Method Description static BreachDatabaseanyOf(BreachDatabase... databases)Returns a database which checks the given databases in order.booleancontains(java.lang.String password)Returns whether or not the database contains the given password.static BreachDatabasehaveIBeenPwned()A client for Have I Been Pwned's online password checking.static BreachDatabasehaveIBeenPwned(int threshold)A client for Have I Been Pwned's online password checking.static BreachDatabasehaveIBeenPwned(java.net.http.HttpClient client, int threshold)A client for Have I Been Pwned's online password checking.static BreachDatabasepasswordSet(java.util.Collection<java.lang.String> passwords)Returns an offline database of the given passwords.static BreachDatabasetop100K()Returns an offline database of the 100,000 most common passwords.
-
-
-
Method Detail
-
contains
boolean contains(java.lang.String password) throws java.io.IOExceptionReturns whether or not the database contains the given password.- Parameters:
password- a candidate password- Returns:
trueif the database containspassword- Throws:
java.io.IOException- if there was a problem communicating with the database
-
haveIBeenPwned
static BreachDatabase haveIBeenPwned()
A client for Have I Been Pwned's online password checking. Uses a k-anonymous API which transmits only 20 bits of a password hash.- Returns:
- an online database of breached passwords
-
haveIBeenPwned
static BreachDatabase haveIBeenPwned(int threshold)
A client for Have I Been Pwned's online password checking. Uses a k-anonymous API which transmits only 20 bits of a password hash.- Parameters:
threshold- The number of breaches a password can be found in which makes it invalid.- Returns:
- an online database of breached passwords
-
haveIBeenPwned
static BreachDatabase haveIBeenPwned(java.net.http.HttpClient client, int threshold)
A client for Have I Been Pwned's online password checking. Uses a k-anonymous API which transmits only 20 bits of a password hash.- Parameters:
client- The HTTP client to usethreshold- The number of breaches a password can be found in which makes it invalid.- Returns:
- an online database of breached passwords
-
passwordSet
static BreachDatabase passwordSet(java.util.Collection<java.lang.String> passwords)
Returns an offline database of the given passwords.- Parameters:
passwords- a collection of unusable passwords- Returns:
- an offline database of the given passwords
-
top100K
static BreachDatabase top100K()
Returns an offline database of the 100,000 most common passwords.- Returns:
- an offline database of the 100,000 most common passwords
-
anyOf
static BreachDatabase anyOf(BreachDatabase... databases)
Returns a database which checks the given databases in order.- Parameters:
databases- a set of databases- Returns:
- a database which checks the given databases in order
-
-