Class SDJWT


  • public class SDJWT
    extends Object
    A class that represents SD-JWT.

    Instances of this class are immutable. References to Disclosure instances given to the constructor are internally copied and the getDisclosures() method returns the copied list as an unmodifiable list.

    Since:
    1.2
    • Constructor Detail

      • SDJWT

        public SDJWT​(String credentialJwt,
                     Collection<Disclosure> disclosures)
        Constructor with a credential JWT and disclosures.
        Parameters:
        credentialJwt - A credential JWT. Must not be null.
        disclosures - Disclosures. May be null.
      • SDJWT

        public SDJWT​(String credentialJwt,
                     Collection<Disclosure> disclosures,
                     String bindingJwt)
        Constructor with a credential JWT, disclosures and a binding JWT.
        Parameters:
        credentialJwt - A credential JWT. Must not be null.
        disclosures - Disclosures. May be null.
        bindingJwt - A binding JWT. May be null.
    • Method Detail

      • toString

        public String toString()
        Get the string representation of this SD-JWT.

        The returned string has the following format.

         {Credential-JWT}~{Disclosure1}~...~{DisclosureN}~[{Binding-JWT}]
         
        Overrides:
        toString in class Object
        Returns:
        The string representation of this SD-JWT.
      • getCredentialJwt

        public String getCredentialJwt()
        Get the credential JWT, which is the JWT placed at the head of SD-JWT.
        Returns:
        The credential JWT.
      • getDisclosures

        public List<Disclosure> getDisclosures()
        Get the list of disclosures.
        Returns:
        The list of disclosures. The returned list is always non-null and unmodifiable.
      • getBindingJwt

        public String getBindingJwt()
        Get the binding JWT, which is the JWT placed optionally at the end of SD-JWT.
        Returns:
        The binding JWT. May be null.
      • parse

        public static SDJWT parse​(String input)
        Parse the given string as SD-JWT.

        The expected format of the input string is as follows.

         {Credential-JWT}~{Disclosure1}~...~{DisclosureN}~[{Binding-JWT}]
         
        Parameters:
        input - A string representing SD-JWT. If null is given, null is returned.
        Returns:
        An SDJWT instance created as a result of parsing the input string.