diff --git a/artifacts/src/main/resources/context/dcp.jsonld b/artifacts/src/main/resources/context/dcp.jsonld index fb916cb..4bb858a 100644 --- a/artifacts/src/main/resources/context/dcp.jsonld +++ b/artifacts/src/main/resources/context/dcp.jsonld @@ -21,10 +21,15 @@ "@context": { "credentials": { "@id": "dcp:credentials", - "@container": "@set" + "@container": "@set", + "@type": "@json" + }, + "issuerPid": { + "@id": "dcp:issuerPid", + "@type": "@id" }, - "requestId": { - "@id": "dcp:requestId", + "holderPid": { + "@id": "dcp:holderPid", "@type": "@id" } } @@ -69,6 +74,10 @@ "CredentialRequestMessage": { "@id": "dcp:CredentialRequestMessage", "@context": { + "holderPid": { + "@id": "dcp:holderPid", + "@type": "@id" + }, "credentials": { "@id": "dcp:credentials", "@type": "@json" @@ -79,8 +88,12 @@ "CredentialStatus": { "@id": "dcp:CredentialStatus", "@context": { - "requestId": { - "@id": "dcp:requestId", + "holderPid": { + "@id": "dcp:holderPid", + "@type": "@id" + }, + "issuerPid": { + "@id": "dcp:issuerPid", "@type": "@id" }, "status": { diff --git a/artifacts/src/main/resources/issuance/credential-message-schema.json b/artifacts/src/main/resources/issuance/credential-message-schema.json index 9be03ee..b8e8a3d 100644 --- a/artifacts/src/main/resources/issuance/credential-message-schema.json +++ b/artifacts/src/main/resources/issuance/credential-message-schema.json @@ -21,14 +21,17 @@ "$ref": "https://w3id.org/dspace-dcp/v1.0/presentation/credential-message-schema.json#/definitions/CredentialContainer" } }, - "requestId": { + "issuerPid": { + "type": "string" + }, + "holderPid": { "type": "string" }, "credentialType": { "type": "string", "const": "CredentialMessage" }, - "format":{ + "format": { "type": "string" } }, @@ -36,7 +39,8 @@ "@context", "type", "credentials", - "requestId" + "issuerPid", + "holderPid" ] }, "CredentialContainer": { diff --git a/artifacts/src/main/resources/issuance/credential-request-message-schema.json b/artifacts/src/main/resources/issuance/credential-request-message-schema.json index 79667b1..d4b2555 100644 --- a/artifacts/src/main/resources/issuance/credential-request-message-schema.json +++ b/artifacts/src/main/resources/issuance/credential-request-message-schema.json @@ -18,6 +18,9 @@ "type": { "type": "string" }, + "holderPid": { + "type": "string" + }, "credentials": { "type": "array", "items": { @@ -39,6 +42,7 @@ }, "required": [ "@context", + "holderPid", "credentials", "type" ] diff --git a/artifacts/src/main/resources/issuance/credential-status-schema.json b/artifacts/src/main/resources/issuance/credential-status-schema.json index a0d64e3..ce584d6 100644 --- a/artifacts/src/main/resources/issuance/credential-status-schema.json +++ b/artifacts/src/main/resources/issuance/credential-status-schema.json @@ -12,7 +12,10 @@ "CredentialStatusClass": { "type": "object", "properties": { - "requestId": { + "issuerPid": { + "type": "string" + }, + "holderPid": { "type": "string" }, "status": { @@ -29,7 +32,8 @@ } }, "required": [ - "requestId", + "issuerPid", + "holderPid", "status", "type" ] diff --git a/artifacts/src/main/resources/issuance/example/credential-message.json b/artifacts/src/main/resources/issuance/example/credential-message.json index 6a0f96d..388d4f9 100644 --- a/artifacts/src/main/resources/issuance/example/credential-message.json +++ b/artifacts/src/main/resources/issuance/example/credential-message.json @@ -15,5 +15,6 @@ "format": "json-ld" } ], - "requestId": "requestId" + "issuerPid": "issuerPid", + "holderPid": "holderPid" } \ No newline at end of file diff --git a/artifacts/src/main/resources/issuance/example/credential-request-message.json b/artifacts/src/main/resources/issuance/example/credential-request-message.json index bca20a5..2af5b11 100644 --- a/artifacts/src/main/resources/issuance/example/credential-request-message.json +++ b/artifacts/src/main/resources/issuance/example/credential-request-message.json @@ -3,6 +3,7 @@ "https://w3id.org/dspace-dcp/v1.0/dcp.jsonld" ], "type": "CredentialRequestMessage", + "holderPid": "holderPid", "credentials": [ { "credentialType": "MembershipCredential", @@ -16,6 +17,5 @@ "credentialType": "Iso9001Credential", "format": "vcdm20_jose" } - ] } \ No newline at end of file diff --git a/artifacts/src/main/resources/issuance/example/credential-status.json b/artifacts/src/main/resources/issuance/example/credential-status.json index 2550cc8..f4ad973 100644 --- a/artifacts/src/main/resources/issuance/example/credential-status.json +++ b/artifacts/src/main/resources/issuance/example/credential-status.json @@ -3,6 +3,7 @@ "https://w3id.org/dspace-dcp/v1.0/dcp.jsonld" ], "type": "CredentialStatus", - "requestId": "requestId", + "issuerPid": "issuerPid", + "holderPid": "holderPid", "status": "RECEIVED" } \ No newline at end of file diff --git a/artifacts/src/test/java/org/eclipse/dcp/context/issuance/IssuanceContextTest.java b/artifacts/src/test/java/org/eclipse/dcp/context/issuance/IssuanceContextTest.java index d58309f..33a3e6d 100644 --- a/artifacts/src/test/java/org/eclipse/dcp/context/issuance/IssuanceContextTest.java +++ b/artifacts/src/test/java/org/eclipse/dcp/context/issuance/IssuanceContextTest.java @@ -29,6 +29,11 @@ void verifyCredentialRequestMessage() { verifyRoundTrip("/issuance/example/credential-request-message.json", "/issuance/credential-request-message-schema.json"); } + @Test + void verifyCredentialMessage() { + verifyRoundTrip("/issuance/example/credential-message.json", "/issuance/credential-message-schema.json"); + } + @Test void verifyCredentialOfferMessage() { verifyRoundTrip("/issuance/example/credential-offer-message.json", "/issuance/credential-offer-message-schema.json"); @@ -56,7 +61,8 @@ void verifyCredentialStatus_withStatus(String status) throws IOException { { "@context": ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"], "type": "CredentialStatus", - "requestId": "requestId", + "issuerPid": "issuerPid", + "holderPid": "holderPid", "status": "%s" }""".formatted(status); diff --git a/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialMessageSchemaTest.java b/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialMessageSchemaTest.java index 3102222..cef8a01 100644 --- a/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialMessageSchemaTest.java +++ b/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialMessageSchemaTest.java @@ -41,7 +41,8 @@ public class CredentialMessageSchemaTest extends AbstractSchemaTest { "format": "json-ld" } ], - "requestId": "requestId" + "issuerPid": "issuerPid", + "holderPid": "holderPid" }"""; private static final String INVALID_CREDENTIAL_MESSAGE = """ @@ -60,7 +61,8 @@ public class CredentialMessageSchemaTest extends AbstractSchemaTest { "format": "jwt" } ], - "requestId": "requestId" + "issuerPid": "issuerPid", + "holderPid": "holderPid" }"""; @@ -73,7 +75,8 @@ public class CredentialMessageSchemaTest extends AbstractSchemaTest { "format": "jwt" } ], - "requestId": "requestId" + "issuerPid": "issuerPid", + "holderPid": "holderPid" }"""; @Test @@ -81,7 +84,7 @@ void verifySchema() { assertThat(schema.validate(CREDENTIAL_MESSAGE_MESSAGE, JSON)).isEmpty(); assertThat(schema.validate(INVALID_CREDENTIAL_MESSAGE, JSON)) .extracting(this::errorExtractor) - .containsExactly(error("credentials", REQUIRED), error("requestId", REQUIRED)); + .containsExactly(error("credentials", REQUIRED), error("issuerPid", REQUIRED), error("holderPid", REQUIRED)); assertThat(schema.validate(INVALID_CREDENTIAL_MESSAGE_INVALID_CREDENTIAL_CONTAINER, JSON)) .extracting(this::errorExtractor) diff --git a/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialRequestMessageSchemaTest.java b/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialRequestMessageSchemaTest.java index 3589514..55c196e 100644 --- a/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialRequestMessageSchemaTest.java +++ b/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialRequestMessageSchemaTest.java @@ -24,6 +24,27 @@ public class CredentialRequestMessageSchemaTest extends AbstractSchemaTest { private static final String CREDENTIAL_REQUEST_MESSAGE = """ + { + "@context": ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"], + "type": "CredentialRequestMessage", + "holderPid": "holderPid", + "credentials": [ + { + "credentialType": "MembershipCredential", + "format": "vcdm11_jwt" + }, + { + "credentialType": "OrganizationCredential", + "format": "vcdm11_ld" + }, + { + "credentialType": "Iso9001Credential", + "format": "vcdm20_jose" + } + ] + }"""; + + private static final String INVALID_CREDENTIAL_REQUEST_MESSAGE_NO_HOLDER_REQUEST_ID = """ { "@context": ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"], "type": "CredentialRequestMessage", @@ -47,6 +68,7 @@ public class CredentialRequestMessageSchemaTest extends AbstractSchemaTest { { "@context": ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"], "type": "CredentialRequestMessage", + "holderPid": "holderPid", "credentials": [ { "credentialType": "MembershipCredential" @@ -66,6 +88,7 @@ public class CredentialRequestMessageSchemaTest extends AbstractSchemaTest { { "@context": ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"], "type": "CredentialRequestMessage", + "holderPid": "holderPid", "credentials": [ { "format": "vcdm11_ld" @@ -75,6 +98,7 @@ public class CredentialRequestMessageSchemaTest extends AbstractSchemaTest { private static final String INVALID_CREDENTIAL_REQUEST_MESSAGE_NO_TYPE_AND_CONTEXT = """ { + "holderPid": "holderPid", "credentials": [ { "credentialType": "MembershipCredential", @@ -87,6 +111,11 @@ public class CredentialRequestMessageSchemaTest extends AbstractSchemaTest { @Test void verifySchema() { assertThat(schema.validate(CREDENTIAL_REQUEST_MESSAGE, JSON)).isEmpty(); + + assertThat(schema.validate(INVALID_CREDENTIAL_REQUEST_MESSAGE_NO_HOLDER_REQUEST_ID, JSON)) + .extracting(this::errorExtractor) + .containsExactly(error("holderPid", REQUIRED)); + assertThat(schema.validate(INVALID_CREDENTIAL_REQUEST_MESSAGE_NO_FORMAT, JSON)) .extracting(this::errorExtractor) .containsExactly(error("format", REQUIRED)); diff --git a/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialStatusSchemaTest.java b/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialStatusSchemaTest.java index 6ac670b..bd4ef59 100644 --- a/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialStatusSchemaTest.java +++ b/artifacts/src/test/java/org/eclipse/dcp/schema/issuance/CredentialStatusSchemaTest.java @@ -29,7 +29,8 @@ public class CredentialStatusSchemaTest extends AbstractSchemaTest { { "@context": ["https://w3id.org/dspace-dcp/v1.0/dcp.jsonld"], "type": "CredentialStatus", - "requestId": "requestId", + "issuerPid": "issuerPid", + "holderPid": "holderPid", "status": "%s" }"""; @@ -41,7 +42,8 @@ public class CredentialStatusSchemaTest extends AbstractSchemaTest { private static final String INVALID_CREDENTIAL_STATUS_MESSAGE_NO_TYPE_AND_CONTEXT = """ { - "requestId": "requestId", + "issuerPid": "issuerPid", + "holderPid": "holderPid", "status": "RECEIVED" }"""; @@ -52,7 +54,7 @@ void verifySchema() { .containsExactly(error(null, ENUM)); assertThat(schema.validate(INVALID_CREDENTIAL_STATUS, JSON)) .extracting(this::errorExtractor) - .containsExactly(error("requestId", REQUIRED), error("status", REQUIRED)); + .containsExactly(error("issuerPid", REQUIRED), error("holderPid", REQUIRED), error("status", REQUIRED)); assertThat(schema.validate(INVALID_CREDENTIAL_STATUS_MESSAGE_NO_TYPE_AND_CONTEXT, JSON)) .hasSize(2) diff --git a/specifications/credential.issuance.protocol.md b/specifications/credential.issuance.protocol.md index cbd82a2..7d605b2 100644 --- a/specifications/credential.issuance.protocol.md +++ b/specifications/credential.issuance.protocol.md @@ -99,6 +99,7 @@ Self-Issued ID Token to provide the pre-authorization code to the issuer. | **Schema** | [JSON Schema](./resources/issuance/credential-request-message-schema.json) | | **Required** | - `@context`: Specifies a valid Json-Ld context ([[json-ld11]], sect. 3.1). | | | - `type`: A string specifying the `CredentialRequestMessage` type | +| | - `holderPid`: A string corresponding to the request id on the Holder side type | | | - `credentials`: a JSON array of objects, each containing a `format`, which is A JSON string
that describes the format of the credential to be issued
and a `type`: A JSON array of strings that specifies the VC type being requested | The following is a non-normative example of a `CredentialRequestMessage`: @@ -145,7 +146,8 @@ exact error code is implementation-specific. | **Schema** | [JSON Schema](./resources/issuance/credential-message-schema.json) | | **Required** | - `@context`: Specifies a valid Json-Ld context ([[json-ld11]], sect. 3.1) | | | - `type`: A string specifying the `Credential Message` type. | -| | - `requestId`: A string corresponding to the issuance request id. | +| | - `issuerPid`: A string corresponding to the issuance id on the Issuer side. | +| | - `holderPid`: A string corresponding to the issuance id on the Holder side. | | | - `credentials`: An array of [Credential Container](#credential-container) Json objects as defined in the following. | The following is a non-normative example of the [Credential Message](#credential-message) JSON body: @@ -279,13 +281,14 @@ with `Bearer` of the request. ### CredentialStatus -| | | -|--------------|-----------------------------------------------------------------------------| -| **Schema** | [JSON Schema](./resources/issuance/credential-status-schema.json) | -| **Required** | - `@context`: Specifies a valid Json-Ld context ([[json-ld11]], sect. 3.1). | -| | - `type`: A string specifying the `CredentialStatus` type | -| | - `requestId`: A string corresponding to the request id | -| | - `status`: A string with a value of `RECEIVED`, `REJECTED`, or `ISSUED` | +| | | +|--------------|-------------------------------------------------------------------------------------| +| **Schema** | [JSON Schema](./resources/issuance/credential-status-schema.json) | +| **Required** | - `@context`: Specifies a valid Json-Ld context ([[json-ld11]], sect. 3.1). | +| | - `type`: A string specifying the `CredentialStatus` type | +| | - `issuerPid`: A string corresponding to the issuance id on the Issuer side | +| | - `holderPid`: A string corresponding to the issuance id on the Holder side | +| | - `status`: A string with a value of `RECEIVED`, `REJECTED`, or `ISSUED` | The following is a non-normative example of a `CredentialStatus` response object: