Package com.io7m.idstore.model

# Interface IdPasswordAlgorithmType

All Known Implementing Classes:
  `IdPasswordAlgorithmPBKDF2HmacSHA256`, `IdPasswordAlgorithmRedacted`

public sealed interface IdPasswordAlgorithmType permits IdPasswordAlgorithmPBKDF2HmacSHA256, IdPasswordAlgorithmRedacted
The type of password hashing algorithms.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `check(String expectedHash, String receivedPassword, byte[] salt)`
  Check if the given plain text password matches the expected hash.
  `default IdPassword`
  `createHashed(String passwordText)`
  Create a hashed password with a random salt.
  `IdPassword`
  `createHashed(String passwordText, byte[] salt)`
  Create a hashed password.
  `String`
  `identifier()`

- ## Method Details

  - ### check

    boolean check(String expectedHash, String receivedPassword, byte[] salt) throws IdPasswordException
    Check if the given plain text password matches the expected hash.
    Parameters:
      `expectedHash` - The expected hexadecimal uppercase hash
      `receivedPassword` - The received plain text password
      `salt` - The salt value
    Returns:
      `true` if the password matches
    Throws:
      `IdPasswordException` - On internal errors such as missing algorithm support

  - ### createHashed

    IdPassword createHashed(String passwordText, byte[] salt) throws IdPasswordException
    Create a hashed password.
    Parameters:
      `passwordText` - The plain text password
      `salt` - A random salt value
    Returns:
      A hashed password
    Throws:
      `IdPasswordException` - On internal errors such as missing algorithm support

  - ### createHashed

    default IdPassword createHashed(String passwordText) throws IdPasswordException
    Create a hashed password with a random salt.
    Parameters:
      `passwordText` - The plain text password
    Returns:
      A hashed password
    Throws:
      `IdPasswordException` - On internal errors such as missing algorithm support

  - ### identifier

    String identifier()
    Returns:
      The password algorithm identifier