Class Disclosure

java.lang.Object
com.authlete.sd.Disclosure

public class Disclosure extends Object
A class that represents the "Disclosure" defined in the SD-JWT specification.

Instances of this class are immutable.

Example 1:

 // Parameters for the constructor.
 String salt       = "_26bc4LT-ac6q2KI6cBW5es";
 String claimName  = "family_name";
 Object claimValue = "Möbius";

 // Create a Disclosure instance with the parameters.
 Disclosure disclosure =
     new Disclosure(salt, claimName, claimValue);

 // Get the string representation of the disclosure.
 // disclosure.toString() returns the same result.
 String dc = disclosure.getDisclosure();

 // dc -> "WyJfMjZiYzRMVC1hYzZxMktJNmNCVzVlcyIsImZhbWlseV9uYW1lIiwiTcO2Yml1cyJd"
 

Example 2:

 // Parse a string representation of disclosure.
 Disclosure disclosure = Disclosure.parse(
     "WyI2cU1RdlJMNWhhaiIsICJmYW1pbHlfbmFtZSIsICJNw7ZiaXVzIl0");

 // Compute the digest of the disclosure with the default
 // hash algorithm ("sha-256"). disclosure.digest("sha-256")
 // returns the same result.
 String digest = disclosure().digest();

 // digest -> "uutlBuYeMDyjLLTpf6Jxi7yNkEF35jdyWMn9U7b_RYY"
 

Example 3:

 // Disclosure representing ["lklxF5jMYlGTPUovMNIvCA", "FR"].
 Disclosure disclosure = Disclosure.parse(
     "WyJsa2x4RjVqTVlsR1RQVW92TU5JdkNBIiwgIkZSIl0");

 // Create a Map that represents an array element.
 Map<String, Object> element = disclosure.toArrayElement();

 // element -> {"...":"w0I8EKcdCtUPkGCNUrfwVp2xEgNjtoIDlOxc9-PlOhs"}
 
Since:
1.0
See Also: