Package com.authlete.sd
Class SDJWT
- java.lang.Object
-
- com.authlete.sd.SDJWT
-
public class SDJWT extends Object
A class that represents SD-JWT.Instances of this class are immutable. References to
Disclosureinstances given to the constructor are internally copied and thegetDisclosures()method returns the copied list as an unmodifiable list.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description SDJWT(String credentialJwt, Collection<Disclosure> disclosures)Constructor with a credential JWT and disclosures.SDJWT(String credentialJwt, Collection<Disclosure> disclosures, String bindingJwt)Constructor with a credential JWT, disclosures and a binding JWT.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetBindingJwt()Get the binding JWT, which is the JWT placed optionally at the end of SD-JWT.StringgetCredentialJwt()Get the credential JWT, which is the JWT placed at the head of SD-JWT.List<Disclosure>getDisclosures()Get the list of disclosures.static SDJWTparse(String input)Parse the given string as SD-JWT.StringtoString()Get the string representation of this SD-JWT.
-
-
-
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}]
-
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
SDJWTinstance created as a result of parsing the input string.
-
-