@@ -44,6 +44,9 @@ public static class Builder<B extends Builder<B>> extends JsonLDObject.Builder<B
4444 private URI verificationMethod ;
4545 private String proofPurpose ;
4646 private String previousProof ;
47+ private URI capability ;
48+ private List <URI > capabilityChains ;
49+ private String capabilityAction ;
4750 private String proofValue ;
4851 private String jws ;
4952
@@ -57,17 +60,49 @@ public DataIntegrityProof build() {
5760 super .build ();
5861
5962 // add JSON-LD properties
60- if (this .cryptosuite != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CRYPTOSUITE , this .cryptosuite );
61- if (this .created != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CREATED , JsonLDUtils .dateToString (this .created ));
62- if (this .expires != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_EXPIRES , JsonLDUtils .dateToString (this .expires ));
63- if (this .domain != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_DOMAIN , this .domain );
64- if (this .challenge != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CHALLENGE , this .challenge );
65- if (this .nonce != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_NONCE , this .nonce );
66- if (this .verificationMethod != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_VERIFICATIONMETHOD , JsonLDUtils .uriToString (this .verificationMethod ));
67- if (this .proofPurpose != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_PROOFPURPOSE , this .proofPurpose );
68- if (this .previousProof != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_PREVIOUSPROOF , this .previousProof );
69- if (this .proofValue != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_PROOFVALUE , this .proofValue );
70- if (this .jws != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_JWS , this .jws );
63+
64+ if (this .cryptosuite != null ) {
65+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CRYPTOSUITE , this .cryptosuite );
66+ }
67+ if (this .created != null ) {
68+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CREATED , JsonLDUtils .dateToString (this .created ));
69+ }
70+ if (this .expires != null ) {
71+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_EXPIRES , JsonLDUtils .dateToString (this .expires ));
72+ }
73+ if (this .domain != null ) {
74+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_DOMAIN , this .domain );
75+ }
76+ if (this .challenge != null ) {
77+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CHALLENGE , this .challenge );
78+ }
79+ if (this .nonce != null ) {
80+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_NONCE , this .nonce );
81+ }
82+ if (this .verificationMethod != null ) {
83+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_VERIFICATIONMETHOD , JsonLDUtils .uriToString (this .verificationMethod ));
84+ }
85+ if (this .proofPurpose != null ) {
86+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_PROOFPURPOSE , this .proofPurpose );
87+ }
88+ if (this .previousProof != null ) {
89+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_PREVIOUSPROOF , this .previousProof );
90+ }
91+ if (this .capability != null ) {
92+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CAPABILITY , JsonLDUtils .uriToString (this .capability ));
93+ }
94+ if (this .capabilityChains != null ) {
95+ JsonLDUtils .jsonLdAddAsJsonArray (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CAPABILITYCHAIN , this .capabilityChains .stream ().map (JsonLDUtils ::uriToString ).toList ());
96+ }
97+ if (this .capabilityAction != null ) {
98+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_CAPABILITYACTION , this .capabilityAction );
99+ }
100+ if (this .proofValue != null ) {
101+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_PROOFVALUE , this .proofValue );
102+ }
103+ if (this .jws != null ) {
104+ JsonLDUtils .jsonLdAdd (this .jsonLdObject , DataIntegrityKeywords .JSONLD_TERM_JWS , this .jws );
105+ }
71106
72107 return (DataIntegrityProof ) this .jsonLdObject ;
73108 }
@@ -117,6 +152,21 @@ public B previousProof(String previousProof) {
117152 return (B ) this ;
118153 }
119154
155+ public B capability (URI capability ) {
156+ this .capability = capability ;
157+ return (B ) this ;
158+ }
159+
160+ public B capabilityChains (List <URI > capabilityChains ) {
161+ this .capabilityChains = capabilityChains ;
162+ return (B ) this ;
163+ }
164+
165+ public B capabilityAction (String capabilityAction ) {
166+ this .capabilityAction = capabilityAction ;
167+ return (B ) this ;
168+ }
169+
120170 public B proofValue (String proofValue ) {
121171 this .proofValue = proofValue ;
122172 return (B ) this ;
@@ -216,6 +266,19 @@ public String getPreviousProof() {
216266 return JsonLDUtils .jsonLdGetString (this .getJsonObject (), DataIntegrityKeywords .JSONLD_TERM_PREVIOUSPROOF );
217267 }
218268
269+ public URI getCapability () {
270+ return JsonLDUtils .stringToUri (JsonLDUtils .jsonLdGetString (this .getJsonObject (), DataIntegrityKeywords .JSONLD_TERM_CAPABILITY ));
271+ }
272+
273+ public List <URI > getCapabilityChains () {
274+ List <Object > jsonArray = JsonLDUtils .jsonLdGetJsonArray (this .getJsonObject (), DataIntegrityKeywords .JSONLD_TERM_CAPABILITYCHAIN );
275+ return jsonArray == null ? null : jsonArray .stream ().map (String .class ::cast ).map (JsonLDUtils ::stringToUri ).toList ();
276+ }
277+
278+ public String getCapabilityAction () {
279+ return JsonLDUtils .jsonLdGetString (this .getJsonObject (), DataIntegrityKeywords .JSONLD_TERM_CAPABILITYACTION );
280+ }
281+
219282 public String getProofValue () {
220283 return JsonLDUtils .jsonLdGetString (this .getJsonObject (), DataIntegrityKeywords .JSONLD_TERM_PROOFVALUE );
221284 }
0 commit comments