Skip to content

Commit 381a26b

Browse files
committed
fix: Better filtering of claims from credentialSubject.
1 parent a3676d2 commit 381a26b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/danubetech/verifiablecredentials/CredentialSubject.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.danubetech.verifiablecredentials;
22

33

4+
import com.apicatalog.jsonld.lang.Keywords;
45
import com.apicatalog.jsonld.loader.DocumentLoader;
56
import com.danubetech.verifiablecredentials.jsonld.VerifiableCredentialContexts;
67
import com.danubetech.verifiablecredentials.jsonld.VerifiableCredentialKeywords;
@@ -13,6 +14,7 @@
1314
import java.net.URI;
1415
import java.util.LinkedHashMap;
1516
import java.util.Map;
17+
import java.util.stream.Collectors;
1618

1719
public class CredentialSubject extends JsonLDObject {
1820

@@ -97,7 +99,9 @@ public static void removeFromJsonLdObject(JsonLDObject jsonLdObject) {
9799

98100
public Map<String, Object> getClaims() {
99101
Map<String, Object> claims = new LinkedHashMap<>(this.getJsonObject());
102+
for (String key : claims.keySet()) if (Keywords.contains(key)) claims.remove(key);
100103
claims.remove(JsonLDKeywords.JSONLD_TERM_ID);
104+
claims.remove(JsonLDKeywords.JSONLD_TERM_TYPE);
101105
return claims;
102106
}
103107
}

0 commit comments

Comments
 (0)