Record Class HpkeSealRequest

java.lang.Object
java.lang.Record
co.cryptoservice.sdk.HpkeSealRequest
Record Components:
recipientPublicKey - the recipient's public key as hex
plaintext - the plaintext, as UTF-8 text
kem - the KEM, or null for the server default
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 HpkeSealRequest(String recipientPublicKey, String plaintext, HpkeKem kem, HpkeAead aead, String info, String aad, String psk, String pskId) extends Record
The body of POST /v2/hpke/seal.
  • Constructor Details

  • Method Details

    • of

      public static HpkeSealRequest of(String recipientPublicKey, String plaintext)
      A request with only the required members; the optional ones are null.
      Parameters:
      recipientPublicKey - the recipient's public key as hex
      plaintext - the plaintext, as UTF-8 text
      Returns:
      the request
    • withKem

      public HpkeSealRequest withKem(HpkeKem kem)
      A copy with kem replaced.
      Parameters:
      kem - the KEM, or null for the server default
      Returns:
      the new request
    • withAead

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

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

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

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

      public HpkeSealRequest 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.
    • recipientPublicKey

      public String recipientPublicKey()
      Returns the value of the recipientPublicKey record component.
      Returns:
      the value of the recipientPublicKey record component
    • plaintext

      public String plaintext()
      Returns the value of the plaintext record component.
      Returns:
      the value of the plaintext record component
    • kem

      public HpkeKem kem()
      Returns the value of the kem record component.
      Returns:
      the value of the kem 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