Record Class PasswordHashResult

java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.password.PasswordHashResult
Record Components:
encodedHash - self-describing envelope, never null or blank
credentialType - credential discriminator, always CredentialType.PASSWORD in Phase 1a
formatVersion - envelope format version that produced this result
algorithm - canonical algorithm identifier, e.g. "PBKDF2WithHmacSHA256"
providerId - logical provider identifier, e.g. "pbkdf2-jdk"
policyVersion - policy version in force when the hash was produced
pepperKeyId - optional pepper-key identifier; absent for the Phase-1a NoOpPepperService
parameters - defensive copy of the algorithm parameters that were applied (e.g. iteration count, salt length); never null, may be empty

public record PasswordHashResult(String encodedHash, CredentialType credentialType, int formatVersion, String algorithm, String providerId, int policyVersion, Optional<String> pepperKeyId, Map<String,String> parameters) extends Record
Immutable result of a password-hashing operation.

Carries everything required to round-trip the produced credential back through the verification pipeline without further policy lookups: the encoded envelope plus the discriminating metadata that was used to build it.

The toString() implementation never exposes encodedHash() or any KDF parameter values; only the non-sensitive shape is printed. The encoded envelope itself contains salt and inner hash material and must be treated as a credential derivative.

  • Constructor Details

    • PasswordHashResult

      public PasswordHashResult(String encodedHash, CredentialType credentialType, int formatVersion, String algorithm, String providerId, int policyVersion, Optional<String> pepperKeyId, Map<String,String> parameters)
      Creates an instance of a PasswordHashResult record class.
      Parameters:
      encodedHash - the value for the encodedHash record component
      credentialType - the value for the credentialType record component
      formatVersion - the value for the formatVersion record component
      algorithm - the value for the algorithm record component
      providerId - the value for the providerId record component
      policyVersion - the value for the policyVersion record component
      pepperKeyId - the value for the pepperKeyId record component
      parameters - the value for the parameters record component
  • Method Details

    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • encodedHash

      public String encodedHash()
      Returns the value of the encodedHash record component.
      Returns:
      the value of the encodedHash record component
    • credentialType

      public CredentialType credentialType()
      Returns the value of the credentialType record component.
      Returns:
      the value of the credentialType record component
    • formatVersion

      public int formatVersion()
      Returns the value of the formatVersion record component.
      Returns:
      the value of the formatVersion record component
    • algorithm

      public String algorithm()
      Returns the value of the algorithm record component.
      Returns:
      the value of the algorithm record component
    • providerId

      public String providerId()
      Returns the value of the providerId record component.
      Returns:
      the value of the providerId record component
    • policyVersion

      public int policyVersion()
      Returns the value of the policyVersion record component.
      Returns:
      the value of the policyVersion record component
    • pepperKeyId

      public Optional<String> pepperKeyId()
      Returns the value of the pepperKeyId record component.
      Returns:
      the value of the pepperKeyId record component
    • parameters

      public Map<String,String> parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component