Record Class HpkeOpenRequest

java.lang.Object
java.lang.Record
co.cryptoservice.sdk.HpkeOpenRequest
Record Components:
keyId - the server-held key's identifier
encapsulatedKey - the HPKE encapsulated key as hex
ciphertext - the ciphertext, as the server returned it
aead - the AEAD, or null for the server default
info - the HPKE info, or null
aad - additional authenticated data, or null
psk - the pre-shared key, or null
pskId - the pre-shared key identifier, or null

public record HpkeOpenRequest(String keyId, String encapsulatedKey, String ciphertext, HpkeAead aead, String info, String aad, String psk, String pskId) extends Record
The body of POST /v2/hpke/open.
  • Constructor Details

  • Method Details

    • of

      public static HpkeOpenRequest of(String keyId, String encapsulatedKey, String ciphertext)
      A request with only the required members; the optional ones are null.
      Parameters:
      keyId - the server-held key's identifier
      encapsulatedKey - the HPKE encapsulated key as hex
      ciphertext - the ciphertext, as the server returned it
      Returns:
      the request
    • withAead

      public HpkeOpenRequest withAead(HpkeAead aead)
      A copy with aead replaced.
      Parameters:
      aead - the AEAD, or null for the server default
      Returns:
      the new request
    • withInfo

      public HpkeOpenRequest withInfo(String info)
      A copy with info replaced.
      Parameters:
      info - the HPKE info, or null
      Returns:
      the new request
    • withAad

      public HpkeOpenRequest withAad(String aad)
      A copy with aad replaced.
      Parameters:
      aad - additional authenticated data, or null
      Returns:
      the new request
    • withPsk

      public HpkeOpenRequest withPsk(String psk)
      A copy with psk replaced.
      Parameters:
      psk - the pre-shared key, or null
      Returns:
      the new request
    • withPskId

      public HpkeOpenRequest withPskId(String pskId)
      A copy with pskId replaced.
      Parameters:
      pskId - the pre-shared key identifier, or null
      Returns:
      the new request
    • toString

      public String toString()
      Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted.
      Specified by:
      toString in class Record
      Returns:
      a description safe to log
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • keyId

      public String keyId()
      Returns the value of the keyId record component.
      Returns:
      the value of the keyId record component
    • encapsulatedKey

      public String encapsulatedKey()
      Returns the value of the encapsulatedKey record component.
      Returns:
      the value of the encapsulatedKey record component
    • ciphertext

      public String ciphertext()
      Returns the value of the ciphertext record component.
      Returns:
      the value of the ciphertext record component
    • aead

      public HpkeAead aead()
      Returns the value of the aead record component.
      Returns:
      the value of the aead record component
    • info

      public String info()
      Returns the value of the info record component.
      Returns:
      the value of the info record component
    • aad

      public String aad()
      Returns the value of the aad record component.
      Returns:
      the value of the aad record component
    • psk

      public String psk()
      Returns the value of the psk record component.
      Returns:
      the value of the psk record component
    • pskId

      public String pskId()
      Returns the value of the pskId record component.
      Returns:
      the value of the pskId record component