Interface PasswordStore

All Known Implementing Classes:
BasicPasswordManager

@NullMarked public interface PasswordStore
Represents a class which can manage a password value.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Check whether the input password is correct.
    @Nullable String
    Get the current password.
    void
    Reload the password from disk.
    void
    setNewPassword(@Nullable String password)
    Set a new password and write it to disk.
  • Method Details

    • reload

      void reload() throws IOException
      Reload the password from disk.
      Throws:
      IOException - if an exception occurs while reading the file
    • getCurrentPassword

      @Nullable String getCurrentPassword()
      Get the current password.
      Returns:
      password, or null if none set
    • checkPassword

      boolean checkPassword(String input)
      Check whether the input password is correct.
      Parameters:
      input - the input password
      Returns:
      if the input matches the password, or true if no password is set
    • setNewPassword

      void setNewPassword(@Nullable String password) throws IOException
      Set a new password and write it to disk.
      Parameters:
      password - the new password, or null to unset the password
      Throws:
      IOException - if an exception occurs while writing to the file