From a7d0dc6180d38f5b1bfcb1fa8ab5aef6ec50878b Mon Sep 17 00:00:00 2001 From: Felix Dittrich Date: Fri, 7 Jun 2024 11:03:45 +0200 Subject: [PATCH] Add kid to DID VerificationMethod --- .../keydistribution/service/did/DidTrustListService.java | 1 + .../keydistribution/service/did/entity/DidTrustListEntry.java | 2 ++ .../keydistribution/service/DidTrustListServiceTest.java | 1 + 3 files changed, 4 insertions(+) diff --git a/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListService.java b/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListService.java index db2fcd5..4b192b6 100644 --- a/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListService.java +++ b/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListService.java @@ -360,6 +360,7 @@ private void addTrustListEntry(DidTrustList trustList, trustListEntry.setType("JsonWebKey2020"); trustListEntry.setId(specification.getEntryId( URLEncoder.encode(signerInformationEntity.getKid(), StandardCharsets.UTF_8))); + trustListEntry.setKid(URLEncoder.encode(signerInformationEntity.getKid(), StandardCharsets.UTF_8)); trustListEntry.setController(specification.getDocumentId(false)); trustListEntry.setPublicKeyJwk(publicKeyJwk); diff --git a/src/main/java/tng/trustnetwork/keydistribution/service/did/entity/DidTrustListEntry.java b/src/main/java/tng/trustnetwork/keydistribution/service/did/entity/DidTrustListEntry.java index d83b882..75c3c8d 100644 --- a/src/main/java/tng/trustnetwork/keydistribution/service/did/entity/DidTrustListEntry.java +++ b/src/main/java/tng/trustnetwork/keydistribution/service/did/entity/DidTrustListEntry.java @@ -37,6 +37,8 @@ public class DidTrustListEntry { private String id; + private String kid; + private String type; private String controller; diff --git a/src/test/java/tng/trustnetwork/keydistribution/service/DidTrustListServiceTest.java b/src/test/java/tng/trustnetwork/keydistribution/service/DidTrustListServiceTest.java index 2c332c2..f327257 100644 --- a/src/test/java/tng/trustnetwork/keydistribution/service/DidTrustListServiceTest.java +++ b/src/test/java/tng/trustnetwork/keydistribution/service/DidTrustListServiceTest.java @@ -511,6 +511,7 @@ private void assertVerificationMethod(Object in, String kid, X509Certificate dsc Assertions.assertEquals(parentDidId, jsonNode.get("controller")); Assertions.assertEquals(parentDidId + "#" + URLEncoder.encode(kid, StandardCharsets.UTF_8), jsonNode.get("id")); + Assertions.assertEquals(URLEncoder.encode(kid, StandardCharsets.UTF_8), jsonNode.get("kid")); LinkedHashMap publicKeyJwk = (LinkedHashMap) jsonNode.get("publicKeyJwk");