Interface BreachDatabase


  • public interface BreachDatabase
    A database of passwords found in data breaches.
    • Method Detail

      • contains

        boolean contains​(java.lang.String password)
                  throws java.io.IOException
        Returns whether or not the database contains the given password.
        Parameters:
        password - a candidate password
        Returns:
        true if the database contains password
        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 use
        threshold - 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