diff --git a/src/main/java/com/apicatalog/vc/processor/Issuer.java b/src/main/java/com/apicatalog/vc/processor/Issuer.java index fccbd851..826e4876 100644 --- a/src/main/java/com/apicatalog/vc/processor/Issuer.java +++ b/src/main/java/com/apicatalog/vc/processor/Issuer.java @@ -174,10 +174,10 @@ JsonObject postCompact(final JsonObject source) { JsonObject compacted = source; // TODO use options - // make sure @context is the first key + // make sure @context is the first key and an array if (!compacted.keySet().iterator().next().equals(Keywords.CONTEXT)) { final JsonObjectBuilder builder = Json.createObjectBuilder() - .add(Keywords.CONTEXT, compacted.get(Keywords.CONTEXT)); + .add(Keywords.CONTEXT, JsonUtils.toJsonArray(compacted.get(Keywords.CONTEXT))); compacted.entrySet().stream() .filter(entry -> !Keywords.CONTEXT.equals(entry.getKey())) diff --git a/src/test/resources/com/apicatalog/vc/issuer/0201-out.jsonld b/src/test/resources/com/apicatalog/vc/issuer/0201-out.jsonld index 73050691..0ae184d5 100644 --- a/src/test/resources/com/apicatalog/vc/issuer/0201-out.jsonld +++ b/src/test/resources/com/apicatalog/vc/issuer/0201-out.jsonld @@ -1,5 +1,5 @@ { - "@context": "https://www.w3.org/ns/credentials/v2", + "@context": ["https://www.w3.org/ns/credentials/v2"], "id": "https://apicatalog/com/vc/test-credentials#0001", "type": "VerifiableCredential", "issuer": "https://github.com/filip26/iron-verifiable-credentials/issuer/1",