Class PasswordPepperKey

java.lang.Object
com.revetsec.password.PasswordPepperKey

@Immutable public final class PasswordPepperKey extends Object
An application-owned, 32-byte Argon2id secret-input key identified by a non-secret ID. Keep the key outside the password-hash database. The supplied array is copied and remains caller-owned.
Since:
1.0.0
  • Method Details

    • fromBytes

      public static @NonNull PasswordPepperKey fromBytes(@NonNull String keyId, byte @NonNull [] keyBytes)
      Constructs a pepper key from 32 cryptographically random bytes.
      Parameters:
      keyId - stable 1–64 character ASCII key ID
      keyBytes - 32 secret bytes; borrowed only for this call and not modified
      Returns:
      a retained defensive copy
      Since:
      1.0.0
    • getKeyId

      Returns the identifier used to select this pepper key.
      Returns:
      non-secret key ID
      Since:
      1.0.0
    • toString

      Overrides:
      toString in class Object
      Returns:
      a fixed redacted description
      Since:
      1.0.0