55import com .danubetech .verifiablecredentials .jsonld .VerifiableCredentialKeywords ;
66import com .fasterxml .jackson .annotation .JsonCreator ;
77import foundation .identity .jsonld .JsonLDObject ;
8+ import foundation .identity .jsonld .JsonLDUtils ;
89import info .weboftrust .ldsignatures .LdProof ;
910
1011import java .io .Reader ;
@@ -33,6 +34,7 @@ protected VerifiablePresentation(Map<String, Object> jsonObject) {
3334
3435 public static class Builder <B extends Builder <B >> extends JsonLDObject .Builder <B > {
3536
37+ private URI holder ;
3638 private VerifiableCredential verifiableCredential ;
3739 private LdProof ldProof ;
3840
@@ -50,12 +52,18 @@ public VerifiablePresentation build() {
5052 super .build ();
5153
5254 // add JSON-LD properties
55+ if (this .holder != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , VerifiableCredentialKeywords .JSONLD_TERM_HOLDER , JsonLDUtils .uriToString (this .holder ));
5356 if (this .verifiableCredential != null ) this .verifiableCredential .addToJsonLDObject (this .jsonLdObject );
5457 if (this .ldProof != null ) this .ldProof .addToJsonLDObject (this .jsonLdObject );
5558
5659 return (VerifiablePresentation ) this .jsonLdObject ;
5760 }
5861
62+ public B holder (URI holder ) {
63+ this .holder = holder ;
64+ return (B ) this ;
65+ }
66+
5967 public B verifiableCredential (VerifiableCredential verifiableCredential ) {
6068 this .verifiableCredential = verifiableCredential ;
6169 return (B ) this ;
@@ -131,7 +139,10 @@ public static VerifiablePresentation fromVerifiableCredential(VerifiableCredenti
131139 * Getters
132140 */
133141
134- @ SuppressWarnings ("unchecked" )
142+ public URI getHolder () {
143+ return JsonLDUtils .stringToUri (JsonLDUtils .jsonLdGetStringOrObjectId (this .getJsonObject (), VerifiableCredentialKeywords .JSONLD_TERM_HOLDER ));
144+ }
145+
135146 public VerifiableCredential getVerifiableCredential () {
136147 return VerifiableCredential .getFromJsonLDObject (this );
137148 }
0 commit comments