From 26e779e43c32f593ac4ab026aee8a93dba1e6a4c Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Mon, 10 Jun 2024 12:47:43 +0530 Subject: [PATCH 01/10] chore!: issue membership, framework and dismantler VC API removed along with Summary VC support --- README.md | 5 - .../IssuersCredentialControllerApiDocs.java | 588 ------------------ .../config/ExceptionHandling.java | 15 - .../config/MIWSettings.java | 6 +- .../config/security/SecurityConfig.java | 5 +- .../constant/MIWVerifiableCredentialType.java | 48 -- .../constant/RestURI.java | 27 +- .../constant/StringPool.java | 18 +- .../IssuersCredentialController.java | 54 -- .../controller/PresentationController.java | 2 - .../dto/IssueDismantlerCredentialRequest.java | 52 -- .../dto/IssueFrameworkCredentialRequest.java | 62 -- .../dto/IssueMembershipCredentialRequest.java | 51 -- .../DuplicateSummaryCredentialProblem.java | 63 -- .../service/IssuersCredentialService.java | 400 ------------ miw/src/main/resources/application.yaml | 3 - .../service/IssuersCredentialServiceTest.java | 43 +- .../utils/TestUtils.java | 57 -- .../vc/DismantlerHoldersCredentialTest.java | 250 -------- .../vc/FrameworkHoldersCredentialTest.java | 252 -------- .../vc/HoldersCredentialTest.java | 71 +-- .../vc/IssuersCredentialTest.java | 87 +-- .../vc/MembershipHoldersCredentialTest.java | 382 ------------ .../vc/PresentationValidationTest.java | 9 +- .../vp/PresentationServiceTest.java | 13 +- .../vp/PresentationTest.java | 12 +- .../wallet/WalletTest.java | 7 - 27 files changed, 65 insertions(+), 2517 deletions(-) delete mode 100644 miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/MIWVerifiableCredentialType.java delete mode 100644 miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java delete mode 100644 miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java delete mode 100644 miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java delete mode 100644 miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/exception/DuplicateSummaryCredentialProblem.java delete mode 100644 miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/DismantlerHoldersCredentialTest.java delete mode 100644 miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/FrameworkHoldersCredentialTest.java delete mode 100644 miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java diff --git a/README.md b/README.md index 25f6e815e..df4bdf8c3 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,6 @@ Overview by Endpoint | **Verfiable Credential - Validation** | Create | POST | /api/credentials/validation | **view_wallets** OR
**view_wallet** | | | **Verfiable Credential - Issuer** | Read | GET | /api/credentials/issuer | **view_wallets** | | | **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer | **update_wallets** | | -| **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer/membership | **update_wallets** | | -| **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer/framework | **update_wallets** | | -| **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer/distmantler | **update_wallets** | | | **DIDDocument** | Read | GET | /{bpn}/did.json | N/A | | | **DIDDocument** | Read | GET | /api/didDocuments/{identifier} | N/A | | @@ -309,9 +306,7 @@ This process ensures that any issues with the database schema are resolved by re | KEYCLOAK_REALM | Realm name of keycloak | miw_test | | KEYCLOAK_CLIENT_ID | Keycloak private client id | | | AUTH_SERVER_URL | Keycloak server url | | -| SUPPORTED_FRAMEWORK_VC_TYPES | Supported framework VC, provide values ie type1=value1,type2=value2 | cx-behavior-twin=Behavior Twin,cx-pcf=PCF,cx-quality=Quality,cx-resiliency=Resiliency,cx-sustainability=Sustainability,cx-traceability=ID_3.0_Trace | | ENFORCE_HTTPS_IN_DID_RESOLUTION | Enforce https during web did resolution | true | -| CONTRACT_TEMPLATES_URL | Contract templates URL used in summary VC | https://public.catena-x.org/contracts/ | | APP_LOG_LEVEL | Log level of application | INFO | | AUTHORITY_SIGNING_SERVICE_TYPE | Base wallet signing type, Currency only LOCAL is supported | Local | | LOCAL_SIGNING_KEY_STORAGE_TYPE | Key storage type, currently only DB is supported | DB | diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java index 490c2c989..6f8571efe 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java @@ -219,594 +219,6 @@ public class IssuersCredentialControllerApiDocs { public @interface GetCredentialsApiDocs { } - @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) - @RequestBody(content = { - @Content(examples = @ExampleObject(""" - { - "bpn": "BPNL000000000000" - } - """)) - }) - @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) - @ApiResponses(value = { - @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = { - @Content(examples = {}) }), - @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = { - @Content(examples = {}) }), - @ApiResponse(responseCode = "500", description = "Any other internal server error", content = { - @Content(examples = { - @ExampleObject(name = "Internal server error", value = """ - { - "type": "about:blank", - "title": "Error Title", - "status": 500, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - """) - }) }), - @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict.", content = { - @Content(examples = { - @ExampleObject(name = "MembershipCredential already exist", value = """ - { - "type": "about:blank", - "title": "Credential of type MembershipCredential is already exists ", - "status": 409, - "detail": "Credential of type MembershipCredential is already exists ", - "instance": "/api/credentials/issuer/membership", - "properties": { - "timestamp": 1689772483831 - } - } - """) - }) }), - @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = { - @Content(examples = { - @ExampleObject(name = "Wallet not found with provided identifier", value = """ - { - "type": "about:blank", - "title": "Error Title", - "status": 404, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - """) - }) }), - @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { - @Content(examples = { - @ExampleObject(name = "Response in case of invalid data provided", value = """ - { - "type": "about:blank", - "title": "Invalid data provided", - "status": 400, - "detail": "details", - "instance": "API endpoint", - "properties": - { - "timestamp": 1689760833962, - "errors": - { - "filed": "filed error message" - } - } - } - """) - }) - }), - @ApiResponse(responseCode = "201", description = "Issuer credential", content = { - @Content(examples = { - @ExampleObject(name = "Membership credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#0d6b6447-99de-4bc5-94f3-3ac0ae8ee188", - "type": [ - "VerifiableCredential", - "MembershipCredential" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:13:53Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "startTime": "2023-07-19T13:13:53.581081Z", - "memberOf": "Catena-X", - "id": "did:web:localhost:BPNL000000000000", - "type": "MembershipCredential", - "status": "Active" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "type": "JsonWebSignature2020", - "created": "2023-07-19T13:13:57Z", - "jws": "eyJhbGciOiJFZERTQSJ9..zt7SyONY1shO7N6KrabQJr9uNrToM1Bc4eagTQc1LxAfZ1v-SSp9Y-2cpZNDV8AR08r4L8VbtWrR9t2dNoAfDw" - } - } - """) - }) - }) }) - @Operation(summary = "Issue a Membership Verifiable Credential with base wallet issuer", description = "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet", security = { @SecurityRequirement(name = "Authenticate using access_token") }) - public @interface IssueMembershipCredentialApiDoc { - } - - @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) - @RequestBody(content = { - @Content(examples = @ExampleObject(""" - { - "bpn": "BPNL000000000000", - "activityType": "vehicleDismantle", - "allowedVehicleBrands": [ - "Audi", "Abarth", "Alfa Romeo", "Chrysler" - ] - } - """)) - }) - @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) - @ApiResponses(value = { - @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = { - @Content(examples = {}) }), - @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = { - @Content(examples = {}) }), - @ApiResponse(responseCode = "500", description = "Any other internal server error", content = { - @Content(examples = { - @ExampleObject(name = "Internal server error", value = """ - { - "type": "about:blank", - "title": "Error Title", - "status": 500, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - """) - }) }), - @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict.", content = { - @Content(examples = { - @ExampleObject(name = "DismantlerCredential already exist", value = """ - { - "type": "about:blank", - "title": "Credential of type DismantlerCredential is already exists ", - "status": 409, - "detail": "Credential of type DismantlerCredential is already exists ", - "instance": "/api/credentials/issuer/dismantler", - "properties": { - "timestamp": 1689773804746 - } - } - """) - }) }), - @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = { - @Content(examples = { - @ExampleObject(name = "Wallet not found with provided identifier", value = """ - { - "type": "about:blank", - "title": "Error Title", - "status": 404, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - """) - }) }), - @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { - @Content(examples = { - @ExampleObject(name = "Response in case of invalid data provided", value = """ - { - "type": "about:blank", - "title": "Invalid data provided", - "status": 400, - "detail": "details", - "instance": "API endpoint", - "properties": - { - "timestamp": 1689760833962, - "errors": - { - "filed": "filed error message" - } - } - } - """) - }) - }), - @ApiResponse(responseCode = "201", description = "Dismantler Credential", content = { - @Content(examples = { - @ExampleObject(name = "Dismantler Credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#5caac86c-8ef8-4aab-9d2b-fb18c62560a9", - "type": [ - "VerifiableCredential", - "DismantlerCredential" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:35:33Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "allowedVehicleBrands": [ - "Audi", - "Abarth", - "Alfa Romeo", - "Chrysler" - ], - "id": "did:web:localhost:BPNL000000000000", - "activityType": "vehicleDismantle", - "type": "DismantlerCredential" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "type": "JsonWebSignature2020", - "created": "2023-07-19T13:35:38Z", - "jws": "eyJhbGciOiJFZERTQSJ9..UI82uq6iyqoaKjZIhJiV24v_Bqnj_7EqWiqZ3VWjqkoHLnr7JDtW5KVywWPl27j_baLBxxnM5jqjQdSK4rfbBg" - } - } - """) - }) - }) - }) - @Operation(summary = "Issue a Dismantler Verifiable Credential with base wallet issuer", description = "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet", security = { @SecurityRequirement(name = "Authenticate using access_token") }) - public @interface IssueDismantlerCredentialApiDoc { - } - - @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) - @RequestBody(content = { - @Content(examples = { - @ExampleObject(name = "BehaviorTwinCredential", value = """ - { - "holderIdentifier": "BPNL000000000000", - "type": "BehaviorTwinCredential", - "contract-template": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contract-version": "1.0.0", - "asJwt": false - } - """), - @ExampleObject(name = "PcfCredential", value = """ - { - "holderIdentifier": "BPNL000000000000", - "type": "PcfCredential", - "contract-template": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contract-version": "1.0.0", - "asJwt": false - } - """), - @ExampleObject(name = "SustainabilityCredential", value = """ - { - "holderIdentifier": "BPNL000000000000", - "type": "SustainabilityCredential", - "contract-template": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contract-version": "1.0.0", - "asJwt": false - } - """), - @ExampleObject(name = "QualityCredential", value = """ - { - "holderIdentifier": "BPNL000000000000", - "type": "QualityCredential", - "contract-template": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contract-version": "1.0.0", - "asJwt": false - } - """), - @ExampleObject(name = "TraceabilityCredential", value = """ - { - "holderIdentifier": "BPNL000000000000", - "type": "TraceabilityCredential", - "contract-template": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contract-version": "1.0.0", - "asJwt": false - } - """), - @ExampleObject(name = "BehaviorTwinCredential", value = """ - { - "holderIdentifier": "BPNL000000000000", - "type": "BehaviorTwinCredential", - "contract-template": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contract-version": "1.0.0", - "asJwt": false - } - """), - @ExampleObject(name = "ResiliencyCredential", value = """ - { - "holderIdentifier": "BPNL000000000000", - "type": "ResiliencyCredential", - "contract-template": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contract-version": "1.0.0", - "asJwt": false - } - """) - - }) - }) - @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) - @Operation(summary = "Issue a Use Case Verifiable Credential with base wallet issuer", description = "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet", security = { @SecurityRequirement(name = "Authenticate using access_token") }) - @ApiResponses(value = { - @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = { - @Content(examples = {}) }), - @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = { - @Content(examples = {}) }), - @ApiResponse(responseCode = "500", description = "Any other internal server error", content = { - @Content(examples = { - @ExampleObject(name = "Internal server error", value = """ - { - "type": "about:blank", - "title": "Error Title", - "status": 500, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - """) - }) }), - @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = { - @Content(examples = { - @ExampleObject(name = "Wallet not found with provided identifier", value = """ - { - "type": "about:blank", - "title": "Error Title", - "status": 404, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - """) - }) }), - @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { - @Content(examples = { - @ExampleObject(name = "Response in case of invalid data provided", value = """ - { - "type": "about:blank", - "title": "Invalid data provided", - "status": 400, - "detail": "details", - "instance": "API endpoint", - "properties": - { - "timestamp": 1689760833962, - "errors": - { - "filed": "filed error message" - } - } - } - """) - }) - }), - @ApiResponse(responseCode = "201", description = "Framework credential", content = { - @Content(examples = { - @ExampleObject(name = "BehaviorTwin credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "BehaviorTwinCredential", - "contractTemplate": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - """), - @ExampleObject(name = "Pcf Credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "PcfCredential", - "contractTemplate": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - """), - @ExampleObject(name = "Sustainability Credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "SustainabilityCredential", - "contractTemplate": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - """), - @ExampleObject(name = "Quality Credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "QualityCredential", - "contractTemplate": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - """), - @ExampleObject(name = "Traceability Credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "TraceabilityCredential", - "contractTemplate": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - """), - @ExampleObject(name = "Resiliency Credential", value = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "ResiliencyCredential", - "contractTemplate": "https://eclipse-tractusx.github.io/tractusx-profiles/cx/context/credentials.context.json", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - """) - }) - }) - }) - public @interface IssueFrameworkCredentialApiDocs { - } @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java index ed420d7f7..95b00550c 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java @@ -28,8 +28,6 @@ import org.apache.commons.lang3.exception.ExceptionUtils; import org.eclipse.tractusx.managedidentitywallets.exception.BadDataException; import org.eclipse.tractusx.managedidentitywallets.exception.CredentialNotFoundProblem; -import org.eclipse.tractusx.managedidentitywallets.exception.DuplicateCredentialProblem; -import org.eclipse.tractusx.managedidentitywallets.exception.DuplicateSummaryCredentialProblem; import org.eclipse.tractusx.managedidentitywallets.exception.DuplicateWalletProblem; import org.eclipse.tractusx.managedidentitywallets.exception.ForbiddenException; import org.eclipse.tractusx.managedidentitywallets.exception.MissingVcTypesException; @@ -149,19 +147,6 @@ ProblemDetail handleValidation(ConstraintViolationException exception) { return problemDetail; } - /** - * Handle duplicate credential problem problem detail. - * - * @param e the e - * @return the problem detail - */ - @ExceptionHandler({DuplicateCredentialProblem.class, DuplicateSummaryCredentialProblem.class}) - ProblemDetail handleDuplicateCredentialProblem(RuntimeException e) { - ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.CONFLICT, e.getMessage()); - problemDetail.setTitle(e.getMessage()); - problemDetail.setProperty(TIMESTAMP, System.currentTimeMillis()); - return problemDetail; - } /** * Handle not found credential problem detail. diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/MIWSettings.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/MIWSettings.java index 6a57603ba..7465f6517 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/MIWSettings.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/MIWSettings.java @@ -29,7 +29,6 @@ import java.net.URI; import java.util.Date; import java.util.List; -import java.util.Set; /** * The type Miw settings. @@ -37,10 +36,9 @@ @ConfigurationProperties(prefix = "miw") public record MIWSettings(String host, String encryptionKey, String authorityWalletBpn, String authorityWalletDid, String authorityWalletName, - List vcContexts, List summaryVcContexts, + List vcContexts, @DateTimeFormat(pattern = "dd-MM-yyyy") Date vcExpiryDate, - Set supportedFrameworkVCTypes, - boolean enforceHttps, String contractTemplatesUrl, + boolean enforceHttps, List didDocumentContextUrls, KeyStorageType localSigningKeyStorageType, SigningServiceType authoritySigningServiceType) { diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java index ea01ece53..d93c6cd32 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java @@ -110,10 +110,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { //VC - Issuer .requestMatchers(new AntPathRequestMatcher(RestURI.ISSUERS_CREDENTIALS, GET.name())).hasAnyRole(ApplicationRole.ROLE_UPDATE_WALLETS) //Lis of issuer VC .requestMatchers(new AntPathRequestMatcher(RestURI.ISSUERS_CREDENTIALS, POST.name())).hasAnyRole(ApplicationRole.ROLE_UPDATE_WALLETS) //Issue VC - .requestMatchers(new AntPathRequestMatcher(RestURI.CREDENTIALS_ISSUER_MEMBERSHIP, POST.name())).hasAnyRole(ApplicationRole.ROLE_UPDATE_WALLETS) //issue Membership Credential - .requestMatchers(new AntPathRequestMatcher(RestURI.CREDENTIALS_ISSUER_DISMANTLER, POST.name())).hasAnyRole(ApplicationRole.ROLE_UPDATE_WALLETS) //issue dismantler Credential - .requestMatchers(new AntPathRequestMatcher(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, POST.name())).hasAnyRole(ApplicationRole.ROLE_UPDATE_WALLETS) //issue dismantler Credential - + //error .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() ).oauth2ResourceServer(resourceServer -> resourceServer.jwt(jwt -> diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/MIWVerifiableCredentialType.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/MIWVerifiableCredentialType.java deleted file mode 100644 index e7f166b44..000000000 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/MIWVerifiableCredentialType.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.constant; - -import lombok.experimental.UtilityClass; - -/** - * The type Miw verifiable credential type. - */ -@UtilityClass -public class MIWVerifiableCredentialType { - - public static final String VERIFIABLE_CREDENTIAL = "VerifiableCredential"; - - /** The constant MEMBERSHIP_CREDENTIAL. */ - public static final String MEMBERSHIP_CREDENTIAL = "MembershipCredential"; - - public static final String DISMANTLER_CREDENTIAL = "DismantlerCredential"; - /** - * The constant USE_CASE_FRAMEWORK_CONDITION_CX. - */ - public static final String USE_CASE_FRAMEWORK_CONDITION = "UseCaseFrameworkCondition"; - - public static final String BPN_CREDENTIAL = "BpnCredential"; - - public static final String SUMMARY_CREDENTIAL = "SummaryCredential"; - - -} diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java index db5415337..a9273fef5 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java @@ -39,6 +39,9 @@ private RestURI() { * The constant DID_DOCUMENTS. */ public static final String DID_DOCUMENTS = "/api/didDocuments/{identifier}"; + /** + * The constant DID_RESOLVE. + */ public static final String DID_RESOLVE = "/{bpn}/did.json"; /** * The constant WALLETS_BY_BPN. @@ -54,29 +57,27 @@ private RestURI() { */ public static final String CREDENTIALS = "/api/credentials"; - - public static final String CREDENTIALS_VALIDATION = "/api/credentials/validation"; - - - public static final String ISSUERS_CREDENTIALS = "/api/credentials/issuer"; - /** - * The constant CREDENTIALS_ISSUER_MEMBERSHIP. + * The constant CREDENTIALS_VALIDATION. */ - public static final String CREDENTIALS_ISSUER_MEMBERSHIP = "/api/credentials/issuer/membership"; + public static final String CREDENTIALS_VALIDATION = "/api/credentials/validation"; /** - * The constant CREDENTIALS_ISSUER_DISMANTLER. + * The constant ISSUERS_CREDENTIALS. */ - public static final String CREDENTIALS_ISSUER_DISMANTLER = "/api/credentials/issuer/dismantler"; + public static final String ISSUERS_CREDENTIALS = "/api/credentials/issuer"; /** - * The constant API_CREDENTIALS_ISSUER_FRAMEWORK. + * The constant API_PRESENTATIONS. */ - public static final String API_CREDENTIALS_ISSUER_FRAMEWORK = "/api/credentials/issuer/framework"; - public static final String API_PRESENTATIONS = "/api/presentations"; + /** + * The constant API_PRESENTATIONS_VALIDATION. + */ public static final String API_PRESENTATIONS_VALIDATION = "/api/presentations/validation"; + /** + * The constant API_PRESENTATIONS_IATP. + */ public static final String API_PRESENTATIONS_IATP = "/api/presentations/iatp"; } diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java index 11644fee8..9a42fac7e 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java @@ -27,10 +27,7 @@ public class StringPool { public static final String CREDENTIAL_ID = "credentialId"; - public static final String VALUE = "value"; - public static final String CONTRACT_VERSION = "contractVersion"; - public static final String ACTIVITY_TYPE = "activityType"; - public static final String ALLOWED_VEHICLE_BRANDS = "allowedVehicleBrands"; + public static final String VERIFIABLE_CREDENTIALS = "verifiableCredentials"; public static final String VP = "vp"; public static final String VC = "vc"; @@ -39,8 +36,6 @@ public class StringPool { public static final String VALIDATE_EXPIRY_DATE = "validateExpiryDate"; public static final String VALIDATE_JWT_EXPIRY_DATE = "validateJWTExpiryDate"; public static final String DID_DOCUMENT = "didDocument"; - public static final String VEHICLE_DISMANTLE = "vehicleDismantle"; - public static final String CREATED_AT = "createdAt"; private StringPool() { throw new IllegalStateException("Constant class"); @@ -49,13 +44,7 @@ private StringPool() { public static final String ISSUER_DID = "issuerDid"; public static final String HOLDER_DID = "holderDid"; public static final String HOLDER_IDENTIFIER = "holderIdentifier"; - public static final String NAME = "name"; - public static final String CONTRACT_TEMPLATE = "contractTemplate"; public static final String TYPE = "type"; - public static final String MEMBER_OF = "memberOf"; - public static final String STATUS = "status"; - public static final String START_TIME = "startTime"; - public static final String ED_25519 = "ED25519"; @@ -69,13 +58,8 @@ private StringPool() { */ public static final String BPN = "bpn"; - public static final String BPN_UPPER_CASE = "BPN"; - public static final String ID = "id"; - public static final String ITEMS = "items"; - - public static final String CLIENT_ID = "miw_private_client"; public static final String CLIENT_SECRET = "miw_private_client_secret"; diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java index f119c9283..5d3ca437f 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java @@ -23,16 +23,12 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ExampleObject; -import jakarta.validation.Valid; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.AsJwtParam; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.GetCredentialsApiDocs; -import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.IssueDismantlerCredentialApiDoc; -import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.IssueFrameworkCredentialApiDocs; -import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.IssueMembershipCredentialApiDoc; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.IssueVerifiableCredentialUsingBaseWalletApiDocs; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.ValidateVerifiableCredentialApiDocs; import org.eclipse.tractusx.managedidentitywallets.command.GetCredentialsCommand; @@ -40,9 +36,6 @@ import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialVerificationRequest; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialsResponse; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueDismantlerCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueFrameworkCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; import org.eclipse.tractusx.managedidentitywallets.service.IssuersCredentialService; import org.springframework.data.domain.PageImpl; import org.springframework.http.HttpStatus; @@ -125,53 +118,6 @@ public ResponseEntity> getCredentials(@Parameter(n return ResponseEntity.status(HttpStatus.OK).body(issuersCredentialService.getCredentials(command)); } - /** - * Issue membership credential response entity. - * - * @param issueMembershipCredentialRequest the issue membership credential request - * @param principal the principal - * @return the response entity - */ - @IssueMembershipCredentialApiDoc - @PostMapping(path = RestURI.CREDENTIALS_ISSUER_MEMBERSHIP, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity issueMembershipCredential(@Valid @RequestBody IssueMembershipCredentialRequest issueMembershipCredentialRequest, - @AsJwtParam @RequestParam(name = StringPool.AS_JWT, defaultValue = "false") boolean asJwt, - Principal principal) { - log.debug("Received request to issue membership credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest, asJwt, getBPNFromToken(principal))); - } - - /** - * Issue dismantler credential response entity. - * - * @param request the request - * @param principal the principal - * @return the response entity - */ - @IssueDismantlerCredentialApiDoc - @PostMapping(path = RestURI.CREDENTIALS_ISSUER_DISMANTLER, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity issueDismantlerCredential(@Valid @RequestBody IssueDismantlerCredentialRequest request, - @AsJwtParam @RequestParam(name = StringPool.AS_JWT, defaultValue = "false") boolean asJwt, - Principal principal) { - log.debug("Received request to issue dismantler credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueDismantlerCredential(request, asJwt, getBPNFromToken(principal))); - } - - /** - * Issue framework credential response entity. - * - * @param request the request - * @param principal the principal - * @return the response entity - */ - @IssueFrameworkCredentialApiDocs - @PostMapping(path = RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity issueFrameworkCredential(@Valid @RequestBody IssueFrameworkCredentialRequest request, - @AsJwtParam @RequestParam(name = StringPool.AS_JWT, defaultValue = "false") boolean asJwt, - Principal principal) { - log.debug("Received request to issue framework credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueFrameworkCredential(request, asJwt, getBPNFromToken(principal))); - } /** * Credentials validation response entity. diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java index a0e267c79..2d50616c5 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java @@ -53,8 +53,6 @@ @Slf4j public class PresentationController extends BaseController { - public static final String API_TAG_VERIFIABLE_PRESENTATIONS_GENERATION = "Verifiable Presentations - Generation"; - public static final String API_TAG_VERIFIABLE_PRESENTATIONS_VALIDATION = "Verifiable Presentations - Validation"; private final PresentationService presentationService; /** diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java deleted file mode 100644 index a838d4b6f..000000000 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.dto; - -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Pattern; -import jakarta.validation.constraints.Size; -import lombok.*; -import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; - -import java.util.Set; - -/** - * The type Issue dismantler credential request. - */ -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class IssueDismantlerCredentialRequest { - - @NotBlank(message = "Please provide BPN") - @Pattern(regexp = StringPool.BPN_NUMBER_REGEX, message = "Please provide valid BPN") - private String bpn; - - @NotBlank(message = "Please provide activity type") - @Size(min = 1, message = "Please provide valid activity type") - private String activityType; - - @Builder.Default - private Set<@NotBlank String> allowedVehicleBrands = Set.of(); -} diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java deleted file mode 100644 index 38411e5a1..000000000 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - - -/** - * The type Issue framework credential request. - */ - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class IssueFrameworkCredentialRequest { - - @NotBlank(message = "Please provide holder identifier") - @Size(min = 5, max = 255, message = "Please provide valid identifier") - private String holderIdentifier; - - @NotBlank(message = "Please provide type") - private String type; - - @NotBlank(message = "Please provide contract-template") - @JsonProperty("contract-template") - private String contractTemplate; - - @NotBlank(message = "Please provide contract-template") - @JsonProperty("contract-version") - private String contractVersion; - @JsonProperty("asJwt") - private boolean asJwt; - -} diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java deleted file mode 100644 index 59fc852a3..000000000 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Pattern; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; - -/** - * The type Issue membership credential request. - */ -@Getter -@Setter -@NoArgsConstructor -@Builder -@AllArgsConstructor -public class IssueMembershipCredentialRequest { - - @NotBlank(message = "Please provide BPN") - @Pattern(regexp = StringPool.BPN_NUMBER_REGEX, message = "Please provide valid BPN") - private String bpn; - - @JsonProperty("asJwt") - private boolean asJwt; -} - diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/exception/DuplicateSummaryCredentialProblem.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/exception/DuplicateSummaryCredentialProblem.java deleted file mode 100644 index 917b7a1ab..000000000 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/exception/DuplicateSummaryCredentialProblem.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.exception; - -/** - * The type Duplicate wallet problem. - */ -public class DuplicateSummaryCredentialProblem extends RuntimeException { - - /** - * Instantiates a new Duplicate wallet problem. - */ - public DuplicateSummaryCredentialProblem() { - } - - /** - * Instantiates a new Duplicate wallet problem. - * - * @param message the message - */ - public DuplicateSummaryCredentialProblem(String message) { - super(message); - } - - /** - * Instantiates a new Duplicate wallet problem. - * - * @param message the message - * @param cause the cause - */ - public DuplicateSummaryCredentialProblem(String message, Throwable cause) { - super(message, cause); - } - - /** - * Instantiates a new Duplicate wallet problem. - * - * @param cause the cause - */ - public DuplicateSummaryCredentialProblem(Throwable cause) { - super(cause); - } - -} diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java index 5cb44c63f..8d6fb6d2b 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java @@ -37,7 +37,6 @@ import org.apache.commons.text.StringEscapeUtils; import org.eclipse.tractusx.managedidentitywallets.command.GetCredentialsCommand; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.constant.SupportedAlgorithms; import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; @@ -50,11 +49,6 @@ import org.eclipse.tractusx.managedidentitywallets.domain.VerifiableEncoding; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialVerificationRequest; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialsResponse; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueDismantlerCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueFrameworkCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.exception.BadDataException; -import org.eclipse.tractusx.managedidentitywallets.exception.DuplicateCredentialProblem; import org.eclipse.tractusx.managedidentitywallets.exception.ForbiddenException; import org.eclipse.tractusx.managedidentitywallets.signing.SignerResult; import org.eclipse.tractusx.managedidentitywallets.signing.SigningService; @@ -66,10 +60,7 @@ import org.eclipse.tractusx.ssi.lib.exception.proof.JwtExpiredException; import org.eclipse.tractusx.ssi.lib.jwt.SignedJwtValidator; import org.eclipse.tractusx.ssi.lib.jwt.SignedJwtVerifier; -import org.eclipse.tractusx.ssi.lib.model.did.DidDocument; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialType; import org.eclipse.tractusx.ssi.lib.proof.LinkedDataProofValidation; import org.eclipse.tractusx.ssi.lib.serialization.SerializeUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -85,9 +76,7 @@ import java.io.IOException; import java.net.http.HttpClient; import java.text.ParseException; -import java.time.Instant; import java.util.ArrayList; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; @@ -201,292 +190,6 @@ public PageImpl getCredentials(GetCredentialsCommand comman } - /** - * Issue bpn credential - * - * @param baseWallet the base wallet - * @param holderWallet the holder wallet - * @param authority the authority - * @return the verifiable credential - */ - @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public VerifiableCredential issueBpnCredential(Wallet baseWallet, Wallet holderWallet, boolean authority) { - - List types = List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, MIWVerifiableCredentialType.BPN_CREDENTIAL); - VerifiableCredentialSubject verifiableCredentialSubject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, MIWVerifiableCredentialType.BPN_CREDENTIAL, - StringPool.ID, holderWallet.getDid(), - StringPool.BPN, holderWallet.getBpn())); - - CredentialCreationConfig holdersCredentialCreationConfig = CredentialCreationConfig.builder() - .encoding(VerifiableEncoding.JSON_LD) - .subject(verifiableCredentialSubject) - .types(types) - .issuerDoc(baseWallet.getDidDocument()) - .holderDid(holderWallet.getDid()) - .contexts(miwSettings.vcContexts()) - .expiryDate(miwSettings.vcExpiryDate()) - .selfIssued(authority) - .keyName(miwSettings.authorityWalletBpn()) - .algorithm(SupportedAlgorithms.valueOf(baseWallet.getAlgorithm())) - .build(); - - - SignerResult result = availableSigningServices.get(baseWallet.getSigningServiceType()).createCredential(holdersCredentialCreationConfig); - VerifiableCredential vc = (VerifiableCredential) result.getJsonLd(); - HoldersCredential holdersCredential = CommonUtils.convertVerifiableCredential(vc, holdersCredentialCreationConfig); - - //Store Credential in holder wallet - holdersCredential = holdersCredentialRepository.save(holdersCredential); - - //Store Credential in issuers table - IssuersCredential issuersCredential = IssuersCredential.of(holdersCredential); - issuersCredentialRepository.save(issuersCredential); - - //update summery VC - updateSummeryCredentials(baseWallet.getDidDocument(), baseWallet.getDid(), holderWallet.getBpn(), holderWallet.getDid(), MIWVerifiableCredentialType.BPN_CREDENTIAL, baseWallet.getSigningServiceType(),SupportedAlgorithms.valueOf(baseWallet.getAlgorithm())); - - log.debug("BPN credential issued for bpn -{}", StringEscapeUtils.escapeJava(holderWallet.getBpn())); - - return issuersCredential.getData(); - } - - /** - * Issue framework credential verifiable credential. - * - * @param request the request - * @param asJwt the as jwt - * @param callerBPN the caller bpn - * @return the verifiable credential - */ - @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public CredentialsResponse issueFrameworkCredential(IssueFrameworkCredentialRequest request, boolean asJwt, String callerBPN) { - - //validate type - Validate.isFalse(miwSettings.supportedFrameworkVCTypes().contains(request.getType())).launch(new BadDataException("Framework credential of type " + request.getType() + " is not supported, supported values are " + miwSettings.supportedFrameworkVCTypes())); - - //Fetch Holder Wallet - Wallet holderWallet = commonService.getWalletByIdentifier(request.getHolderIdentifier()); - - Wallet baseWallet = commonService.getWalletByIdentifier(miwSettings.authorityWalletBpn()); - - validateAccess(callerBPN, baseWallet); - - //if base wallet issue credentials to itself - boolean isSelfIssued = isSelfIssued(holderWallet.getBpn()); - - VerifiableCredentialSubject subject = new VerifiableCredentialSubject(Map.of( - StringPool.TYPE, request.getType(), - StringPool.ID, holderWallet.getDid(), - StringPool.HOLDER_IDENTIFIER, holderWallet.getBpn(), - StringPool.CONTRACT_TEMPLATE, request.getContractTemplate(), - StringPool.CONTRACT_VERSION, request.getContractVersion())); - List types = List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, MIWVerifiableCredentialType.USE_CASE_FRAMEWORK_CONDITION); - - CredentialCreationConfig holdersCredentialCreationConfig = CredentialCreationConfig.builder() - .encoding(VerifiableEncoding.JSON_LD) - .subject(subject) - .types(types) - .issuerDoc(baseWallet.getDidDocument()) - .keyName(miwSettings.authorityWalletBpn()) - .holderDid(holderWallet.getDid()) - .contexts(miwSettings.vcContexts()) - .expiryDate(miwSettings.vcExpiryDate()) - .selfIssued(isSelfIssued) - .algorithm(SupportedAlgorithms.valueOf(baseWallet.getAlgorithm())) - .build(); - - SignerResult result = availableSigningServices.get(baseWallet.getSigningServiceType()).createCredential(holdersCredentialCreationConfig); - VerifiableCredential vc = (VerifiableCredential) result.getJsonLd(); - HoldersCredential holdersCredential = CommonUtils.convertVerifiableCredential(vc, holdersCredentialCreationConfig); - - //save in holder wallet - holdersCredential = holdersCredentialRepository.save(holdersCredential); - - //Store Credential in issuers table - IssuersCredential issuersCredential = IssuersCredential.of(holdersCredential); - issuersCredential = create(issuersCredential); - - //update summery cred - updateSummeryCredentials(baseWallet.getDidDocument(), baseWallet.getDid(), holderWallet.getBpn(), holderWallet.getDid(), request.getType(), baseWallet.getSigningServiceType(),SupportedAlgorithms.valueOf(baseWallet.getAlgorithm())); - - - final CredentialsResponse cr = new CredentialsResponse(); - - // Return VC - if (asJwt) { - holdersCredentialCreationConfig.setVerifiableCredential(issuersCredential.getData()); - holdersCredentialCreationConfig.setEncoding(VerifiableEncoding.JWT); - SignerResult credential = availableSigningServices.get(baseWallet.getSigningServiceType()).createCredential(holdersCredentialCreationConfig); - cr.setJwt(credential.getJwt()); - } else { - cr.setVc(issuersCredential.getData()); - } - - log.debug("Framework VC of type ->{} issued to bpn ->{}", StringEscapeUtils.escapeJava(request.getType()), StringEscapeUtils.escapeJava(holderWallet.getBpn())); - - return cr; - } - - /** - * Issue dismantler credential verifiable credential. - * - * @param request the request - * @param asJwt the as jwt - * @param callerBPN the caller bpn - * @return the verifiable credential - */ - @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public CredentialsResponse issueDismantlerCredential(IssueDismantlerCredentialRequest request, boolean asJwt, String callerBPN) { - - //Fetch Holder Wallet - Wallet holderWallet = commonService.getWalletByIdentifier(request.getBpn()); - - // Fetch Issuer Wallet - Wallet issuerWallet = commonService.getWalletByIdentifier(miwSettings.authorityWalletBpn()); - - validateAccess(callerBPN, issuerWallet); - - //check duplicate - isCredentialExit(holderWallet.getDid(), MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL); - - //if base wallet issue credentials to itself - boolean isSelfIssued = isSelfIssued(request.getBpn()); - - VerifiableCredentialSubject subject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL, - StringPool.ID, holderWallet.getDid(), - StringPool.HOLDER_IDENTIFIER, holderWallet.getBpn(), - StringPool.ACTIVITY_TYPE, request.getActivityType(), - StringPool.ALLOWED_VEHICLE_BRANDS, request.getAllowedVehicleBrands() == null ? Collections.emptySet() : request.getAllowedVehicleBrands())); - List types = List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL); - - - CredentialCreationConfig holdersCredentialCreationConfig = CredentialCreationConfig.builder() - .encoding(VerifiableEncoding.JSON_LD) - .subject(subject) - .types(types) - .issuerDoc(issuerWallet.getDidDocument()) - .keyName(miwSettings.authorityWalletBpn()) - .holderDid(holderWallet.getDid()) - .contexts(miwSettings.vcContexts()) - .expiryDate(miwSettings.vcExpiryDate()) - .selfIssued(isSelfIssued) - .algorithm(SupportedAlgorithms.valueOf(issuerWallet.getAlgorithm())) - .build(); - - SignerResult result = availableSigningServices.get(issuerWallet.getSigningServiceType()).createCredential(holdersCredentialCreationConfig); - VerifiableCredential vc = (VerifiableCredential) result.getJsonLd(); - HoldersCredential holdersCredential = CommonUtils.convertVerifiableCredential(vc, holdersCredentialCreationConfig); - - - //save in holder wallet - holdersCredential = holdersCredentialRepository.save(holdersCredential); - - //Store Credential in issuers table - IssuersCredential issuersCredential = IssuersCredential.of(holdersCredential); - issuersCredential = create(issuersCredential); - - //update summery VC - updateSummeryCredentials(issuerWallet.getDidDocument(), issuerWallet.getDid(), holderWallet.getBpn(), holderWallet.getDid(), MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL, issuerWallet.getSigningServiceType(),SupportedAlgorithms.valueOf(issuerWallet.getAlgorithm())); - - final CredentialsResponse cr = new CredentialsResponse(); - - // Return VC - if (asJwt) { - holdersCredentialCreationConfig.setVerifiableCredential(issuersCredential.getData()); - holdersCredentialCreationConfig.setEncoding(VerifiableEncoding.JWT); - SignerResult credential = availableSigningServices.get(issuerWallet.getSigningServiceType()).createCredential(holdersCredentialCreationConfig); - cr.setJwt(credential.getJwt()); - } else { - cr.setVc(issuersCredential.getData()); - } - - log.debug("Dismantler VC issued to bpn -> {}", StringEscapeUtils.escapeJava(request.getBpn())); - - return cr; - } - - /** - * Issue membership credential verifiable credential. - * - * @param issueMembershipCredentialRequest the issue membership credential request - * @param asJwt the as jwt - * @param callerBPN the caller bpn - * @return the verifiable credential - */ - @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public CredentialsResponse issueMembershipCredential(IssueMembershipCredentialRequest issueMembershipCredentialRequest, boolean asJwt, String callerBPN) { - - //Fetch Holder Wallet - Wallet holderWallet = commonService.getWalletByIdentifier(issueMembershipCredentialRequest.getBpn()); - - //check duplicate - isCredentialExit(holderWallet.getDid(), VerifiableCredentialType.MEMBERSHIP_CREDENTIAL); - - // Fetch Issuer Wallet - Wallet issuerWallet = commonService.getWalletByIdentifier(miwSettings.authorityWalletBpn()); - - validateAccess(callerBPN, issuerWallet); - - List types = List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, VerifiableCredentialType.MEMBERSHIP_CREDENTIAL); - - //if base wallet issue credentials to itself - boolean isSelfIssued = isSelfIssued(issueMembershipCredentialRequest.getBpn()); - - //VC Subject - VerifiableCredentialSubject verifiableCredentialSubject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, VerifiableCredentialType.MEMBERSHIP_CREDENTIAL, - StringPool.ID, holderWallet.getDid(), - StringPool.HOLDER_IDENTIFIER, holderWallet.getBpn(), - StringPool.MEMBER_OF, issuerWallet.getName(), - StringPool.STATUS, "Active", - StringPool.START_TIME, Instant.now().toString())); - - - CredentialCreationConfig holdersCredentialCreationConfig = CredentialCreationConfig.builder() - .encoding(VerifiableEncoding.JSON_LD) - .subject(verifiableCredentialSubject) - .types(types) - .issuerDoc(issuerWallet.getDidDocument()) - .keyName(miwSettings.authorityWalletBpn()) - .holderDid(holderWallet.getDid()) - .contexts(miwSettings.vcContexts()) - .expiryDate(miwSettings.vcExpiryDate()) - .selfIssued(isSelfIssued) - .algorithm(SupportedAlgorithms.valueOf(issuerWallet.getAlgorithm())) - .build(); - - SignerResult result = availableSigningServices.get(issuerWallet.getSigningServiceType()).createCredential(holdersCredentialCreationConfig); - VerifiableCredential vc = (VerifiableCredential) result.getJsonLd(); - HoldersCredential holdersCredential = CommonUtils.convertVerifiableCredential(vc, holdersCredentialCreationConfig); - - - //save in holder wallet - holdersCredential = holdersCredentialRepository.save(holdersCredential); - - IssuersCredential issuersCredential = IssuersCredential.of(holdersCredential); - - //Store Credential in issuer table - issuersCredential = create(issuersCredential); - - //update summery VC - updateSummeryCredentials(issuerWallet.getDidDocument(), issuerWallet.getDid(), holderWallet.getBpn(), holderWallet.getDid(), VerifiableCredentialType.MEMBERSHIP_CREDENTIAL, issuerWallet.getSigningServiceType(), SupportedAlgorithms.valueOf(issuerWallet.getAlgorithm())); - - final CredentialsResponse cr = new CredentialsResponse(); - - // Return VC - if (asJwt) { - holdersCredentialCreationConfig.setVerifiableCredential(issuersCredential.getData()); - holdersCredentialCreationConfig.setEncoding(VerifiableEncoding.JWT); - SignerResult credential = availableSigningServices.get(issuerWallet.getSigningServiceType()).createCredential(holdersCredentialCreationConfig); - cr.setJwt(credential.getJwt()); - } else { - cr.setVc(issuersCredential.getData()); - } - - log.debug("Membership VC issued to bpn ->{}", StringEscapeUtils.escapeJava(issueMembershipCredentialRequest.getBpn())); - - return cr; - } - /** * Issue credential using base wallet @@ -504,9 +207,6 @@ public CredentialsResponse issueCredentialUsingBaseWallet(String holderDid, Map< VerifiableCredential verifiableCredential = new VerifiableCredential(data); - //Summary VC can not be issued using API, as summary VC is issuing at runtime - verifiableCredential.getTypes().forEach(type -> Validate.isTrue(type.equals(MIWVerifiableCredentialType.SUMMARY_CREDENTIAL)).launch(new BadDataException("Can not issue " + MIWVerifiableCredentialType.SUMMARY_CREDENTIAL + " type VC using API"))); - Wallet issuerWallet = commonService.getWalletByIdentifier(verifiableCredential.getIssuer().toString()); validateAccess(callerBpn, issuerWallet); @@ -671,111 +371,11 @@ private void validateAccess(String callerBpn, Wallet issuerWallet) { Validate.isFalse(issuerWallet.getBpn().equals(miwSettings.authorityWalletBpn())).launch(new ForbiddenException(BASE_WALLET_BPN_IS_NOT_MATCHING_WITH_REQUEST_BPN_FROM_TOKEN)); } - - private void isCredentialExit(String holderDid, String credentialType) { - Validate.isTrue(holdersCredentialRepository.existsByHolderDidAndType(holderDid, credentialType)).launch(new DuplicateCredentialProblem("Credential of type " + credentialType + " is already exists ")); - } - private boolean isSelfIssued(String holderBpn) { return holderBpn.equals(miwSettings.authorityWalletBpn()); } - - private void updateSummeryCredentials(DidDocument issuerDidDocument, String issuerDid, String holderBpn, String holderDid, String type, SigningServiceType signingServiceType, SupportedAlgorithms algorithm) { - - //get last issued summary vc to holder to update items - Page filter = getLastIssuedSummaryCredential(issuerDid, holderDid); - List items; - if (!filter.getContent().isEmpty()) { - IssuersCredential issuersCredential = filter.getContent().get(0); - - //check if summery VC has subject - Validate.isTrue(issuersCredential.getData().getCredentialSubject().isEmpty()).launch(new BadDataException("VC subject not found in existing su,,ery VC")); - - //Check if we have only one subject in summery VC - Validate.isTrue(issuersCredential.getData().getCredentialSubject().size() > 1).launch(new BadDataException("VC subjects can more then 1 in case of summery VC")); - - VerifiableCredentialSubject subject = issuersCredential.getData().getCredentialSubject().get(0); - if (subject.containsKey(StringPool.ITEMS)) { - items = (List) subject.get(StringPool.ITEMS); - if (!items.contains(type)) { - items.add(type); - } - } else { - items = List.of(type); - - } - } else { - items = List.of(type); - } - log.debug("Issuing summary VC with items ->{}", StringEscapeUtils.escapeJava(items.toString())); - - //get summery VC of holder - List vcs = holdersCredentialRepository.getByHolderDidAndIssuerDidAndTypeAndStored(holderDid, issuerDid, MIWVerifiableCredentialType.SUMMARY_CREDENTIAL, false); //deleted only not stored VC - if (CollectionUtils.isEmpty(vcs)) { - log.debug("No summery VC found for did ->{}, checking in issuer", StringEscapeUtils.escapeJava(holderDid)); - } else { - //delete old summery VC from holder table, delete only not stored VC - log.debug("Deleting older summary VC fir bpn -{}", holderBpn); - holdersCredentialRepository.deleteAll(vcs); - } - - //issue new summery VC - boolean isSelfIssued = isSelfIssued(holderBpn); - - VerifiableCredentialSubject subject = new VerifiableCredentialSubject(Map.of(StringPool.ID, holderDid, - StringPool.HOLDER_IDENTIFIER, holderBpn, - StringPool.ITEMS, items, - StringPool.TYPE, MIWVerifiableCredentialType.SUMMARY_CREDENTIAL, - StringPool.CONTRACT_TEMPLATE, miwSettings.contractTemplatesUrl())); - - List types = List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - - CredentialCreationConfig holdersCredentialCreationConfig = CredentialCreationConfig.builder() - .encoding(VerifiableEncoding.JSON_LD) - .subject(subject) - .types(types) - .issuerDoc(issuerDidDocument) - .keyName(miwSettings.authorityWalletBpn()) - .holderDid(holderDid) - .contexts(miwSettings.summaryVcContexts()) - .expiryDate(miwSettings.vcExpiryDate()) - .selfIssued(isSelfIssued) - .algorithm(algorithm) - .build(); - - SignerResult result = availableSigningServices.get(signingServiceType).createCredential(holdersCredentialCreationConfig); - VerifiableCredential vc = (VerifiableCredential) result.getJsonLd(); - HoldersCredential holdersCredential = CommonUtils.convertVerifiableCredential(vc, holdersCredentialCreationConfig); - - //save in holder wallet - holdersCredentialRepository.save(holdersCredential); - - //Store Credential in issuers table - issuersCredentialRepository.save(IssuersCredential.of(holdersCredential)); - - log.info("Summery VC updated for holder did -> {}", StringEscapeUtils.escapeJava(holderDid)); - } - - private Page getLastIssuedSummaryCredential(String issuerDid, String holderDid) { - FilterRequest filterRequest = new FilterRequest(); - - //we need latest one record - filterRequest.setPage(0); - filterRequest.setSize(1); - Sort sort = new Sort(); - sort.setColumn(StringPool.CREATED_AT); - sort.setSortType(SortType.valueOf("desc".toUpperCase())); - filterRequest.setSort(sort); - - filterRequest.appendCriteria(StringPool.HOLDER_DID, Operator.EQUALS, holderDid); - filterRequest.appendCriteria(StringPool.ISSUER_DID, Operator.EQUALS, issuerDid); - filterRequest.appendCriteria(StringPool.TYPE, Operator.EQUALS, MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - - return filter(filterRequest); - } - /** * Sets key service. * diff --git a/miw/src/main/resources/application.yaml b/miw/src/main/resources/application.yaml index 3c01dcab1..aa638730d 100644 --- a/miw/src/main/resources/application.yaml +++ b/miw/src/main/resources/application.yaml @@ -97,11 +97,8 @@ miw: authoritySigningServiceType: ${AUTHORITY_SIGNING_SERVICE_TYPE:LOCAL} localSigningKeyStorageType: ${LOCAL_SIGNING_KEY_STORAGE_TYPE:DB} vcContexts: ${VC_SCHEMA_LINK:https://www.w3.org/2018/credentials/v1, https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json} - summaryVcContexts: ${SUMMARY_VC_SCHEMA_LINK:https://www.w3.org/2018/credentials/v1, https://catenax-ng.github.io/product-core-schemas/SummaryVC.json} vcExpiryDate: ${VC_EXPIRY_DATE:01-10-2023} #dd-MM-yyyy ie. 01-01-2025 expiry date will be 2024-12-31T18:30:00Z in VC - supportedFrameworkVCTypes: ${SUPPORTED_FRAMEWORK_VC_TYPES:PcfCredential, SustainabilityCredential, QualityCredential, TraceabilityCredential, BehaviorTwinCredential, ResiliencyCredential} enforceHttps: ${ENFORCE_HTTPS_IN_DID_RESOLUTION:true} - contractTemplatesUrl: ${CONTRACT_TEMPLATES_URL:https://public.catena-x.org/contracts/} didDocumentContextUrls: ${DID_DOCUMENT_CONTEXT_URL:https://www.w3.org/ns/did/v1,https://w3c.github.io/vc-jws-2020/contexts/v1} security: enabled: true diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java index e64a6e0c7..6ed322807 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java @@ -28,7 +28,6 @@ import com.smartsensesolutions.java.commons.specification.SpecificationUtil; import lombok.SneakyThrows; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.constant.SupportedAlgorithms; import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; @@ -41,9 +40,6 @@ import org.eclipse.tractusx.managedidentitywallets.domain.SigningServiceType; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialVerificationRequest; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialsResponse; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueDismantlerCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueFrameworkCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; import org.eclipse.tractusx.managedidentitywallets.interfaces.SecureTokenService; import org.eclipse.tractusx.managedidentitywallets.signing.LocalKeyProvider; import org.eclipse.tractusx.managedidentitywallets.signing.LocalSigningServiceImpl; @@ -81,11 +77,9 @@ import java.sql.SQLException; import java.time.Duration; import java.time.Instant; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import javax.sql.DataSource; import static com.github.tomakehurst.wiremock.client.WireMock.get; @@ -96,7 +90,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -180,8 +173,7 @@ void shouldIssueCredentialAsJwt() MockUtil.makeFilterWorkForIssuer(issuersCredentialRepository); MockUtil.makeCreateWorkForIssuer(issuersCredentialRepository); - IssueMembershipCredentialRequest issueMembershipCredentialRequest = new IssueMembershipCredentialRequest(); - issueMembershipCredentialRequest.setBpn(holderWalletBpn); + WalletKey walletKey = mock(WalletKey.class); when(walletKey.getKeyId()).thenReturn(KEY_ID); @@ -205,7 +197,9 @@ void shouldIssueCredentialAsJwt() map.put(SigningServiceType.LOCAL, localSigningService); issuersCredentialService.setKeyService(map); - CredentialsResponse credentialsResponse = assertDoesNotThrow( + + //TODO need to check what could be done + /*CredentialsResponse credentialsResponse = assertDoesNotThrow( () -> issuersCredentialService.issueMembershipCredential( issueMembershipCredentialRequest, true, @@ -213,7 +207,7 @@ void shouldIssueCredentialAsJwt() validateCredentialResponse(credentialsResponse, MockUtil.buildDidDocument(new Did(new DidMethod("web"), new DidMethodIdentifier("basewallet"), - null), keyPair)); + null), keyPair));*/ } } @@ -237,16 +231,14 @@ void shouldIssueCredentialAsJwt() MockUtil.makeCreateWorkForIssuer(issuersCredentialRepository); - when(holdersCredentialRepository.getByHolderDidAndIssuerDidAndTypeAndStored( + //TODO need to check + /*when(holdersCredentialRepository.getByHolderDidAndIssuerDidAndTypeAndStored( any(String.class), any(String.class), eq(MIWVerifiableCredentialType.SUMMARY_CREDENTIAL), eq(false) - )).thenReturn(Collections.emptyList()); + )).thenReturn(Collections.emptyList());*/ - IssueFrameworkCredentialRequest request = TestUtils.getIssueFrameworkCredentialRequest( - holderWalletBpn, - "SustainabilityCredential"); WalletKey walletKey = mock(WalletKey.class); when(walletKey.getKeyId()).thenReturn(KEY_ID); when(walletKey.getId()).thenReturn(42L); @@ -270,11 +262,13 @@ void shouldIssueCredentialAsJwt() issuersCredentialService.setKeyService(map); - CredentialsResponse credentialsResponse = assertDoesNotThrow( + + //TODO need to check what could be done + /* CredentialsResponse credentialsResponse = assertDoesNotThrow( () -> issuersCredentialService.issueFrameworkCredential(request, true, baseWalletBpn)); validateCredentialResponse(credentialsResponse, MockUtil.buildDidDocument(new Did(new DidMethod("web"), new DidMethodIdentifier("basewallet"), - null), keyPair)); + null), keyPair));*/ } } @@ -296,10 +290,7 @@ void shouldIssueCredentialAsJwt() throws InvalidPrivateKeyFormatException, MockUtil.makeFilterWorkForIssuer(issuersCredentialRepository); MockUtil.makeCreateWorkForIssuer(issuersCredentialRepository); - IssueDismantlerCredentialRequest request = new IssueDismantlerCredentialRequest(); - request.setActivityType("dunno"); - request.setBpn(holderWalletBpn); - request.setAllowedVehicleBrands(Collections.emptySet()); + WalletKey walletKey = mock(WalletKey.class); when(walletKey.getKeyId()).thenReturn(KEY_ID); @@ -322,11 +313,13 @@ void shouldIssueCredentialAsJwt() throws InvalidPrivateKeyFormatException, map.put(SigningServiceType.LOCAL, localSigningService); issuersCredentialService.setKeyService(map); - CredentialsResponse credentialsResponse = assertDoesNotThrow( + + //TODO need to check + /* CredentialsResponse credentialsResponse = assertDoesNotThrow( () -> issuersCredentialService.issueDismantlerCredential(request, true, baseWalletBpn)); validateCredentialResponse(credentialsResponse, MockUtil.buildDidDocument(new Did(new DidMethod("web"), new DidMethodIdentifier("basewallet"), - null), keyPair)); + null), keyPair));*/ } } @@ -493,13 +486,11 @@ private void mockCommon( KeyPair keyPair, Wallet baseWallet, Wallet holderWallet) { - when(miwSettings.contractTemplatesUrl()).thenReturn("https://templates.com"); when(miwSettings.authorityWalletBpn()).thenReturn(baseWalletBpn); when(commonService.getWalletByIdentifier(baseWalletBpn)).thenReturn(baseWallet); when(commonService.getWalletByIdentifier(holderWalletBpn)).thenReturn(holderWallet); when(walletKeyService.getPrivateKeyByWalletIdAsBytes(baseWallet.getId(), baseWallet.getAlgorithm())) .thenReturn(keyPair.getPrivateKey().asByte()); - when(miwSettings.supportedFrameworkVCTypes()).thenReturn(Set.of("SustainabilityCredential")); when(holdersCredentialRepository.save(any(HoldersCredential.class))) .thenAnswer(new Answer() { @Override diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java index 066847b3d..32dfa9109 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java @@ -33,22 +33,14 @@ import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.IssuersCredential; import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.HoldersCredentialRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.IssuersCredentialRepository; import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; import org.eclipse.tractusx.managedidentitywallets.domain.SigningServiceType; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueFrameworkCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; import org.eclipse.tractusx.ssi.lib.model.did.DidDocument; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; import org.jetbrains.annotations.NotNull; import org.json.JSONArray; import org.json.JSONException; @@ -128,24 +120,6 @@ public static void checkVC(VerifiableCredential verifiableCredential, MIWSetting Assertions.assertEquals(0, verifiableCredential.getExpirationDate().compareTo(miwSettings.vcExpiryDate().toInstant())); } - public static ResponseEntity issueMembershipVC(TestRestTemplate restTemplate, String bpn, String baseWalletBpn) { - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(baseWalletBpn); - IssueMembershipCredentialRequest request = IssueMembershipCredentialRequest.builder().bpn(bpn).build(); - HttpEntity entity = new HttpEntity<>(request, headers); - - return restTemplate.exchange(RestURI.CREDENTIALS_ISSUER_MEMBERSHIP, HttpMethod.POST, entity, String.class); - } - - public static IssueFrameworkCredentialRequest getIssueFrameworkCredentialRequest(String bpn, String type) { - IssueFrameworkCredentialRequest twinRequest = IssueFrameworkCredentialRequest.builder() - .contractTemplate("http://localhost") - .contractVersion("v1") - .type(type) - .holderIdentifier(bpn) - .build(); - return twinRequest; - } - public static Wallet getWalletFromString(String body) throws JsonProcessingException, JSONException { JSONObject jsonObject = new JSONObject(body); @@ -177,37 +151,6 @@ public static Wallet getWalletFromString(String body) throws JsonProcessingExcep } - public static String getSummaryCredentialId(String holderDID, HoldersCredentialRepository holdersCredentialRepository) { - List holderVCs = holdersCredentialRepository.getByHolderDidAndType(holderDID, MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - Assertions.assertEquals(1, holderVCs.size()); - return holderVCs.get(0).getData().getId().toString(); - } - - public static void checkSummaryCredential(String issuerDID, String holderDID, HoldersCredentialRepository holdersCredentialRepository, - IssuersCredentialRepository issuersCredentialRepository, String type, String previousSummaryCredentialId) { - - //get VC from holder of Summary type - List holderVCs = holdersCredentialRepository.getByHolderDidAndType(holderDID, MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - Assertions.assertEquals(1, holderVCs.size()); - VerifiableCredential vc = holderVCs.get(0).getData(); - VerifiableCredentialSubject subject = vc.getCredentialSubject().get(0); - - //check if type is in items - List list = (List) subject.get(StringPool.ITEMS); - Assertions.assertTrue(list.contains(type)); - - //check in issuer table - List issuerVCs = issuersCredentialRepository.getByIssuerDidAndHolderDidAndType(issuerDID, holderDID, - MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - IssuersCredential issuersCredential = issuerVCs.stream() - .filter(issuerVC -> issuerVC.getCredentialId().equalsIgnoreCase(vc.getId().toString())).findFirst() - .orElse(null); - Assertions.assertNotNull(issuersCredential); - IssuersCredential previousIssuersCredential = issuerVCs.stream() - .filter(issuerVC -> issuerVC.getCredentialId().equalsIgnoreCase(previousSummaryCredentialId)).findFirst() - .orElse(null); - Assertions.assertNotNull(previousIssuersCredential); - } @NotNull diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/DismantlerHoldersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/DismantlerHoldersCredentialTest.java deleted file mode 100644 index dbe29b873..000000000 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/DismantlerHoldersCredentialTest.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.vc; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; -import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; -import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; -import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; -import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.IssuersCredential; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.HoldersCredentialRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.IssuersCredentialRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletKeyRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueDismantlerCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.service.IssuersCredentialService; -import org.eclipse.tractusx.managedidentitywallets.utils.AuthenticationUtils; -import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; -import org.eclipse.tractusx.ssi.lib.did.web.DidWebFactory; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; -import org.json.JSONException; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ContextConfiguration; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COLON_SEPARATOR; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {ManagedIdentityWalletsApplication.class}) -@ContextConfiguration(initializers = {TestContextInitializer.class}) -class DismantlerHoldersCredentialTest { - @Autowired - private HoldersCredentialRepository holdersCredentialRepository; - @Autowired - private WalletRepository walletRepository; - - @Autowired - private WalletKeyRepository walletKeyRepository; - - @Autowired - private TestRestTemplate restTemplate; - - @Autowired - private MIWSettings miwSettings; - - @Autowired - private IssuersCredentialRepository issuersCredentialRepository; - - @Autowired - private IssuersCredentialService issuersCredentialService; - - - @Test - void issueDismantlerCredentialTest403() { - String bpn = TestUtils.getRandomBpmNumber(); - - HttpHeaders headers = AuthenticationUtils.getInvalidUserHttpHeaders(); - - IssueMembershipCredentialRequest request = IssueMembershipCredentialRequest.builder().bpn(bpn).build(); - - HttpEntity entity = new HttpEntity<>(request, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.CREDENTIALS_ISSUER_DISMANTLER, HttpMethod.POST, entity, VerifiableCredential.class); - Assertions.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode().value()); - } - - - @Test - void issueDismantlerCredentialToBaseWalletTest201() throws JSONException { - Wallet wallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(wallet, wallet, true); - String oldSummaryCredentialId = TestUtils.getSummaryCredentialId(wallet.getDid(), holdersCredentialRepository); - ResponseEntity response = issueDismantlerCredential(miwSettings.authorityWalletBpn(), miwSettings.authorityWalletBpn()); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - List credentials = holdersCredentialRepository.getByHolderDidAndType(miwSettings.authorityWalletDid(), MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL); - Assertions.assertFalse(credentials.isEmpty()); - Assertions.assertTrue(credentials.get(0).isSelfIssued()); //self issued must be false - Assertions.assertFalse(credentials.get(0).isStored()); //stored must be false - //check summary credential - TestUtils.checkSummaryCredential(miwSettings.authorityWalletDid(), wallet.getDid(), holdersCredentialRepository, issuersCredentialRepository, MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL, oldSummaryCredentialId); - } - - - @Test - void issueDismantlerCredentialTest201() throws JsonProcessingException, JSONException { - - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - String baseBpn = miwSettings.authorityWalletBpn(); - - //create wallet - String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - Wallet wallet = TestUtils.getWalletFromString(TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation).getBody()); - generateBpnCredential(wallet); - String oldSummaryCredentialId = TestUtils.getSummaryCredentialId(wallet.getDid(), holdersCredentialRepository); - - ResponseEntity response = issueDismantlerCredential(bpn, did); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - ObjectMapper objectMapper = new ObjectMapper(); - Map map = objectMapper.readValue(response.getBody(), Map.class); - VerifiableCredential verifiableCredential = new VerifiableCredential(map); - Assertions.assertTrue(verifiableCredential.getTypes().contains(MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL)); - - TestUtils.checkVC(verifiableCredential, miwSettings); - - - Assertions.assertEquals(StringPool.VEHICLE_DISMANTLE, verifiableCredential.getCredentialSubject().get(0).get(StringPool.ACTIVITY_TYPE).toString()); - - List credentials = holdersCredentialRepository.getByHolderDidAndType(wallet.getDid(), MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL); - Assertions.assertFalse(credentials.isEmpty()); - TestUtils.checkVC(credentials.get(0).getData(), miwSettings); - Assertions.assertFalse(credentials.get(0).isSelfIssued()); //self issued must be false - Assertions.assertFalse(credentials.get(0).isStored()); //stored must be false - - VerifiableCredential data = credentials.get(0).getData(); - - Assertions.assertEquals(StringPool.VEHICLE_DISMANTLE, data.getCredentialSubject().get(0).get(StringPool.ACTIVITY_TYPE).toString()); - - //check in issuer wallet - List issuerVCs = issuersCredentialRepository.getByIssuerDidAndHolderDidAndType(miwSettings.authorityWalletDid(), wallet.getDid(), MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL); - Assertions.assertEquals(1, issuerVCs.size()); - TestUtils.checkVC(issuerVCs.get(0).getData(), miwSettings); - Assertions.assertEquals(StringPool.VEHICLE_DISMANTLE, issuerVCs.get(0).getData().getCredentialSubject().get(0).get(StringPool.ACTIVITY_TYPE).toString()); - - //check summary credential - TestUtils.checkSummaryCredential(miwSettings.authorityWalletDid(), wallet.getDid(), holdersCredentialRepository, issuersCredentialRepository, MIWVerifiableCredentialType.DISMANTLER_CREDENTIAL, oldSummaryCredentialId); - } - - @Test - void issueDismantlerCredentialWithInvalidBpnAccess409() { - String bpn = TestUtils.getRandomBpmNumber(); - - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - - //create entry - Wallet wallet = TestUtils.createWallet(bpn, did, walletRepository); - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); //token must contain base wallet BPN - - IssueDismantlerCredentialRequest request = IssueDismantlerCredentialRequest.builder() - .activityType(StringPool.VEHICLE_DISMANTLE) - .bpn(bpn) - .allowedVehicleBrands(Set.of("BMW")) - .build(); - - - HttpEntity entity = new HttpEntity<>(request, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.CREDENTIALS_ISSUER_DISMANTLER, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode().value()); - - } - - @Test - void issueDismantlerCredentialWithoutAllowedVehicleBrands() { - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - Wallet wallet = TestUtils.createWallet(bpn, did, walletRepository); - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); //token must contain base wallet BPN - - IssueDismantlerCredentialRequest request = IssueDismantlerCredentialRequest.builder() - .activityType(StringPool.VEHICLE_DISMANTLE) - .bpn(bpn) - .allowedVehicleBrands(null) - .build(); - - HttpEntity entity = new HttpEntity<>(request, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.CREDENTIALS_ISSUER_DISMANTLER, HttpMethod.POST, entity, String.class); - - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - } - - @Test - void issueDismantlerCredentialWithDuplicateBpn409() { - - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - - //create entry - Wallet wallet = TestUtils.createWallet(bpn, did, walletRepository); - ResponseEntity response = issueDismantlerCredential(bpn, did); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - //issue duplicate - ResponseEntity duplicateResponse = issueDismantlerCredential(bpn, did); - Assertions.assertEquals(HttpStatus.CONFLICT.value(), duplicateResponse.getStatusCode().value()); - } - - - private ResponseEntity issueDismantlerCredential(String bpn, String did) { - - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); //token must contain base wallet BPN - - IssueDismantlerCredentialRequest request = IssueDismantlerCredentialRequest.builder() - .activityType(StringPool.VEHICLE_DISMANTLE) - .bpn(bpn) - .allowedVehicleBrands(Set.of("BMW")) - .build(); - - - HttpEntity entity = new HttpEntity<>(request, headers); - - return restTemplate.exchange(RestURI.CREDENTIALS_ISSUER_DISMANTLER, HttpMethod.POST, entity, String.class); - } - - private void generateBpnCredential(Wallet holderWallet) { - Wallet issuerWallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(issuerWallet, holderWallet, false); - } -} diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/FrameworkHoldersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/FrameworkHoldersCredentialTest.java deleted file mode 100644 index 23a0b028b..000000000 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/FrameworkHoldersCredentialTest.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.vc; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; -import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; -import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; -import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; -import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.IssuersCredential; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.HoldersCredentialRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.IssuersCredentialRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueFrameworkCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.service.IssuersCredentialService; -import org.eclipse.tractusx.managedidentitywallets.utils.AuthenticationUtils; -import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; -import org.eclipse.tractusx.ssi.lib.did.web.DidWebFactory; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; -import org.json.JSONException; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ContextConfiguration; - -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; - -import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COLON_SEPARATOR; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {ManagedIdentityWalletsApplication.class}) -@ContextConfiguration(initializers = {TestContextInitializer.class}) -class FrameworkHoldersCredentialTest { - @Autowired - private HoldersCredentialRepository holdersCredentialRepository; - @Autowired - private WalletRepository walletRepository; - - @Autowired - private TestRestTemplate restTemplate; - - @Autowired - private MIWSettings miwSettings; - - @Autowired - private IssuersCredentialRepository issuersCredentialRepository; - - @Autowired - private IssuersCredentialService issuersCredentialService; - - - @Test - void issueFrameworkCredentialTest403() { - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - HttpHeaders headers = AuthenticationUtils.getInvalidUserHttpHeaders(); - - IssueMembershipCredentialRequest request = IssueMembershipCredentialRequest.builder().bpn(bpn).build(); - - HttpEntity entity = new HttpEntity<>(request, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, VerifiableCredential.class); - Assertions.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode().value()); - } - - @Test - void issueFrameworkCredentialWithInvalidBpnAccessTest403() throws JSONException { - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - TestUtils.createWallet(bpn, did, walletRepository); - - String type = "BehaviorTwinCredential"; - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); - - IssueFrameworkCredentialRequest twinRequest = TestUtils.getIssueFrameworkCredentialRequest(bpn, type); - - HttpEntity entity = new HttpEntity<>(twinRequest, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode().value()); - } - - @Test - void issueFrameWorkVCToBaseWalletTest201() throws JSONException { - String bpn = miwSettings.authorityWalletBpn(); - String type = "PcfCredential"; - //create wallet - Wallet wallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(wallet, wallet, true); - String oldSummaryCredentialId = TestUtils.getSummaryCredentialId(wallet.getDid(), holdersCredentialRepository); - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); - - IssueFrameworkCredentialRequest twinRequest = TestUtils.getIssueFrameworkCredentialRequest(bpn, type); - - HttpEntity entity = new HttpEntity<>(twinRequest, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - List credentials = holdersCredentialRepository.getByHolderDidAndType(miwSettings.authorityWalletDid(), MIWVerifiableCredentialType.USE_CASE_FRAMEWORK_CONDITION); - Assertions.assertFalse(credentials.isEmpty()); - - VerifiableCredential vcFromDB = credentials.get(0).getData(); - TestUtils.checkVC(vcFromDB, miwSettings); - - Assertions.assertFalse(credentials.get(0).isStored()); //stored must be false - Assertions.assertTrue(credentials.get(0).isSelfIssued()); //self issue must be false - - //check summary credential - TestUtils.checkSummaryCredential(miwSettings.authorityWalletDid(), wallet.getDid(), holdersCredentialRepository, issuersCredentialRepository, type, oldSummaryCredentialId); - } - - @ParameterizedTest - @MethodSource("getTypes") - void issueFrameWorkVCTest201(IssueFrameworkCredentialRequest request) throws JsonProcessingException, JSONException { - String bpn = request.getHolderIdentifier(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - - String type = request.getType(); - - createAndValidateVC(bpn, type); - //check in issuer tables - List issuerVCs = issuersCredentialRepository.getByIssuerDidAndHolderDidAndType(miwSettings.authorityWalletDid(), did, MIWVerifiableCredentialType.USE_CASE_FRAMEWORK_CONDITION); - Assertions.assertEquals(1, issuerVCs.size()); - } - - static Stream getTypes() { - return Stream.of( - IssueFrameworkCredentialRequest.builder().holderIdentifier(TestUtils.getRandomBpmNumber()).type("BehaviorTwinCredential").build(), - IssueFrameworkCredentialRequest.builder().holderIdentifier(TestUtils.getRandomBpmNumber()).type("PcfCredential").build(), - IssueFrameworkCredentialRequest.builder().holderIdentifier(TestUtils.getRandomBpmNumber()).type("QualityCredential").build(), - IssueFrameworkCredentialRequest.builder().holderIdentifier(TestUtils.getRandomBpmNumber()).type("ResiliencyCredential").build(), - IssueFrameworkCredentialRequest.builder().holderIdentifier(TestUtils.getRandomBpmNumber()).type("SustainabilityCredential").build(), - IssueFrameworkCredentialRequest.builder().holderIdentifier(TestUtils.getRandomBpmNumber()).type("TraceabilityCredential").build() - ); - } - - - @Test - @DisplayName("Issue framework with invalid type") - void issueFrameworkCredentialTest400() throws JSONException { - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - Wallet wallet = TestUtils.createWallet(bpn, did, walletRepository); - - - String type = "cx-traceability1"; - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); - - IssueFrameworkCredentialRequest twinRequest = TestUtils.getIssueFrameworkCredentialRequest(bpn, type); - - HttpEntity entity = new HttpEntity<>(twinRequest, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(HttpStatus.BAD_REQUEST.value(), response.getStatusCode().value()); - - } - - private void createAndValidateVC(String bpn, String type) throws JsonProcessingException, JSONException { - //create wallet - String baseBpn = miwSettings.authorityWalletBpn(); - String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - Wallet wallet = TestUtils.getWalletFromString(TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation).getBody()); - generateBpnCredential(wallet); - String oldSummaryCredentialId = TestUtils.getSummaryCredentialId(wallet.getDid(), holdersCredentialRepository); - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); - - IssueFrameworkCredentialRequest twinRequest = TestUtils.getIssueFrameworkCredentialRequest(bpn, type); - - HttpEntity entity = new HttpEntity<>(twinRequest, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - validate(wallet, type, response, miwSettings, oldSummaryCredentialId); - - } - - private void validate(Wallet wallet, String type, ResponseEntity response, MIWSettings miwSettings, String oldSummaryCredentialId) throws JsonProcessingException { - ObjectMapper objectMapper = new ObjectMapper(); - Map map = objectMapper.readValue(response.getBody(), Map.class); - VerifiableCredential verifiableCredential = new VerifiableCredential(map); - Assertions.assertTrue(verifiableCredential.getTypes().contains(MIWVerifiableCredentialType.USE_CASE_FRAMEWORK_CONDITION)); - - TestUtils.checkVC(verifiableCredential, miwSettings); - - Assertions.assertEquals(verifiableCredential.getCredentialSubject().get(0).get(StringPool.TYPE), type); - Assertions.assertEquals(verifiableCredential.getCredentialSubject().get(0).get(StringPool.HOLDER_IDENTIFIER), wallet.getBpn()); - - Assertions.assertEquals(verifiableCredential.getCredentialSubject().get(0).get(StringPool.ID), wallet.getDid()); - - List credentials = holdersCredentialRepository.getByHolderDidAndType(wallet.getDid(), MIWVerifiableCredentialType.USE_CASE_FRAMEWORK_CONDITION); - Assertions.assertFalse(credentials.isEmpty()); - - VerifiableCredential vcFromDB = credentials.get(0).getData(); - TestUtils.checkVC(vcFromDB, miwSettings); - - Assertions.assertFalse(credentials.get(0).isStored()); //stored must be false - Assertions.assertFalse(credentials.get(0).isSelfIssued()); //self issue must be false - Assertions.assertEquals(vcFromDB.getCredentialSubject().get(0).get(StringPool.TYPE), type); - Assertions.assertEquals(vcFromDB.getCredentialSubject().get(0).get(StringPool.ID), wallet.getDid()); - Assertions.assertEquals(vcFromDB.getCredentialSubject().get(0).get(StringPool.HOLDER_IDENTIFIER), wallet.getBpn()); - - //check summary credential - TestUtils.checkSummaryCredential(miwSettings.authorityWalletDid(), wallet.getDid(), holdersCredentialRepository, issuersCredentialRepository, type, oldSummaryCredentialId); - } - - private void generateBpnCredential(Wallet holderWallet) { - Wallet issuerWallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(issuerWallet, holderWallet, false); - } -} diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java index ccab25372..4fc9899b1 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java @@ -27,7 +27,6 @@ import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.controller.IssuersCredentialController; @@ -36,7 +35,6 @@ import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialVerificationRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueFrameworkCredentialRequest; import org.eclipse.tractusx.managedidentitywallets.utils.AuthenticationUtils; import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; import org.eclipse.tractusx.ssi.lib.did.resolver.DidResolver; @@ -54,9 +52,7 @@ import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialType; import org.eclipse.tractusx.ssi.lib.proof.LinkedDataProofValidation; import org.eclipse.tractusx.ssi.lib.serialization.SerializeUtil; -import org.json.JSONArray; import org.json.JSONException; -import org.json.JSONObject; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -162,27 +158,10 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); //save wallet TestUtils.createWallet(bpn, did, walletRepository); - TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - String vcList = """ - [ - {"type":"TraceabilityCredential"}, - {"type":"SustainabilityCredential"}, - {"type":"ResiliencyCredential"}, - {"type":"QualityCredential"}, - {"type":"PcfCredential"} - ] - """; - JSONArray jsonArray = new JSONArray(vcList); - - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - IssueFrameworkCredentialRequest request = TestUtils.getIssueFrameworkCredentialRequest(bpn, jsonObject.get(StringPool.TYPE).toString()); - HttpEntity entity = new HttpEntity<>(request, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn())); //ony base wallet can issue VC - ResponseEntity exchange = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(exchange.getStatusCode().value(), HttpStatus.CREATED.value()); - } + //TODO need to issue some VCs to get VC + HttpEntity entity = new HttpEntity<>(headers); ResponseEntity response = restTemplate.exchange(RestURI.CREDENTIALS + "?issuerIdentifier={did}" @@ -198,27 +177,13 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); List list = new ArrayList<>(); - list.add(MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL); + //TODO need to get VC which are issued response = restTemplate.exchange(RestURI.CREDENTIALS + "?type={list}" , HttpMethod.GET, entity, String.class, String.join(",", list)); credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); - list = new ArrayList<>(); - list.add(MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - response = restTemplate.exchange(RestURI.CREDENTIALS + "?type={list}" - , HttpMethod.GET, entity, String.class, String.join(",", list)); - credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); - Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); - Assertions.assertEquals(1, credentialList.size()); - VerifiableCredentialSubject subject = credentialList.get(0).getCredentialSubject().get(0); - List itemList = (List) subject.get(StringPool.ITEMS); - Assertions.assertTrue(itemList.contains(MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL)); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - Assertions.assertTrue(itemList.contains(jsonObject.get(StringPool.TYPE).toString())); - } } @@ -233,29 +198,9 @@ void getCredentialsAsJWT200() throws JSONException { HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); // save wallet TestUtils.createWallet(bpn, did, walletRepository); - TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - String vcList = """ - [ - {"type":"TraceabilityCredential"}, - {"type":"SustainabilityCredential"}, - {"type":"ResiliencyCredential"}, - {"type":"QualityCredential"}, - {"type":"PcfCredential"} - ] - """; - JSONArray jsonArray = new JSONArray(vcList); - - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - IssueFrameworkCredentialRequest request = TestUtils.getIssueFrameworkCredentialRequest(bpn, - jsonObject.get(StringPool.TYPE).toString()); - HttpEntity entity = new HttpEntity<>(request, - AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn())); // ony base wallet - // can issue VC - ResponseEntity exchange = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, - HttpMethod.POST, entity, String.class); - Assertions.assertEquals(exchange.getStatusCode().value(), HttpStatus.CREATED.value()); - } + + + //TODO need to issue some VCs HttpEntity entity = new HttpEntity<>(headers); @@ -380,7 +325,9 @@ private Map issueVC() throws JsonProcessingException { String baseBpn = miwSettings.authorityWalletBpn(); String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; TestUtils.createWallet(bpn, "Test", restTemplate, baseBpn, defaultLocation); - ResponseEntity vc = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); + + //TODO need to issue some random VC + ResponseEntity vc = null; VerifiableCredential verifiableCredential = new VerifiableCredential(new ObjectMapper().readValue(vc.getBody(), Map.class)); Map map = objectMapper.readValue(verifiableCredential.toJson(), Map.class); return map; diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java index 8f96a1dd6..139b0c875 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java @@ -27,7 +27,6 @@ import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; @@ -36,7 +35,6 @@ import org.eclipse.tractusx.managedidentitywallets.dao.repository.IssuersCredentialRepository; import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueFrameworkCredentialRequest; import org.eclipse.tractusx.managedidentitywallets.utils.AuthenticationUtils; import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; import org.eclipse.tractusx.ssi.lib.did.web.DidWebFactory; @@ -45,9 +43,7 @@ import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialType; import org.eclipse.tractusx.ssi.lib.serialization.SerializeUtil; -import org.json.JSONArray; import org.json.JSONException; -import org.json.JSONObject; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -98,25 +94,10 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(baseBPN); //save wallet TestUtils.createWallet(holderBpn, holderDID, walletRepository); - TestUtils.issueMembershipVC(restTemplate, holderBpn, baseBPN); - String vcList = """ - [ - {"type":"TraceabilityCredential"}, - {"type":"SustainabilityCredential"}, - {"type":"ResiliencyCredential"}, - {"type":"QualityCredential"}, - {"type":"PcfCredential"} - ] - """; - JSONArray jsonArray = new JSONArray(vcList); - - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - IssueFrameworkCredentialRequest request = TestUtils.getIssueFrameworkCredentialRequest(holderBpn, jsonObject.get(StringPool.TYPE).toString()); - HttpEntity entity = new HttpEntity<>(request, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn())); //ony base wallet can issue VC - ResponseEntity exchange = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(exchange.getStatusCode().value(), HttpStatus.CREATED.value()); - } + + //TODO issue some random VC before testing get VC API + // TestUtils.issueMembershipVC(restTemplate, holderBpn, baseBPN); + HttpEntity entity = new HttpEntity<>(headers); @@ -136,28 +117,13 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); List list = new ArrayList<>(); - list.add(MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL); + //TODO need to check issued VC are present in response response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?type={list}" , HttpMethod.GET, entity, String.class, String.join(",", list)); credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); - //all VC must be type of MEMBERSHIP_CREDENTIAL_CX - credentialList.forEach(vc -> { - Assertions.assertTrue(vc.getTypes().contains(MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL)); - }); - - list = new ArrayList<>(); - list.add(MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?type={list}&holderIdentifier={did}" - , HttpMethod.GET, entity, String.class, String.join(",", list), holderDID); - credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); - Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); - Assertions.assertEquals(6, Objects.requireNonNull(credentialList).size()); //5 framework CV + 1 membership - for (VerifiableCredential vc : credentialList) { - Assertions.assertEquals(3, vc.getContext().size(), "Each credential requires 3 contexts"); - } } @Test @@ -169,22 +135,9 @@ void getCredentialsAsJWT200() throws JSONException { HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(baseBPN); //save wallet TestUtils.createWallet(holderBpn, holderDID, walletRepository); - TestUtils.issueMembershipVC(restTemplate, holderBpn, baseBPN); - String vcList = """ - [ - {"type":"TraceabilityCredential"}, - {"type":"SustainabilityCredential"}, - {"type":"ResiliencyCredential"}, - {"type":"QualityCredential"}, - {"type":"PcfCredential"} - ] - """; - JSONArray jsonArray = new JSONArray(vcList); - - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - issueFrameworkCredential(holderBpn, jsonObject.get(StringPool.TYPE).toString()); - } + + //TODO need to issue some VCs + HttpEntity entity = new HttpEntity<>(headers); @@ -243,20 +196,7 @@ void issueCredentialsToBaseWallet200() throws JsonProcessingException { Assertions.assertFalse(credentials.get(0).isStored()); //stored must be false Assertions.assertTrue(credentials.get(0).isSelfIssued()); //stored must be true } - - - @Test - void issueSummaryCredentials400() throws com.fasterxml.jackson.core.JsonProcessingException { - - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); - - ResponseEntity response = issueVC(bpn, did, miwSettings.authorityWalletDid(), MIWVerifiableCredentialType.SUMMARY_CREDENTIAL, headers); - - Assertions.assertEquals(HttpStatus.BAD_REQUEST.value(), response.getStatusCode().value()); - } - + @Test void issueCredentials200() throws com.fasterxml.jackson.core.JsonProcessingException { @@ -315,13 +255,4 @@ private ResponseEntity issueVC(String bpn, String holderDid, String issu HttpEntity entity = new HttpEntity<>(map, headers); return restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderDid={did}", HttpMethod.POST, entity, String.class, holderDid); } - - private void issueFrameworkCredential(String holderBpn, String type) { - IssueFrameworkCredentialRequest request = TestUtils.getIssueFrameworkCredentialRequest(holderBpn, type); - HttpEntity entity = new HttpEntity<>(request, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn())); //ony base wallet can issue VC - ResponseEntity exchange = null; - exchange = restTemplate.exchange(RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(exchange.getStatusCode().value(), HttpStatus.CREATED.value()); - } - } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java deleted file mode 100644 index 9e265c50c..000000000 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ****************************************************************************** - */ - -package org.eclipse.tractusx.managedidentitywallets.vc; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; -import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; -import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; -import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; -import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.IssuersCredential; -import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.HoldersCredentialRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.IssuersCredentialRepository; -import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; -import org.eclipse.tractusx.managedidentitywallets.service.IssuersCredentialService; -import org.eclipse.tractusx.managedidentitywallets.utils.AuthenticationUtils; -import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; -import org.eclipse.tractusx.ssi.lib.did.web.DidWebFactory; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; -import org.jetbrains.annotations.NotNull; -import org.json.JSONException; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ContextConfiguration; - -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COLON_SEPARATOR; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = { ManagedIdentityWalletsApplication.class }) -@ContextConfiguration(initializers = { TestContextInitializer.class }) -class MembershipHoldersCredentialTest { - @Autowired - private HoldersCredentialRepository holdersCredentialRepository; - @Autowired - private WalletRepository walletRepository; - - @Autowired - private TestRestTemplate restTemplate; - - @Autowired - private MIWSettings miwSettings; - - @Autowired - private IssuersCredentialRepository issuersCredentialRepository; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private IssuersCredentialService issuersCredentialService; - - - @Test - void issueMembershipCredentialTest403() { - String bpn = TestUtils.getRandomBpmNumber(); - - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - - HttpHeaders headers = AuthenticationUtils.getInvalidUserHttpHeaders(); - - IssueMembershipCredentialRequest request = IssueMembershipCredentialRequest.builder().bpn(bpn).build(); - - HttpEntity entity = new HttpEntity<>(request, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.CREDENTIALS_ISSUER_MEMBERSHIP, HttpMethod.POST, entity, VerifiableCredential.class); - Assertions.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode().value()); - } - - @Test - void testIssueSummeryVCAfterDeleteSummaryVCFromHolderWallet() throws JsonProcessingException, JSONException { - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - String baseBpn = miwSettings.authorityWalletBpn(); - - // create wallet, in background bpn and summary credential generated - String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - Wallet wallet = TestUtils.getWalletFromString(TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation).getBody()); - generateBpnCredential(wallet); - List byHolderDid = holdersCredentialRepository.getByHolderDid(did); - - //delete all VC - holdersCredentialRepository.deleteAll(byHolderDid); - - //issue membership - ResponseEntity response = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - Assertions.assertEquals(response.getStatusCode().value(), HttpStatus.CREATED.value()); - - //check summary VC in holder wallet - List summaryVcs = holdersCredentialRepository.getByHolderDidAndIssuerDidAndTypeAndStored(did, miwSettings.authorityWalletDid(), MIWVerifiableCredentialType.SUMMARY_CREDENTIAL, false); - Assertions.assertFalse(summaryVcs.isEmpty()); - - //check items, it should be 2 - List items = (List) summaryVcs.get(0).getData().getCredentialSubject().get(0).get(StringPool.ITEMS); - - Assertions.assertTrue(items.contains(MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL)); - Assertions.assertTrue(items.contains(MIWVerifiableCredentialType.BPN_CREDENTIAL)); - } - - @Test - void testStoredSummaryVCTest() throws JsonProcessingException, JSONException { - String bpn = TestUtils.getRandomBpmNumber(); - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - String baseBpn = miwSettings.authorityWalletBpn(); - - // create wallet, in background bpn and summary credential generated - String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - Wallet wallet = TestUtils.getWalletFromString(TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation).getBody()); - - - String vc = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "id": "urn:uuid:12345678-1234-1234-1234-123456789abc", - "type": [ - "VerifiableCredential", - "SummaryCredential" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-06-02T12:00:00Z", - "expirationDate": "2022-06-16T18:56:59Z", - "credentialSubject": [{ - "id": "did:web:localhost:BPNL000000000000", - "holderIdentifier": "BPN of holder", - "type": "Summary-List", - "name": "CX-Credentials", - "items": [ - "MembershipCredential","DismantlerCredential","PcfCredential","SustainabilityCredential","QualityCredential","TraceabilityCredential","BehaviorTwinCredential","BpnCredential" - ], - "contract-templates": "https://public.catena-x.org/contracts/" - },{ - "name":"test name" - }], - "proof": { - "type": "Ed25519Signature2018", - "created": "2023-06-02T12:00:00Z", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:web:example.com#key-1", - "jws": "eyJhbGciOiJFZERTQSJ9.eyJpYXQiOjE2MjM1NzA3NDEsImV4cCI6MTYyMzU3NDM0MSwianRpIjoiMTIzNDU2NzgtMTIzNC0xMjM0LTEyMzQtMTIzNDU2Nzg5YWJjIiwicHJvb2YiOnsiaWQiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIiwibmFtZSI6IkJlaXNwaWVsLU9yZ2FuaXNhdGlvbiJ9fQ.SignedExampleSignature" - } - } - """; - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); - - Map map = objectMapper.readValue(vc.replace("##did", did), Map.class); - HttpEntity entity = new HttpEntity<>(map, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.API_WALLETS_IDENTIFIER_CREDENTIALS, HttpMethod.POST, entity, Map.class, bpn); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - //issue membership - ResponseEntity response1 = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - Assertions.assertEquals(HttpStatus.CREATED.value(), response1.getStatusCode().value()); - - //stored VC should not be deleted - List summaryCredential = holdersCredentialRepository.getByHolderDidAndIssuerDidAndTypeAndStored(wallet.getDid(), "did:web:localhost:BPNL000000000000", "SummaryCredential", true); - Assertions.assertFalse(summaryCredential.isEmpty()); - - } - - @Test - void issueMembershipCredentialToBaseWalletTest400() throws JsonProcessingException, JSONException { - String bpn = TestUtils.getRandomBpmNumber(); - String baseBpn = miwSettings.authorityWalletBpn(); - - // create wallet, in background bpn and summary credential generated - String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - Wallet wallet = TestUtils.getWalletFromString(TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation).getBody()); - generateBpnCredential(wallet); - //add 2 subject in VC for testing - List vcs = issuersCredentialRepository.getByIssuerDidAndHolderDidAndType(miwSettings.authorityWalletDid(), wallet.getDid(), MIWVerifiableCredentialType.SUMMARY_CREDENTIAL); - - String vc = """ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "id": "urn:uuid:12345678-1234-1234-1234-123456789abc", - "type": [ - "VerifiableCredential", - "SummaryCredential" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-06-02T12:00:00Z", - "expirationDate": "2022-06-16T18:56:59Z", - "credentialSubject": [{ - "id": "did:web:localhost:BPNL000000000000", - "holderIdentifier": "BPN of holder", - "type": "Summary-List", - "name": "CX-Credentials", - "items": [ - "MembershipCredential","DismantlerCredential","PcfCredential","SustainabilityCredential","QualityCredential","TraceabilityCredential","BehaviorTwinCredential","BpnCredential" - ], - "contract-templates": "https://public.catena-x.org/contracts/" - },{ - "name":"test name" - }], - "proof": { - "type": "Ed25519Signature2018", - "created": "2023-06-02T12:00:00Z", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:web:example.com#key-1", - "jws": "eyJhbGciOiJFZERTQSJ9.eyJpYXQiOjE2MjM1NzA3NDEsImV4cCI6MTYyMzU3NDM0MSwianRpIjoiMTIzNDU2NzgtMTIzNC0xMjM0LTEyMzQtMTIzNDU2Nzg5YWJjIiwicHJvb2YiOnsiaWQiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIiwibmFtZSI6IkJlaXNwaWVsLU9yZ2FuaXNhdGlvbiJ9fQ.SignedExampleSignature" - } - } - """; - VerifiableCredential verifiableCredential = new VerifiableCredential(new ObjectMapper().readValue(vc, Map.class)); - vcs.get(0).setData(verifiableCredential); - - issuersCredentialRepository.save(vcs.get(0)); - - //Check if we do not have items in subject - ResponseEntity response = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - Assertions.assertEquals(HttpStatus.BAD_REQUEST.value(), response.getStatusCode().value()); - - vcs.get(0).getData().getCredentialSubject().remove(1); - vcs.get(0).getData().getCredentialSubject().get(0).remove(StringPool.ITEMS); - issuersCredentialRepository.save(vcs.get(0)); - } - - - @Test - void issueMembershipCredentialToBaseWalletTest201() throws JsonProcessingException, JSONException { - - Wallet wallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(wallet, wallet, true); - String oldSummaryCredentialId = TestUtils.getSummaryCredentialId(wallet.getDid(), holdersCredentialRepository); - - ResponseEntity response = TestUtils.issueMembershipVC(restTemplate, miwSettings.authorityWalletBpn(), miwSettings.authorityWalletBpn()); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - VerifiableCredential verifiableCredential = getVerifiableCredential(response); - - TestUtils.checkVC(verifiableCredential, miwSettings); - - validateTypes(verifiableCredential); - - List holderVCs = holdersCredentialRepository.getByHolderDidAndType(wallet.getDid(), MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL); - Assertions.assertFalse(holderVCs.isEmpty()); - - TestUtils.checkVC(holderVCs.get(0).getData(), miwSettings); - Assertions.assertTrue(holderVCs.get(0).isSelfIssued()); //must be self issued true - Assertions.assertFalse(holderVCs.get(0).isStored()); //store must be false - - //check in issuer tables - List issuerVCs = issuersCredentialRepository.getByIssuerDidAndHolderDidAndType(miwSettings.authorityWalletDid(), wallet.getDid(), MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL); - Assertions.assertEquals(1, issuerVCs.size()); - TestUtils.checkVC(issuerVCs.get(0).getData(), miwSettings); - //check summary credential - TestUtils.checkSummaryCredential(miwSettings.authorityWalletDid(), wallet.getDid(), holdersCredentialRepository, issuersCredentialRepository, MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL, oldSummaryCredentialId); - } - - - @Test - void issueMembershipCredentialTest201() throws JsonProcessingException, JSONException { - - String bpn = TestUtils.getRandomBpmNumber(); - String baseBpn = miwSettings.authorityWalletBpn(); - - //create wallet - String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - Wallet wallet = TestUtils.getWalletFromString(TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation).getBody()); - generateBpnCredential(wallet); - String oldSummaryCredentialId = TestUtils.getSummaryCredentialId(wallet.getDid(), holdersCredentialRepository); - - ResponseEntity response = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - VerifiableCredential verifiableCredential = getVerifiableCredential(response); - - TestUtils.checkVC(verifiableCredential, miwSettings); - - validateTypes(verifiableCredential); - - List holderVCs = holdersCredentialRepository.getByHolderDidAndType(wallet.getDid(), MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL); - Assertions.assertFalse(holderVCs.isEmpty()); - Assertions.assertFalse(holderVCs.get(0).isSelfIssued()); //must be self issued false - Assertions.assertFalse(holderVCs.get(0).isStored()); //store must be false - - - TestUtils.checkVC(holderVCs.get(0).getData(), miwSettings); - - //check in issuer tables - List issuerVCs = issuersCredentialRepository.getByIssuerDidAndHolderDidAndType(miwSettings.authorityWalletDid(), wallet.getDid(), MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL); - Assertions.assertEquals(1, issuerVCs.size()); - TestUtils.checkVC(issuerVCs.get(0).getData(), miwSettings); - - //check summary credential - TestUtils.checkSummaryCredential(miwSettings.authorityWalletDid(), wallet.getDid(), holdersCredentialRepository, issuersCredentialRepository, MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL, oldSummaryCredentialId); - } - - - @Test - void issueMembershipCredentialWithInvalidBpnAccess409() { - String bpn = TestUtils.getRandomBpmNumber(); - - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - - //save wallet - TestUtils.createWallet(bpn, did, walletRepository); - - HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); - IssueMembershipCredentialRequest request = IssueMembershipCredentialRequest.builder().bpn(bpn).build(); - HttpEntity entity = new HttpEntity<>(request, headers); - - ResponseEntity response = restTemplate.exchange(RestURI.CREDENTIALS_ISSUER_MEMBERSHIP, HttpMethod.POST, entity, String.class); - Assertions.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode().value()); - } - - @Test - void issueMembershipCredentialWithDuplicateBpn409() { - - String bpn = TestUtils.getRandomBpmNumber(); - - String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - - //save wallet - TestUtils.createWallet(bpn, did, walletRepository); - - ResponseEntity response = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - - ResponseEntity duplicateResponse = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn()); - - Assertions.assertEquals(HttpStatus.CONFLICT.value(), duplicateResponse.getStatusCode().value()); - } - - - @NotNull - private VerifiableCredential getVerifiableCredential(ResponseEntity response) throws JsonProcessingException { - Map map = objectMapper.readValue(response.getBody(), Map.class); - return new VerifiableCredential(map); - } - - private void validateTypes(VerifiableCredential verifiableCredential) { - Assertions.assertTrue(verifiableCredential.getTypes().contains(MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL)); - Assertions.assertEquals("Test-X", verifiableCredential.getCredentialSubject().get(0).get(StringPool.MEMBER_OF)); - } - - private void generateBpnCredential(Wallet holderWallet) { - Wallet issuerWallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(issuerWallet, holderWallet, false); - } -} diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java index 348a0b759..b77640457 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java @@ -34,8 +34,6 @@ import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; -import org.eclipse.tractusx.managedidentitywallets.dto.CredentialsResponse; -import org.eclipse.tractusx.managedidentitywallets.dto.IssueMembershipCredentialRequest; import org.eclipse.tractusx.managedidentitywallets.service.IssuersCredentialService; import org.eclipse.tractusx.managedidentitywallets.service.PresentationService; import org.eclipse.tractusx.managedidentitywallets.service.WalletService; @@ -117,15 +115,14 @@ public void setup() throws DidParseException { Wallet tenantWallet2 = walletService.createWallet(createWalletRequest2, bpnOperator); tenant_2 = DidParser.parse(tenantWallet2.getDid()); - IssueMembershipCredentialRequest issueMembershipCredentialRequest = new IssueMembershipCredentialRequest(); - issueMembershipCredentialRequest.setBpn(bpnTenant_1); - CredentialsResponse rs1 = issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest, false, bpnOperator); + //TODO need to fix test cases + /*CredentialsResponse rs1 = issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest, false, bpnOperator); membershipCredential_1 = new ObjectMapper().convertValue(rs1, VerifiableCredential.class); IssueMembershipCredentialRequest issueMembershipCredentialRequest2 = new IssueMembershipCredentialRequest(); issueMembershipCredentialRequest2.setBpn(bpnTenant_2); CredentialsResponse rs2 = issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest2, false, bpnOperator); - membershipCredential_2 = new ObjectMapper().convertValue(rs2, VerifiableCredential.class); + membershipCredential_2 = new ObjectMapper().convertValue(rs2, VerifiableCredential.class);*/ } @Test diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java index c5ddb65c6..dd12af4c1 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java @@ -96,7 +96,7 @@ public class PresentationServiceTest { void createPresentation200ResponseAsJWT() { boolean asJwt = true; String bpn = TestUtils.getRandomBpmNumber(); - String did = generateWalletAndBpnCredentialAndGetDid(bpn); + String did = generateWalletAndGetDid(bpn); String jtiValue = generateUuid(); String accessToken = generateAccessToken(did, did, did, BPN_CREDENTIAL_READ, jtiValue); JtiRecord jtiRecord = buildJti(jtiValue, false); @@ -116,7 +116,7 @@ void createPresentation200ResponseAsJWT() { void createPresentation200ResponseAsJsonLD() { boolean asJwt = false; String bpn = TestUtils.getRandomBpmNumber(); - String did = generateWalletAndBpnCredentialAndGetDid(bpn); + String did = generateWalletAndGetDid(bpn); String jtiValue = generateUuid(); String accessToken = generateAccessToken(did, did, did, BPN_CREDENTIAL_READ, jtiValue); JtiRecord jtiRecord = buildJti(jtiValue, false); @@ -139,7 +139,7 @@ void createPresentation200ResponseAsJsonLD() { void createPresentation200ResponseNoJtiRecord() { boolean asJwt = true; String bpn = TestUtils.getRandomBpmNumber(); - String did = generateWalletAndBpnCredentialAndGetDid(bpn); + String did = generateWalletAndGetDid(bpn); String jtiValue = generateUuid(); String accessToken = generateAccessToken(did, did, did, BPN_CREDENTIAL_READ, jtiValue); @@ -156,7 +156,7 @@ void createPresentation200ResponseNoJtiRecord() { void createPresentationIncorrectVcTypeResponse() { boolean asJwt = true; String bpn = TestUtils.getRandomBpmNumber(); - String did = generateWalletAndBpnCredentialAndGetDid(bpn); + String did = generateWalletAndGetDid(bpn); String jtiValue = generateUuid(); String accessToken = generateAccessToken(did, did, did, INVALID_CREDENTIAL_READ, jtiValue); JtiRecord jtiRecord = buildJti(jtiValue, false); @@ -182,7 +182,7 @@ void createPresentationIncorrectRightsRequested() { void createPresentationIncorrectJtiAlreadyUsed() { boolean asJwt = false; String bpn = TestUtils.getRandomBpmNumber(); - String did = generateWalletAndBpnCredentialAndGetDid(bpn); + String did = generateWalletAndGetDid(bpn); String jtiValue = generateUuid(); String accessToken = generateAccessToken(did, did, did, BPN_CREDENTIAL_READ, jtiValue); JtiRecord jtiRecord = buildJti(jtiValue, true); @@ -193,13 +193,12 @@ void createPresentationIncorrectJtiAlreadyUsed() { } @SneakyThrows - private String generateWalletAndBpnCredentialAndGetDid(String bpn) { + private String generateWalletAndGetDid(String bpn) { String baseBpn = miwSettings.authorityWalletBpn(); String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; ResponseEntity createWalletResponse = createWallet(bpn, "name", restTemplate, baseBpn, defaultLocation); Wallet wallet = TestUtils.getWalletFromString(createWalletResponse.getBody()); Wallet issuerWallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(issuerWallet, wallet, false); return wallet.getDid(); } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java index 7fbcee273..1546ddb7c 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java @@ -29,7 +29,6 @@ import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.controller.PresentationController; @@ -271,10 +270,10 @@ private Map getIssueVPRequest(String bpn) throws JsonProcessingE ResponseEntity response = TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation); Assertions.assertEquals(response.getStatusCode().value(), HttpStatus.CREATED.value()); Wallet wallet = TestUtils.getWalletFromString(response.getBody()); - generateBpnCredential(wallet); //get BPN credentials - List credentials = holdersCredentialRepository.getByHolderDidAndType(wallet.getDid(), MIWVerifiableCredentialType.BPN_CREDENTIAL); + //TODO need to get some VCs for testing + List credentials = null; Map map = objectMapper.readValue(credentials.get(0).getData().toJson(), Map.class); @@ -292,7 +291,6 @@ private ResponseEntity getIssueVPRequestWithShortExpiry(String bpn, String ResponseEntity response = TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation); Assertions.assertEquals(response.getStatusCode().value(), HttpStatus.CREATED.value()); Wallet wallet = TestUtils.getWalletFromString(response.getBody()); - generateBpnCredential(wallet); //create VC HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); @@ -317,10 +315,6 @@ private ResponseEntity getIssueVPRequestWithShortExpiry(String bpn, String return vpResponse; } - private void generateBpnCredential(Wallet holderWallet) { - Wallet issuerWallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(issuerWallet, holderWallet, false); - } private ResponseEntity issueVC(String bpn, String holderDid, String issuerDid, String type, HttpHeaders headers, List contexts, Instant expiry) throws JsonProcessingException { // Create VC without proof @@ -329,7 +323,7 @@ private ResponseEntity issueVC(String bpn, String holderDid, String issu new VerifiableCredentialBuilder(); //VC Subject - VerifiableCredentialSubject verifiableCredentialSubject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, MIWVerifiableCredentialType.BPN_CREDENTIAL, + VerifiableCredentialSubject verifiableCredentialSubject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, "BpnCredentials", StringPool.ID, holderDid, StringPool.BPN, bpn)); diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/wallet/WalletTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/wallet/WalletTest.java index c562ce977..8371a0fea 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/wallet/WalletTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/wallet/WalletTest.java @@ -26,7 +26,6 @@ import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; -import org.eclipse.tractusx.managedidentitywallets.constant.MIWVerifiableCredentialType; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; import org.eclipse.tractusx.managedidentitywallets.constant.SupportedAlgorithms; import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; @@ -107,16 +106,10 @@ void createDuplicateAuthorityWalletTest() { @Test void authorityWalletExistTest() { Wallet wallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn()); - issuersCredentialService.issueBpnCredential(wallet, wallet, true); Assertions.assertNotNull(wallet); Assertions.assertEquals(wallet.getBpn(), miwSettings.authorityWalletBpn()); Assertions.assertEquals(wallet.getName(), miwSettings.authorityWalletName()); Assertions.assertNotNull(wallet.getDidDocument()); - - //check BPN credentials issued for authority wallet - List vcs = holdersCredentialRepository.getByHolderDidAndType(wallet.getDid(), MIWVerifiableCredentialType.BPN_CREDENTIAL); - Assertions.assertFalse(vcs.isEmpty()); - Assertions.assertTrue(vcs.get(0).isSelfIssued()); } From 14308815e8e8a5420d02bb73ffca2a5386e8eee6 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Tue, 11 Jun 2024 15:22:11 +0530 Subject: [PATCH 02/10] fix: test cases of get VC api --- .../utils/TestUtils.java | 50 +++++++- .../vc/HoldersCredentialTest.java | 44 ++++--- .../vc/IssuersCredentialTest.java | 108 ++++++++---------- 3 files changed, 127 insertions(+), 75 deletions(-) diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java index 32dfa9109..f616c8cf5 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java @@ -32,6 +32,7 @@ import com.nimbusds.jose.jwk.OctetKeyPair; import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; +import lombok.SneakyThrows; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; @@ -39,8 +40,12 @@ import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; import org.eclipse.tractusx.managedidentitywallets.domain.SigningServiceType; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; +import org.eclipse.tractusx.managedidentitywallets.exception.ForbiddenException; import org.eclipse.tractusx.ssi.lib.model.did.DidDocument; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; +import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialBuilder; +import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; +import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialType; import org.jetbrains.annotations.NotNull; import org.json.JSONArray; import org.json.JSONException; @@ -50,13 +55,16 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import java.net.URI; +import java.time.Instant; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.UUID; import static org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames.ACCESS_TOKEN; @@ -111,9 +119,10 @@ public static Wallet createWallet(String bpn, String did, WalletRepository walle public static void checkVC(VerifiableCredential verifiableCredential, MIWSettings miwSettings) { //text context URL - Assertions.assertEquals(verifiableCredential.getContext().size(), miwSettings.vcContexts().size()); - for (URI link : verifiableCredential.getContext()) { - Assertions.assertTrue(miwSettings.vcContexts().contains(link)); + Assertions.assertEquals(verifiableCredential.getContext().size(), miwSettings.vcContexts().size() + 1); + + for (URI link : miwSettings.vcContexts()) { + Assertions.assertTrue(verifiableCredential.getContext().contains(link)); } //check expiry date @@ -213,4 +222,39 @@ public static Wallet buildWallet(String bpn, String did, String didJson) { .signingServiceType(SigningServiceType.LOCAL) .build(); } + + @SneakyThrows + public static VerifiableCredential issueCustomVCUsingBaseWallet(String holderDid, String issuerDid, String type, HttpHeaders headers, + MIWSettings miwSettings, ObjectMapper objectMapper, TestRestTemplate restTemplate) { + + // Create VC without proof + //VC Builder + VerifiableCredentialBuilder verifiableCredentialBuilder = + new VerifiableCredentialBuilder(); + + //VC Subject + VerifiableCredentialSubject verifiableCredentialSubject = + new VerifiableCredentialSubject(Map.of("test", "test")); + + //Using Builder + VerifiableCredential credentialWithoutProof = + verifiableCredentialBuilder + .id(URI.create(issuerDid + "#" + UUID.randomUUID())) + .context(miwSettings.vcContexts()) + .type(List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, type)) + .issuer(URI.create(issuerDid)) //issuer must be base wallet + .expirationDate(miwSettings.vcExpiryDate().toInstant()) + .issuanceDate(Instant.now()) + .credentialSubject(verifiableCredentialSubject) + .build(); + + Map map = objectMapper.readValue(credentialWithoutProof.toJson(), Map.class); + HttpEntity entity = new HttpEntity<>(map, headers); + ResponseEntity response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderDid={did}", HttpMethod.POST, entity, String.class, holderDid); + if (response.getStatusCode().value() == HttpStatus.FORBIDDEN.value()) { + throw new ForbiddenException(); + } + Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); + return new VerifiableCredential(new ObjectMapper().readValue(response.getBody(), Map.class)); + } } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java index 4fc9899b1..b605dc318 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java @@ -31,6 +31,7 @@ import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.controller.IssuersCredentialController; import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; +import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; import org.eclipse.tractusx.managedidentitywallets.dao.repository.HoldersCredentialRepository; import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; @@ -159,8 +160,13 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti //save wallet TestUtils.createWallet(bpn, did, walletRepository); + List vcs = new ArrayList<>(); + List typesOfVcs = List.of("Type1", "Type2", "Type3"); - //TODO need to issue some VCs to get VC + typesOfVcs.forEach(type -> { + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(did, miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + vcs.add(verifiableCredential); + }); HttpEntity entity = new HttpEntity<>(headers); @@ -168,7 +174,7 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti , HttpMethod.GET, entity, String.class, baseDID); List credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); - Assertions.assertEquals(7, Objects.requireNonNull(credentialList).size()); //5 framework + 1 BPN + 1 Summary + Assertions.assertEquals(typesOfVcs.size(), Objects.requireNonNull(credentialList).size()); response = restTemplate.exchange(RestURI.CREDENTIALS + "?credentialId={id}" , HttpMethod.GET, entity, String.class, credentialList.get(0).getId()); @@ -176,15 +182,20 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); - List list = new ArrayList<>(); - //TODO need to get VC which are issued response = restTemplate.exchange(RestURI.CREDENTIALS + "?type={list}" - , HttpMethod.GET, entity, String.class, String.join(",", list)); + , HttpMethod.GET, entity, String.class, String.join(",", typesOfVcs)); credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); - Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); + Assertions.assertEquals(typesOfVcs.size(), Objects.requireNonNull(credentialList).size()); + //test get by type + String type = typesOfVcs.get(0); + response = restTemplate.exchange(RestURI.CREDENTIALS + "?type={list}" + , HttpMethod.GET, entity, String.class, type); + credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); + Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); + Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); } @@ -199,8 +210,15 @@ void getCredentialsAsJWT200() throws JSONException { // save wallet TestUtils.createWallet(bpn, did, walletRepository); + //issue VC : test data + List vcs = new ArrayList<>(); + List typesOfVcs = List.of("Type1", "Type2", "Type3"); + + typesOfVcs.forEach(type -> { + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(did, miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + vcs.add(verifiableCredential); + }); - //TODO need to issue some VCs HttpEntity entity = new HttpEntity<>(headers); @@ -210,8 +228,8 @@ void getCredentialsAsJWT200() throws JSONException { Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); Map responseMap = SerializeUtil.fromJson(response.getBody()); List> vcsAsJwt = (ArrayList>) responseMap.get("content"); - // 5 framework + 1 BPN + 1 Summary - Assertions.assertEquals(7, vcsAsJwt.size()); + + Assertions.assertEquals(vcs.size(), vcsAsJwt.size()); vcsAsJwt.forEach(vc -> { Assertions.assertNotNull(vc.get(StringPool.VC_JWT_KEY)); }); @@ -324,11 +342,9 @@ private Map issueVC() throws JsonProcessingException { String bpn = TestUtils.getRandomBpmNumber(); String baseBpn = miwSettings.authorityWalletBpn(); String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - TestUtils.createWallet(bpn, "Test", restTemplate, baseBpn, defaultLocation); - - //TODO need to issue some random VC - ResponseEntity vc = null; - VerifiableCredential verifiableCredential = new VerifiableCredential(new ObjectMapper().readValue(vc.getBody(), Map.class)); + ResponseEntity response = TestUtils.createWallet(bpn, "Test Wallet", restTemplate, baseBpn, defaultLocation); + Wallet wallet = TestUtils.getWalletFromString(response.getBody()); + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), "Type1", AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); Map map = objectMapper.readValue(verifiableCredential.toJson(), Map.class); return map; } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java index 139b0c875..1cdbffc07 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java @@ -31,17 +31,16 @@ import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential; import org.eclipse.tractusx.managedidentitywallets.dao.entity.IssuersCredential; +import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; import org.eclipse.tractusx.managedidentitywallets.dao.repository.HoldersCredentialRepository; import org.eclipse.tractusx.managedidentitywallets.dao.repository.IssuersCredentialRepository; import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; +import org.eclipse.tractusx.managedidentitywallets.exception.ForbiddenException; import org.eclipse.tractusx.managedidentitywallets.utils.AuthenticationUtils; import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; import org.eclipse.tractusx.ssi.lib.did.web.DidWebFactory; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialBuilder; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; -import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialType; import org.eclipse.tractusx.ssi.lib.serialization.SerializeUtil; import org.json.JSONException; import org.junit.jupiter.api.Assertions; @@ -57,13 +56,10 @@ import org.springframework.http.ResponseEntity; import org.springframework.test.context.ContextConfiguration; -import java.net.URI; -import java.time.Instant; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.UUID; import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COLON_SEPARATOR; @@ -93,10 +89,13 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti String holderDID = "did:web:localhost:" + holderBpn; HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(baseBPN); //save wallet - TestUtils.createWallet(holderBpn, holderDID, walletRepository); + Wallet wallet = TestUtils.createWallet(holderBpn, holderDID, walletRepository); - //TODO issue some random VC before testing get VC API - // TestUtils.issueMembershipVC(restTemplate, holderBpn, baseBPN); + //issue some VCs + List typesOfVcs = List.of("Type1", "Type2", "Type3"); + typesOfVcs.forEach(type -> { + TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + }); HttpEntity entity = new HttpEntity<>(headers); @@ -107,7 +106,7 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti List credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); - Assertions.assertEquals(12, Objects.requireNonNull(credentialList).size()); //5 framework CV + 1 membership + 6 Summary VC + Assertions.assertEquals(typesOfVcs.size(), Objects.requireNonNull(credentialList).size()); response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?credentialId={id}" @@ -116,13 +115,21 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); - List list = new ArrayList<>(); - //TODO need to check issued VC are present in response - response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?type={list}" - , HttpMethod.GET, entity, String.class, String.join(",", list)); + + response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?type={list}&holderIdentifier={holderIdentifier}" + , HttpMethod.GET, entity, String.class, String.join(",", typesOfVcs), wallet.getBpn()); credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); + //here we at getting VCs from issuer table, it will have double entry + Assertions.assertEquals(typesOfVcs.size(), Objects.requireNonNull(credentialList).size()); + + + response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?type={list}&holderIdentifier={holderIdentifier}" + , HttpMethod.GET, entity, String.class, typesOfVcs.get(0), wallet.getBpn()); + credentialList = TestUtils.getVerifiableCredentials(response, objectMapper); + Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value()); + Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size()); } @@ -134,13 +141,15 @@ void getCredentialsAsJWT200() throws JSONException { String holderDID = "did:web:localhost:" + holderBpn; HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(baseBPN); //save wallet - TestUtils.createWallet(holderBpn, holderDID, walletRepository); - - //TODO need to issue some VCs + Wallet wallet = TestUtils.createWallet(holderBpn, holderDID, walletRepository); + //create test data + List typesOfVcs = List.of("Type1", "Type2", "Type3"); + typesOfVcs.forEach(type -> { + TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + }); HttpEntity entity = new HttpEntity<>(headers); - ResponseEntity response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderIdentifier={did}&asJwt=true" , HttpMethod.GET, entity, String.class, holderDID); @@ -148,7 +157,7 @@ void getCredentialsAsJWT200() throws JSONException { Map responseMap = SerializeUtil.fromJson(response.getBody()); List> vcsAsJwt = (ArrayList>) responseMap.get("content"); //5 framework CV + 1 membership + 6 Summary VC - Assertions.assertEquals(12, vcsAsJwt.size()); + Assertions.assertEquals(typesOfVcs.size(), vcsAsJwt.size()); vcsAsJwt.forEach(vc -> { Assertions.assertNotNull(vc.get(StringPool.VC_JWT_KEY)); @@ -175,9 +184,15 @@ void issueCredentialsWithoutBaseWalletBPN403() throws JsonProcessingException { String type = "TestCredential"; HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); - ResponseEntity response = issueVC(bpn, holderDid, holderDid, type, headers); + String baseBpn = miwSettings.authorityWalletBpn(); + //save wallet + String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; + TestUtils.createWallet(bpn, holderDid, restTemplate, baseBpn, defaultLocation); + - Assertions.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode().value()); + Assertions.assertThrows(ForbiddenException.class, () -> { + TestUtils.issueCustomVCUsingBaseWallet(holderDid, holderDid, type, headers, miwSettings, objectMapper, restTemplate); + }); } @Test @@ -185,10 +200,14 @@ void issueCredentialsToBaseWallet200() throws JsonProcessingException { String type = "TestCredential"; HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); - ResponseEntity response = issueVC(miwSettings.authorityWalletBpn(), miwSettings.authorityWalletDid(), miwSettings.authorityWalletDid(), type, headers); + String baseBpn = miwSettings.authorityWalletBpn(); + String bpn = TestUtils.getRandomBpmNumber(); + //save wallet + String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; + TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation); + + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(miwSettings.authorityWalletDid(), miwSettings.authorityWalletDid(), type, headers, miwSettings, objectMapper, restTemplate); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - VerifiableCredential verifiableCredential = new VerifiableCredential(new ObjectMapper().readValue(response.getBody(), Map.class)); Assertions.assertNotNull(verifiableCredential.getProof()); List credentials = holdersCredentialRepository.getByHolderDidAndType(miwSettings.authorityWalletDid(), type); @@ -196,7 +215,7 @@ void issueCredentialsToBaseWallet200() throws JsonProcessingException { Assertions.assertFalse(credentials.get(0).isStored()); //stored must be false Assertions.assertTrue(credentials.get(0).isSelfIssued()); //stored must be true } - + @Test void issueCredentials200() throws com.fasterxml.jackson.core.JsonProcessingException { @@ -205,10 +224,13 @@ void issueCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcep String type = "TestCredential"; HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); - ResponseEntity response = issueVC(bpn, did, miwSettings.authorityWalletDid(), type, headers); + String baseBpn = miwSettings.authorityWalletBpn(); + //save wallet + String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; + TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation); + + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(did, miwSettings.authorityWalletDid(), type, headers, miwSettings, objectMapper, restTemplate); - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - VerifiableCredential verifiableCredential = new VerifiableCredential(new ObjectMapper().readValue(response.getBody(), Map.class)); Assertions.assertNotNull(verifiableCredential.getProof()); List credentials = holdersCredentialRepository.getByHolderDidAndType(did, type); @@ -224,35 +246,5 @@ void issueCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcep } - private ResponseEntity issueVC(String bpn, String holderDid, String issuerDid, String type, HttpHeaders headers) throws JsonProcessingException { - String baseBpn = miwSettings.authorityWalletBpn(); - //save wallet - String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; - TestUtils.createWallet(bpn, holderDid, restTemplate, baseBpn, defaultLocation); - // Create VC without proof - //VC Bulider - VerifiableCredentialBuilder verifiableCredentialBuilder = - new VerifiableCredentialBuilder(); - - //VC Subject - VerifiableCredentialSubject verifiableCredentialSubject = - new VerifiableCredentialSubject(Map.of("test", "test")); - - //Using Builder - VerifiableCredential credentialWithoutProof = - verifiableCredentialBuilder - .id(URI.create(issuerDid + "#" + UUID.randomUUID())) - .context(miwSettings.vcContexts()) - .type(List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, type)) - .issuer(URI.create(issuerDid)) //issuer must be base wallet - .expirationDate(miwSettings.vcExpiryDate().toInstant()) - .issuanceDate(Instant.now()) - .credentialSubject(verifiableCredentialSubject) - .build(); - - Map map = objectMapper.readValue(credentialWithoutProof.toJson(), Map.class); - HttpEntity entity = new HttpEntity<>(map, headers); - return restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderDid={did}", HttpMethod.POST, entity, String.class, holderDid); - } } From 09d337f85f70e1c6514dc111757264330dc2a3ac Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Tue, 11 Jun 2024 16:22:17 +0530 Subject: [PATCH 03/10] fix: VP validation tests --- .../service/IssuersCredentialServiceTest.java | 171 +----------------- .../utils/TestUtils.java | 23 ++- .../vc/PresentationValidationTest.java | 37 ++-- 3 files changed, 37 insertions(+), 194 deletions(-) diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java index 6ed322807..6be2a0c31 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialServiceTest.java @@ -27,6 +27,7 @@ import com.nimbusds.jwt.SignedJWT; import com.smartsensesolutions.java.commons.specification.SpecificationUtil; import lombok.SneakyThrows; +import org.apache.commons.lang3.time.DateUtils; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.constant.SupportedAlgorithms; @@ -77,6 +78,7 @@ import java.sql.SQLException; import java.time.Duration; import java.time.Instant; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -136,6 +138,7 @@ public static void beforeAll() throws SQLException { when(dataSource.getConnection()).thenReturn(connection); when(miwSettings.encryptionKey()).thenReturn("26FlcjRKOEML8YW699CXlg=="); + when(miwSettings.vcExpiryDate()).thenReturn(DateUtils.addMonths(new Date(), 10)); encryptionUtils = new EncryptionUtils(miwSettings); issuersCredentialService = new IssuersCredentialService( @@ -155,174 +158,6 @@ public void beforeEach() { issuersCredentialRepository); } - @Nested - class issueMembershipCredentialTest { - - @Test - void shouldIssueCredentialAsJwt() - throws InvalidPrivateKeyFormatException, KeyTransformationException { - Map wallets = mockBaseAndHolderWallet(); - Wallet baseWallet = (Wallet) wallets.get("base"); - String baseWalletBpn = baseWallet.getBpn(); - Wallet holderWallet = (Wallet) wallets.get("holder"); - String holderWalletBpn = holderWallet.getBpn(); - String walletKeyId = "key-1"; - KeyPair keyPair = MockUtil.generateEDKeys(); - - mockCommon(baseWalletBpn, holderWalletBpn, keyPair, baseWallet, holderWallet); - MockUtil.makeFilterWorkForIssuer(issuersCredentialRepository); - MockUtil.makeCreateWorkForIssuer(issuersCredentialRepository); - - - - WalletKey walletKey = mock(WalletKey.class); - when(walletKey.getKeyId()).thenReturn(KEY_ID); - when(walletKey.getId()).thenReturn(42L); - when(baseWallet.getAlgorithm()).thenReturn("ED25519"); - when(baseWallet.getSigningServiceType()).thenReturn(SigningServiceType.LOCAL); - when(walletKeyService.getPrivateKeyByWalletIdAndAlgorithm(baseWallet.getId(), SupportedAlgorithms.valueOf(baseWallet.getAlgorithm()))) - .thenReturn(new X25519PrivateKey(keyPair.getPrivateKey().asStringForStoring(), true)); - when(walletKeyService.getWalletKeyIdByWalletId(baseWallet.getId(), SupportedAlgorithms.ED25519)).thenReturn(walletKeyId); - when(walletKeyService.getPrivateKeyByWalletIdAsBytes(baseWallet.getId(), "ED25519")).thenReturn(keyPair.getPrivateKey() - .asByte()); - - - when(walletKeyService.getPrivateKeyByKeyId(anyString(), any())).thenReturn(keyPair.getPrivateKey()); - when(walletKeyRepository.getByAlgorithmAndWallet_Bpn(anyString(), anyString())).thenReturn(walletKey); - - LocalSigningServiceImpl localSigningService = new LocalSigningServiceImpl(secureTokenService); - localSigningService.setKeyProvider(new LocalKeyProvider(walletKeyService, walletKeyRepository, encryptionUtils)); - - Map map = new HashMap<>(); - map.put(SigningServiceType.LOCAL, localSigningService); - - issuersCredentialService.setKeyService(map); - - //TODO need to check what could be done - /*CredentialsResponse credentialsResponse = assertDoesNotThrow( - () -> issuersCredentialService.issueMembershipCredential( - issueMembershipCredentialRequest, - true, - baseWalletBpn)); - - validateCredentialResponse(credentialsResponse, MockUtil.buildDidDocument(new Did(new DidMethod("web"), - new DidMethodIdentifier("basewallet"), - null), keyPair));*/ - } - } - - @Nested - class issueFrameWorkCredentialTest { - - @Test - void shouldIssueCredentialAsJwt() - throws InvalidPrivateKeyFormatException, JwtException, KeyTransformationException { - Map wallets = mockBaseAndHolderWallet(); - Wallet baseWallet = (Wallet) wallets.get("base"); - String baseWalletBpn = baseWallet.getBpn(); - Wallet holderWallet = (Wallet) wallets.get("holder"); - String holderWalletBpn = holderWallet.getBpn(); - String walletKeyId = "key-1"; - - KeyPair keyPair = MockUtil.generateEDKeys(); - - mockCommon(baseWalletBpn, holderWalletBpn, keyPair, baseWallet, holderWallet); - MockUtil.makeFilterWorkForIssuer(issuersCredentialRepository); - MockUtil.makeCreateWorkForIssuer(issuersCredentialRepository); - - - //TODO need to check - /*when(holdersCredentialRepository.getByHolderDidAndIssuerDidAndTypeAndStored( - any(String.class), - any(String.class), - eq(MIWVerifiableCredentialType.SUMMARY_CREDENTIAL), - eq(false) - )).thenReturn(Collections.emptyList());*/ - - WalletKey walletKey = mock(WalletKey.class); - when(walletKey.getKeyId()).thenReturn(KEY_ID); - when(walletKey.getId()).thenReturn(42L); - when(baseWallet.getAlgorithm()).thenReturn("ED25519"); - when(walletKeyService.getPrivateKeyByWalletIdAsBytes(baseWallet.getId(), "ED25519")).thenReturn(keyPair.getPrivateKey() - .asByte()); - when(walletKeyService.getPrivateKeyByWalletIdAndAlgorithm(baseWallet.getId(), SupportedAlgorithms.valueOf(baseWallet.getAlgorithm()))) - .thenReturn(new X25519PrivateKey(keyPair.getPrivateKey().asStringForStoring(), true)); - when(walletKeyService.getWalletKeyIdByWalletId(baseWallet.getId(), SupportedAlgorithms.ED25519)).thenReturn(walletKeyId); - - - when(baseWallet.getSigningServiceType()).thenReturn(SigningServiceType.LOCAL); - when(walletKeyService.getPrivateKeyByKeyId(anyString(), any())).thenReturn(keyPair.getPrivateKey()); - when(walletKeyRepository.getByAlgorithmAndWallet_Bpn(anyString(), anyString())).thenReturn(walletKey); - - LocalSigningServiceImpl localSigningService = new LocalSigningServiceImpl(secureTokenService); - localSigningService.setKeyProvider(new LocalKeyProvider(walletKeyService, walletKeyRepository, encryptionUtils)); - - Map map = new HashMap<>(); - map.put(SigningServiceType.LOCAL, localSigningService); - - issuersCredentialService.setKeyService(map); - - - //TODO need to check what could be done - /* CredentialsResponse credentialsResponse = assertDoesNotThrow( - () -> issuersCredentialService.issueFrameworkCredential(request, true, baseWalletBpn)); - validateCredentialResponse(credentialsResponse, MockUtil.buildDidDocument(new Did(new DidMethod("web"), - new DidMethodIdentifier("basewallet"), - null), keyPair));*/ - } - } - - @Nested - class issueDismantlerCredentialTest { - - @Test - void shouldIssueCredentialAsJwt() throws InvalidPrivateKeyFormatException, - JwtException, KeyTransformationException { - Map wallets = mockBaseAndHolderWallet(); - Wallet baseWallet = (Wallet) wallets.get("base"); - String baseWalletBpn = baseWallet.getBpn(); - Wallet holderWallet = (Wallet) wallets.get("holder"); - String holderWalletBpn = holderWallet.getBpn(); - String walletKeyId = "key-1"; - KeyPair keyPair = MockUtil.generateEDKeys(); - - mockCommon(baseWalletBpn, holderWalletBpn, keyPair, baseWallet, holderWallet); - MockUtil.makeFilterWorkForIssuer(issuersCredentialRepository); - MockUtil.makeCreateWorkForIssuer(issuersCredentialRepository); - - - - WalletKey walletKey = mock(WalletKey.class); - when(walletKey.getKeyId()).thenReturn(KEY_ID); - when(walletKey.getId()).thenReturn(42L); - when(baseWallet.getAlgorithm()).thenReturn("ED25519"); - when(walletKeyService.getPrivateKeyByWalletIdAndAlgorithm(baseWallet.getId(), SupportedAlgorithms.valueOf(baseWallet.getAlgorithm()))) - .thenReturn(new X25519PrivateKey(keyPair.getPrivateKey().asStringForStoring(), true)); - when(walletKeyService.getPrivateKeyByWalletIdAsBytes(baseWallet.getId(), "ED25519")).thenReturn(keyPair.getPrivateKey().asByte()); - when(walletKeyService.getWalletKeyIdByWalletId(baseWallet.getId(), SupportedAlgorithms.ED25519)).thenReturn(walletKeyId); - - - when(baseWallet.getSigningServiceType()).thenReturn(SigningServiceType.LOCAL); - when(walletKeyService.getPrivateKeyByKeyId(anyString(), any())).thenReturn(keyPair.getPrivateKey()); - when(walletKeyRepository.getByAlgorithmAndWallet_Bpn(anyString(), anyString())).thenReturn(walletKey); - - LocalSigningServiceImpl localSigningService = new LocalSigningServiceImpl(secureTokenService); - localSigningService.setKeyProvider(new LocalKeyProvider(walletKeyService, walletKeyRepository, encryptionUtils)); - - Map map = new HashMap<>(); - map.put(SigningServiceType.LOCAL, localSigningService); - - issuersCredentialService.setKeyService(map); - - //TODO need to check - /* CredentialsResponse credentialsResponse = assertDoesNotThrow( - () -> issuersCredentialService.issueDismantlerCredential(request, true, baseWalletBpn)); - validateCredentialResponse(credentialsResponse, MockUtil.buildDidDocument(new Did(new DidMethod("web"), - new DidMethodIdentifier("basewallet"), - null), keyPair));*/ - } - } - @Nested class issueCredentialUsingBaseWallet { diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java index f616c8cf5..71a0d9806 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java @@ -64,7 +64,6 @@ import java.util.Date; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.UUID; import static org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames.ACCESS_TOKEN; @@ -227,6 +226,17 @@ public static Wallet buildWallet(String bpn, String did, String didJson) { public static VerifiableCredential issueCustomVCUsingBaseWallet(String holderDid, String issuerDid, String type, HttpHeaders headers, MIWSettings miwSettings, ObjectMapper objectMapper, TestRestTemplate restTemplate) { + Map map = getCredentialAsMap(issuerDid, type, miwSettings, objectMapper); + HttpEntity entity = new HttpEntity<>(map, headers); + ResponseEntity response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderDid={did}", HttpMethod.POST, entity, String.class, holderDid); + if (response.getStatusCode().value() == HttpStatus.FORBIDDEN.value()) { + throw new ForbiddenException(); + } + Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); + return new VerifiableCredential(new ObjectMapper().readValue(response.getBody(), Map.class)); + } + + public static Map getCredentialAsMap(String issuerDid, String type, MIWSettings miwSettings, ObjectMapper objectMapper) throws JsonProcessingException { // Create VC without proof //VC Builder VerifiableCredentialBuilder verifiableCredentialBuilder = @@ -234,7 +244,7 @@ public static VerifiableCredential issueCustomVCUsingBaseWallet(String holderDid //VC Subject VerifiableCredentialSubject verifiableCredentialSubject = - new VerifiableCredentialSubject(Map.of("test", "test")); + new VerifiableCredentialSubject(Map.of("id", "test")); //Using Builder VerifiableCredential credentialWithoutProof = @@ -248,13 +258,6 @@ public static VerifiableCredential issueCustomVCUsingBaseWallet(String holderDid .credentialSubject(verifiableCredentialSubject) .build(); - Map map = objectMapper.readValue(credentialWithoutProof.toJson(), Map.class); - HttpEntity entity = new HttpEntity<>(map, headers); - ResponseEntity response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderDid={did}", HttpMethod.POST, entity, String.class, holderDid); - if (response.getStatusCode().value() == HttpStatus.FORBIDDEN.value()) { - throw new ForbiddenException(); - } - Assertions.assertEquals(HttpStatus.CREATED.value(), response.getStatusCode().value()); - return new VerifiableCredential(new ObjectMapper().readValue(response.getBody(), Map.class)); + return objectMapper.readValue(credentialWithoutProof.toJson(), Map.class); } } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java index b77640457..f652f6360 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java @@ -34,6 +34,7 @@ import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; +import org.eclipse.tractusx.managedidentitywallets.dto.CredentialsResponse; import org.eclipse.tractusx.managedidentitywallets.service.IssuersCredentialService; import org.eclipse.tractusx.managedidentitywallets.service.PresentationService; import org.eclipse.tractusx.managedidentitywallets.service.WalletService; @@ -92,9 +93,10 @@ class PresentationValidationTest { private String bpnOperator; private Did tenant_1; private Did tenant_2; - private VerifiableCredential membershipCredential_1; - private VerifiableCredential membershipCredential_2; + private VerifiableCredential vc_1; + private VerifiableCredential vc_2; + @SneakyThrows @BeforeEach public void setup() throws DidParseException { bpnOperator = miwSettings.authorityWalletBpn(); @@ -116,18 +118,21 @@ public void setup() throws DidParseException { tenant_2 = DidParser.parse(tenantWallet2.getDid()); - //TODO need to fix test cases - /*CredentialsResponse rs1 = issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest, false, bpnOperator); - membershipCredential_1 = new ObjectMapper().convertValue(rs1, VerifiableCredential.class); - IssueMembershipCredentialRequest issueMembershipCredentialRequest2 = new IssueMembershipCredentialRequest(); - issueMembershipCredentialRequest2.setBpn(bpnTenant_2); - CredentialsResponse rs2 = issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest2, false, bpnOperator); - membershipCredential_2 = new ObjectMapper().convertValue(rs2, VerifiableCredential.class);*/ + Map type1 = TestUtils.getCredentialAsMap(miwSettings.authorityWalletDid(), "Type1", miwSettings, new com.fasterxml.jackson.databind.ObjectMapper()); + + CredentialsResponse rs1 = issuersCredentialService.issueCredentialUsingBaseWallet(tenantWallet.getDid(), type1, false, bpnOperator); + vc_1 = new ObjectMapper().convertValue(rs1, VerifiableCredential.class); + + + Map type2 = TestUtils.getCredentialAsMap(miwSettings.authorityWalletDid(), "Type2", miwSettings, new com.fasterxml.jackson.databind.ObjectMapper()); + + CredentialsResponse rs2 = issuersCredentialService.issueCredentialUsingBaseWallet(tenantWallet.getDid(), type2, false, bpnOperator); + vc_2 = new ObjectMapper().convertValue(rs2, VerifiableCredential.class); } @Test void testSuccessfulValidation() { - Map presentation = createPresentationJwt(membershipCredential_1, tenant_1); + Map presentation = createPresentationJwt(vc_1, tenant_1); VerifiablePresentationValidationResponse response = validateJwtOfCredential(presentation); Assertions.assertTrue(response.valid); } @@ -135,7 +140,7 @@ void testSuccessfulValidation() { @Test @SneakyThrows public void testSuccessfulValidationForMultipleVC() { - Map creationResponse = createPresentationJwt(List.of(membershipCredential_1, membershipCredential_2), tenant_1); + Map creationResponse = createPresentationJwt(List.of(vc_1, vc_2), tenant_1); // get the payload of the json web token String encodedJwtPayload = ((String) creationResponse.get("vp")).split("\\.")[1]; Map decodedJwtPayload = OBJECT_MAPPER.readValue(Base64.getUrlDecoder().decode(encodedJwtPayload), Map.class); @@ -151,7 +156,7 @@ public void testSuccessfulValidationForMultipleVC() { public void testValidationFailureOfCredentialWitInvalidExpirationDate() { // test is related to this old issue where the signature check still succeeded // https://github.com/eclipse-tractusx/SSI-agent-lib/issues/4 - VerifiableCredential copyCredential = new VerifiableCredential(membershipCredential_1); + VerifiableCredential copyCredential = new VerifiableCredential(vc_1); // e.g. an attacker tries to extend the validity of a verifiable credential copyCredential.put(VerifiableCredential.EXPIRATION_DATE, "2500-09-30T22:00:00Z"); Map presentation = createPresentationJwt(copyCredential, tenant_1); @@ -164,10 +169,10 @@ public void testValidationFailureOfCredentialWitInvalidExpirationDate() { public void testValidationFailureOfCredentialWitInvalidExpirationDateInSecondCredential() { // test is related to this old issue where the signature check still succeeded // https://github.com/eclipse-tractusx/SSI-agent-lib/issues/4 - VerifiableCredential copyCredential = new VerifiableCredential(membershipCredential_1); + VerifiableCredential copyCredential = new VerifiableCredential(vc_1); // e.g. an attacker tries to extend the validity of a verifiable credential copyCredential.put(VerifiableCredential.EXPIRATION_DATE, "2500-09-30T22:00:00Z"); - Map presentation = createPresentationJwt(List.of(membershipCredential_1, copyCredential), tenant_1); + Map presentation = createPresentationJwt(List.of(vc_1, copyCredential), tenant_1); VerifiablePresentationValidationResponse response = validateJwtOfCredential(presentation); Assertions.assertFalse(response.valid); } @@ -175,7 +180,7 @@ public void testValidationFailureOfCredentialWitInvalidExpirationDateInSecondCre @Test @SneakyThrows void testValidationFailureOfPresentationPayloadManipulation() { - Map presentation = createPresentationJwt(membershipCredential_1, tenant_1); + Map presentation = createPresentationJwt(vc_1, tenant_1); String jwt = (String) presentation.get(StringPool.VP); String payload = jwt.split("\\.")[1]; @@ -190,7 +195,7 @@ void testValidationFailureOfPresentationPayloadManipulation() { .context(List.of(VerifiablePresentation.DEFAULT_CONTEXT)) .id(URI.create("did:test:" + UUID.randomUUID())) .type(List.of(VerifiablePresentationType.VERIFIABLE_PRESENTATION)) - .verifiableCredentials(List.of(membershipCredential_2)) + .verifiableCredentials(List.of(vc_2)) .build(); payloadMap.put("vp", newPresentation); String newPayloadJson = OBJECT_MAPPER.writeValueAsString(payloadMap); From 847f123f0e3dc4679fd0a22ff287d774c894e8f8 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Tue, 11 Jun 2024 16:37:59 +0530 Subject: [PATCH 04/10] fix: VP test cases --- .../managedidentitywallets/utils/TestUtils.java | 1 - .../vp/PresentationTest.java | 16 +++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java index 71a0d9806..c86086cfa 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java @@ -154,7 +154,6 @@ public static Wallet getWalletFromString(String body) throws JsonProcessingExcep } wallet1.setVerifiableCredentials(verifiableCredentials); } - System.out.println("wallet -- >" + wallet1.getBpn()); return wallet1; } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java index 1546ddb7c..8d489f403 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java @@ -67,6 +67,7 @@ import java.net.URI; import java.text.ParseException; import java.time.Instant; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -272,8 +273,14 @@ private Map getIssueVPRequest(String bpn) throws JsonProcessingE Wallet wallet = TestUtils.getWalletFromString(response.getBody()); //get BPN credentials - //TODO need to get some VCs for testing - List credentials = null; + List vcs = new ArrayList<>(); + List typesOfVcs = List.of("Type1", "Type2", "Type3"); + + typesOfVcs.forEach(type -> { + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + vcs.add(verifiableCredential); + }); + List credentials = holdersCredentialRepository.getByHolderDid(wallet.getDid()); Map map = objectMapper.readValue(credentials.get(0).getData().toJson(), Map.class); @@ -323,9 +330,8 @@ private ResponseEntity issueVC(String bpn, String holderDid, String issu new VerifiableCredentialBuilder(); //VC Subject - VerifiableCredentialSubject verifiableCredentialSubject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, "BpnCredentials", - StringPool.ID, holderDid, - StringPool.BPN, bpn)); + VerifiableCredentialSubject verifiableCredentialSubject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, "CustomType", + StringPool.ID, holderDid)); //Using Builder VerifiableCredential credentialWithoutProof = From bf71a1dc9d89334bfbbe8c189b331d4841ee37d2 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Wed, 12 Jun 2024 12:32:41 +0530 Subject: [PATCH 05/10] fix: failing test cases --- .../constant/StringPool.java | 2 ++ .../utils/TestUtils.java | 16 +++++++++--- .../vc/HoldersCredentialTest.java | 6 ++--- .../vc/IssuersCredentialTest.java | 10 +++---- .../vc/PresentationValidationTest.java | 4 +-- .../vp/PresentationServiceTest.java | 26 ++++++++++++++++--- .../vp/PresentationTest.java | 2 +- 7 files changed, 48 insertions(+), 18 deletions(-) diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java index 9a42fac7e..dc137b8b8 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java @@ -92,4 +92,6 @@ private StringPool() { public static final String VC_JWT_KEY = "jwt"; public static final String AS_JWT = "asJwt"; + + public static final String BPN_CREDENTIAL = "BpnCredential"; } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java index c86086cfa..0304ed185 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/utils/TestUtils.java @@ -42,6 +42,7 @@ import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; import org.eclipse.tractusx.managedidentitywallets.exception.ForbiddenException; import org.eclipse.tractusx.ssi.lib.model.did.DidDocument; +import org.eclipse.tractusx.ssi.lib.model.verifiable.Verifiable; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialBuilder; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; @@ -64,6 +65,7 @@ import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.UUID; import static org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames.ACCESS_TOKEN; @@ -222,10 +224,10 @@ public static Wallet buildWallet(String bpn, String did, String didJson) { } @SneakyThrows - public static VerifiableCredential issueCustomVCUsingBaseWallet(String holderDid, String issuerDid, String type, HttpHeaders headers, + public static VerifiableCredential issueCustomVCUsingBaseWallet(String holderBPn, String holderDid, String issuerDid, String type, HttpHeaders headers, MIWSettings miwSettings, ObjectMapper objectMapper, TestRestTemplate restTemplate) { - Map map = getCredentialAsMap(issuerDid, type, miwSettings, objectMapper); + Map map = getCredentialAsMap(holderBPn, holderDid, issuerDid, type, miwSettings, objectMapper); HttpEntity entity = new HttpEntity<>(map, headers); ResponseEntity response = restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderDid={did}", HttpMethod.POST, entity, String.class, holderDid); if (response.getStatusCode().value() == HttpStatus.FORBIDDEN.value()) { @@ -235,15 +237,21 @@ public static VerifiableCredential issueCustomVCUsingBaseWallet(String holderDid return new VerifiableCredential(new ObjectMapper().readValue(response.getBody(), Map.class)); } - public static Map getCredentialAsMap(String issuerDid, String type, MIWSettings miwSettings, ObjectMapper objectMapper) throws JsonProcessingException { + public static Map getCredentialAsMap(String holderBpn, String holderDid, String issuerDid, String type, MIWSettings miwSettings, ObjectMapper objectMapper) throws JsonProcessingException { // Create VC without proof //VC Builder VerifiableCredentialBuilder verifiableCredentialBuilder = new VerifiableCredentialBuilder(); + Map subjectData; + if (Objects.equals(type, StringPool.BPN_CREDENTIAL)) { + subjectData = Map.of(Verifiable.ID, holderDid, StringPool.BPN, holderBpn); + } else { + subjectData = Map.of(Verifiable.ID, "test"); + } //VC Subject VerifiableCredentialSubject verifiableCredentialSubject = - new VerifiableCredentialSubject(Map.of("id", "test")); + new VerifiableCredentialSubject(subjectData); //Using Builder VerifiableCredential credentialWithoutProof = diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java index b605dc318..dcd0344e0 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/HoldersCredentialTest.java @@ -164,7 +164,7 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti List typesOfVcs = List.of("Type1", "Type2", "Type3"); typesOfVcs.forEach(type -> { - VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(did, miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); vcs.add(verifiableCredential); }); @@ -215,7 +215,7 @@ void getCredentialsAsJWT200() throws JSONException { List typesOfVcs = List.of("Type1", "Type2", "Type3"); typesOfVcs.forEach(type -> { - VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(did, miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); vcs.add(verifiableCredential); }); @@ -344,7 +344,7 @@ private Map issueVC() throws JsonProcessingException { String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; ResponseEntity response = TestUtils.createWallet(bpn, "Test Wallet", restTemplate, baseBpn, defaultLocation); Wallet wallet = TestUtils.getWalletFromString(response.getBody()); - VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), "Type1", AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(bpn, wallet.getDid(), miwSettings.authorityWalletDid(), "Type1", AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); Map map = objectMapper.readValue(verifiableCredential.toJson(), Map.class); return map; } diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java index 1cdbffc07..46f602d29 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/IssuersCredentialTest.java @@ -94,7 +94,7 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti //issue some VCs List typesOfVcs = List.of("Type1", "Type2", "Type3"); typesOfVcs.forEach(type -> { - TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + TestUtils.issueCustomVCUsingBaseWallet(holderBpn, wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); }); @@ -146,7 +146,7 @@ void getCredentialsAsJWT200() throws JSONException { //create test data List typesOfVcs = List.of("Type1", "Type2", "Type3"); typesOfVcs.forEach(type -> { - TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + TestUtils.issueCustomVCUsingBaseWallet(holderBpn, wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); }); HttpEntity entity = new HttpEntity<>(headers); @@ -191,7 +191,7 @@ void issueCredentialsWithoutBaseWalletBPN403() throws JsonProcessingException { Assertions.assertThrows(ForbiddenException.class, () -> { - TestUtils.issueCustomVCUsingBaseWallet(holderDid, holderDid, type, headers, miwSettings, objectMapper, restTemplate); + TestUtils.issueCustomVCUsingBaseWallet(bpn, holderDid, holderDid, type, headers, miwSettings, objectMapper, restTemplate); }); } @@ -206,7 +206,7 @@ void issueCredentialsToBaseWallet200() throws JsonProcessingException { String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation); - VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(miwSettings.authorityWalletDid(), miwSettings.authorityWalletDid(), type, headers, miwSettings, objectMapper, restTemplate); + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(baseBpn, miwSettings.authorityWalletDid(), miwSettings.authorityWalletDid(), type, headers, miwSettings, objectMapper, restTemplate); Assertions.assertNotNull(verifiableCredential.getProof()); @@ -229,7 +229,7 @@ void issueCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcep String defaultLocation = miwSettings.host() + COLON_SEPARATOR + bpn; TestUtils.createWallet(bpn, bpn, restTemplate, baseBpn, defaultLocation); - VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(did, miwSettings.authorityWalletDid(), type, headers, miwSettings, objectMapper, restTemplate); + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), type, headers, miwSettings, objectMapper, restTemplate); Assertions.assertNotNull(verifiableCredential.getProof()); diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java index f652f6360..4441d6385 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java @@ -118,13 +118,13 @@ public void setup() throws DidParseException { tenant_2 = DidParser.parse(tenantWallet2.getDid()); - Map type1 = TestUtils.getCredentialAsMap(miwSettings.authorityWalletDid(), "Type1", miwSettings, new com.fasterxml.jackson.databind.ObjectMapper()); + Map type1 = TestUtils.getCredentialAsMap(miwSettings.authorityWalletBpn(), miwSettings.authorityWalletDid(), miwSettings.authorityWalletDid(), "Type1", miwSettings, new com.fasterxml.jackson.databind.ObjectMapper()); CredentialsResponse rs1 = issuersCredentialService.issueCredentialUsingBaseWallet(tenantWallet.getDid(), type1, false, bpnOperator); vc_1 = new ObjectMapper().convertValue(rs1, VerifiableCredential.class); - Map type2 = TestUtils.getCredentialAsMap(miwSettings.authorityWalletDid(), "Type2", miwSettings, new com.fasterxml.jackson.databind.ObjectMapper()); + Map type2 = TestUtils.getCredentialAsMap(miwSettings.authorityWalletBpn(), miwSettings.authorityWalletDid(), miwSettings.authorityWalletDid(), "Type2", miwSettings, new com.fasterxml.jackson.databind.ObjectMapper()); CredentialsResponse rs2 = issuersCredentialService.issueCredentialUsingBaseWallet(tenantWallet.getDid(), type2, false, bpnOperator); vc_2 = new ObjectMapper().convertValue(rs2, VerifiableCredential.class); diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java index dd12af4c1..cfe0c8199 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java @@ -21,6 +21,7 @@ package org.eclipse.tractusx.managedidentitywallets.vp; +import com.fasterxml.jackson.databind.ObjectMapper; import com.nimbusds.jwt.JWT; import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.JWTParser; @@ -29,6 +30,7 @@ import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication; import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings; import org.eclipse.tractusx.managedidentitywallets.config.TestContextInitializer; +import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.dao.entity.JtiRecord; import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; import org.eclipse.tractusx.managedidentitywallets.dao.repository.JtiRepository; @@ -38,8 +40,10 @@ import org.eclipse.tractusx.managedidentitywallets.exception.PermissionViolationException; import org.eclipse.tractusx.managedidentitywallets.service.IssuersCredentialService; import org.eclipse.tractusx.managedidentitywallets.service.PresentationService; +import org.eclipse.tractusx.managedidentitywallets.utils.AuthenticationUtils; import org.eclipse.tractusx.managedidentitywallets.utils.TestConstants; import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; +import org.eclipse.tractusx.ssi.lib.model.verifiable.Verifiable; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; import org.eclipse.tractusx.ssi.lib.model.verifiable.presentation.VerifiablePresentation; @@ -71,7 +75,7 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = { ManagedIdentityWalletsApplication.class }) @ContextConfiguration(initializers = { TestContextInitializer.class }) -public class PresentationServiceTest { +class PresentationServiceTest { @Autowired private MIWSettings miwSettings; @@ -88,6 +92,9 @@ public class PresentationServiceTest { @Autowired private IssuersCredentialService issuersCredentialService; + @Autowired + private ObjectMapper objectMapper; + @Autowired private WalletRepository walletRepository; @@ -102,6 +109,10 @@ void createPresentation200ResponseAsJWT() { JtiRecord jtiRecord = buildJti(jtiValue, false); jtiRepository.save(jtiRecord); + //issue BPN vc + VerifiableCredential bpnVc = TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), StringPool.BPN_CREDENTIAL, + AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + Map presentation = presentationService.createVpWithRequiredScopes(SignedJWT.parse(accessToken), asJwt); String vpAsJwt = String.valueOf(presentation.get(VERIFIABLE_PRESENTATION)); JWT jwt = JWTParser.parse(vpAsJwt); @@ -122,6 +133,10 @@ void createPresentation200ResponseAsJsonLD() { JtiRecord jtiRecord = buildJti(jtiValue, false); jtiRepository.save(jtiRecord); + //issue BPN vc + TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), StringPool.BPN_CREDENTIAL, + AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + Map presentation = presentationService.createVpWithRequiredScopes(SignedJWT.parse(accessToken), asJwt); Assertions.assertNotNull(presentation); @@ -130,8 +145,8 @@ void createPresentation200ResponseAsJsonLD() { VerifiableCredential verifiableCredential = vp.getVerifiableCredentials().get(0); VerifiableCredentialSubject verifiableCredentialSubject = verifiableCredential.getCredentialSubject().get(0); Assertions.assertNotNull(verifiableCredentialSubject); - Assertions.assertEquals(bpn, verifiableCredentialSubject.get("bpn")); - Assertions.assertEquals(did, verifiableCredentialSubject.get("id")); + Assertions.assertEquals(bpn, verifiableCredentialSubject.get(StringPool.BPN)); + Assertions.assertEquals(did, verifiableCredentialSubject.get(Verifiable.ID)); } @SneakyThrows @@ -143,6 +158,11 @@ void createPresentation200ResponseNoJtiRecord() { String jtiValue = generateUuid(); String accessToken = generateAccessToken(did, did, did, BPN_CREDENTIAL_READ, jtiValue); + //issue BPN vc + TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), StringPool.BPN_CREDENTIAL, + AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + + Map presentation = presentationService.createVpWithRequiredScopes(SignedJWT.parse(accessToken), asJwt); String vpAsJwt = String.valueOf(presentation.get(VERIFIABLE_PRESENTATION)); JWT jwt = JWTParser.parse(vpAsJwt); diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java index 8d489f403..6b9e55b2e 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java @@ -277,7 +277,7 @@ private Map getIssueVPRequest(String bpn) throws JsonProcessingE List typesOfVcs = List.of("Type1", "Type2", "Type3"); typesOfVcs.forEach(type -> { - VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); + VerifiableCredential verifiableCredential = TestUtils.issueCustomVCUsingBaseWallet(wallet.getBpn(), wallet.getDid(), miwSettings.authorityWalletDid(), type, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); vcs.add(verifiableCredential); }); List credentials = holdersCredentialRepository.getByHolderDid(wallet.getDid()); From ae9bceffcd24d899316ad3371d87292386a1edc3 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Wed, 12 Jun 2024 12:43:29 +0530 Subject: [PATCH 06/10] chore: removed envs from dev asset and sonar fix --- dev-assets/env-files/env.docker.dist | 1 - dev-assets/env-files/env.local.dist | 1 - .../managedidentitywallets/vp/PresentationServiceTest.java | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dev-assets/env-files/env.docker.dist b/dev-assets/env-files/env.docker.dist index aeedf42a1..e0ac25992 100644 --- a/dev-assets/env-files/env.docker.dist +++ b/dev-assets/env-files/env.docker.dist @@ -31,7 +31,6 @@ LOCAL_SIGNING_KEY_STORAGE_TYPE=DB KEYCLOAK_REALM=miw_test VC_SCHEMA_LINK="https://www.w3.org/2018/credentials/v1, https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json" VC_EXPIRY_DATE=01-01-2025 -SUPPORTED_FRAMEWORK_VC_TYPES="PcfCredential, SustainabilityCredential, QualityCredential, TraceabilityCredential, BehaviorTwinCredential, ResiliencyCredential" MIW_HOST_NAME=localhost ENFORCE_HTTPS_IN_DID_RESOLUTION=false diff --git a/dev-assets/env-files/env.local.dist b/dev-assets/env-files/env.local.dist index 30c20135a..d7065338a 100644 --- a/dev-assets/env-files/env.local.dist +++ b/dev-assets/env-files/env.local.dist @@ -31,7 +31,6 @@ LOCAL_SIGNING_KEY_STORAGE_TYPE=DB KEYCLOAK_REALM=miw_test VC_SCHEMA_LINK="https://www.w3.org/2018/credentials/v1, https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json" VC_EXPIRY_DATE=01-01-2025 -SUPPORTED_FRAMEWORK_VC_TYPES="PcfCredential, SustainabilityCredential, QualityCredential, TraceabilityCredential, BehaviorTwinCredential, ResiliencyCredential" MIW_HOST_NAME=localhost ENFORCE_HTTPS_IN_DID_RESOLUTION=false diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java index cfe0c8199..31768e042 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationServiceTest.java @@ -110,7 +110,7 @@ void createPresentation200ResponseAsJWT() { jtiRepository.save(jtiRecord); //issue BPN vc - VerifiableCredential bpnVc = TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), StringPool.BPN_CREDENTIAL, + TestUtils.issueCustomVCUsingBaseWallet(bpn, did, miwSettings.authorityWalletDid(), StringPool.BPN_CREDENTIAL, AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()), miwSettings, objectMapper, restTemplate); Map presentation = presentationService.createVpWithRequiredScopes(SignedJWT.parse(accessToken), asJwt); From e776be9310fae3eec875753cc8b027f62fcb1626 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Wed, 12 Jun 2024 13:03:04 +0530 Subject: [PATCH 07/10] chore: copyright update --- .../config/security/SecurityConfig.java | 4 ++-- .../tractusx/managedidentitywallets/constant/RestURI.java | 2 +- .../controller/PresentationController.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java index d93c6cd32..59bce9fad 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java @@ -1,6 +1,6 @@ /* * ******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -110,7 +110,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { //VC - Issuer .requestMatchers(new AntPathRequestMatcher(RestURI.ISSUERS_CREDENTIALS, GET.name())).hasAnyRole(ApplicationRole.ROLE_UPDATE_WALLETS) //Lis of issuer VC .requestMatchers(new AntPathRequestMatcher(RestURI.ISSUERS_CREDENTIALS, POST.name())).hasAnyRole(ApplicationRole.ROLE_UPDATE_WALLETS) //Issue VC - + //error .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() ).oauth2ResourceServer(resourceServer -> resourceServer.jwt(jwt -> diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java index a9273fef5..764a0af4d 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.java @@ -1,6 +1,6 @@ /* * ******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. diff --git a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java index 2d50616c5..1a2f7d878 100644 --- a/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java +++ b/miw/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java @@ -1,6 +1,6 @@ /* * ******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. From 1ec925401eca38b5c11ef8b7a7eb9b07ea1e6170 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Wed, 12 Jun 2024 14:10:01 +0530 Subject: [PATCH 08/10] doc: API doc updated --- docs/api/openapi_v001.json | 2506 ++++++++++++------------------------ 1 file changed, 829 insertions(+), 1677 deletions(-) diff --git a/docs/api/openapi_v001.json b/docs/api/openapi_v001.json index 0f7594660..9d93d17b7 100644 --- a/docs/api/openapi_v001.json +++ b/docs/api/openapi_v001.json @@ -1,41 +1,45 @@ { "openapi": "3.0.1", - "info": { + "info" : { "title": "Managed Identity Wallets API", "description": "Managed Identity Wallets API", "termsOfService": "https://www.eclipse.org/legal/termsofuse.php", - "contact": { + "contact" : { "name": "Eclipse Tractus-X", "url": "https://projects.eclipse.org/projects/automotive.tractusx", "email": "tractusx-dev@eclipse.org" }, - "license": { + "license" : { "name": "Apache 2.0", "url": "https://github.com/eclipse-tractusx/managed-identity-wallets/blob/develop/LICENSE" }, "version": "0.0.1" }, - "security": [ - {"Authenticate using access_token": []}, - {"sts_token": []} + "security" : [ + { + "Authenticate using access_token" : [] + }, + { + "sts_token" : [] + } ], - "servers": [], - "paths": { - "/api/wallets": { - "get": { - "tags": [ + "servers" : [], + "paths" : { + "/api/wallets" : { + "get" : { + "tags" : [ "Wallets" ], "summary": "List of wallets", "description": "Permission: **view_wallets** \n\n Retrieve list of registered wallets", "operationId": "getWallets", - "parameters": [ + "parameters" : [ { "name": "pageNumber", "in": "query", "description": "Page number, Page number start with zero", "required": false, - "schema": { + "schema" : { "type": "integer", "format": "int32", "default": 0 @@ -46,7 +50,7 @@ "in": "query", "description": "Number of records per page", "required": false, - "schema": { + "schema" : { "type": "integer", "format": "int32", "default": 2147483647 @@ -57,24 +61,24 @@ "in": "query", "description": "Sort column name", "required": false, - "schema": { + "schema" : { "type": "string", "default": "createdAt" }, - "examples": { - "Creation date": { + "examples" : { + "Creation date" : { "description": "Creation date", "value": "createdAt" }, - "Wallet BPN": { + "Wallet BPN" : { "description": "Wallet BPN", "value": "bpn" }, - "Wallet did": { + "Wallet did" : { "description": "Wallet did", "value": "did" }, - "Wallet name": { + "Wallet name" : { "description": "Wallet name", "value": "name" } @@ -85,48 +89,48 @@ "in": "query", "description": "Sort order", "required": false, - "schema": { + "schema" : { "type": "string", "default": "desc" }, - "examples": { - "Ascending order": { + "examples" : { + "Ascending order" : { "description": "Ascending order", "value": "asc" }, - "Descending order": { + "Descending order" : { "description": "Descending order", "value": "desc" } } } ], - "responses": { - "200": { + "responses" : { + "200" : { "description": "Wallet list", - "content": { - "application/json": { - "examples": { - "Wallet list": { + "content" : { + "application/json" : { + "examples" : { + "Wallet list" : { "description": "Wallet list", - "value": { - "content": [ + "value" : { + "content" : [ { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000001", "algorithm": "ED25519", - "didDocument": { - "@context": [ + "didDocument" : { + "@context" : [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod": [ + "verificationMethod" : [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#", - "publicKeyJwk": { + "publicKeyJwk" : { "crv": "Ed25519", "kty": "OKP", "x": "mhph0ZSVk7cDVmazbaaC3jBDpphW4eNygAK9gHPlMow" @@ -137,8 +141,8 @@ } } ], - "pageable": { - "sort": { + "pageable" : { + "sort" : { "empty": false, "sorted": true, "unsorted": false @@ -154,7 +158,7 @@ "last": false, "size": 1, "number": 0, - "sort": { + "sort" : { "empty": false, "sorted": true, "unsorted": false @@ -168,22 +172,22 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": {} + "errors" : {} } } } @@ -191,26 +195,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -220,29 +224,29 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] }, - "post": { - "tags": [ + "post" : { + "tags" : [ "Wallets" ], "summary": "Create Wallet", "description": "Permission: **add_wallets** (The BPN of the base wallet must equal BPN of caller)\n\n Create a wallet and store it", "operationId": "createWallet", - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "$ref": "#/components/schemas/CreateWalletRequest" }, - "examples": { - "Create wallet with BPN": { + "examples" : { + "Create wallet with BPN" : { "description": "Create wallet with BPN", - "value": { + "value" : { "businessPartnerNumber": "BPNL000000000001", "companyName": "companyA", "didUrl": "portal.com:BPNL000000000001" @@ -253,30 +257,30 @@ }, "required": true }, - "responses": { - "201": { + "responses" : { + "201" : { "description": "Created", - "content": { - "application/json": { - "examples": { - "Success response": { + "content" : { + "application/json" : { + "examples" : { + "Success response" : { "description": "Success response", - "value": { + "value" : { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000501", "algorithm": "ED25519", - "didDocument": { - "@context": [ + "didDocument" : { + "@context" : [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod": [ + "verificationMethod" : [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#key-1", - "publicKeyJwk": { + "publicKeyJwk" : { "crv": "Ed25519", "kty": "OKP", "x": "0Ap6FsX5UuRBIoOzxWtcFA2ymnqXw0U08Ino_mIuYM4" @@ -286,7 +290,7 @@ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#key-2", - "publicKeyJwk": { + "publicKeyJwk" : { "crv": "secp256k1", "kty": "EC", "x": "f9PkTOpsbcgKe_-s6bNCve3-aB1VZAFsCub8C5bhDn0", @@ -302,22 +306,22 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": { + "errors" : { "filed": "filed error message" } } @@ -327,26 +331,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "409": { + "409" : { "description": "The request could not be completed due to a conflict.", - "content": { - "application/json": { - "examples": { - "Wallet already exist": { + "content" : { + "application/json" : { + "examples" : { + "Wallet already exist" : { "description": "Wallet already exist", - "value": { + "value" : { "type": "about:blank", "title": "Wallet is already exists for bpn BPNL000000000001", "status": 409, "detail": "Wallet is already exists for bpn BPNL000000000001", "instance": "/api/wallets", - "properties": { + "properties" : { "timestamp": 1689762639948 } } @@ -355,20 +359,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -378,79 +382,79 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/wallets/{identifier}/credentials": { - "post": { - "tags": [ + "/api/wallets/{identifier}/credentials" : { + "post" : { + "tags" : [ "Wallets" ], "summary": "Store Verifiable Credential", "description": "Permission: **update_wallets** OR **update_wallet** (The BPN of wallet to extract credentials from must equal BPN of caller) \n\n Store a verifiable credential in the wallet of the given identifier", "operationId": "storeCredential", - "parameters": [ + "parameters" : [ { "name": "identifier", "in": "path", "description": "Did or BPN", "required": true, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "bpn": { + "examples" : { + "bpn" : { "description": "bpn", "value": "BPNL000000000000" }, - "did": { + "did" : { "description": "did", "value": "did:web:localhost:BPNL000000000000" } } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "type": "object", - "additionalProperties": { + "additionalProperties" : { "type": "object" } }, - "example": { - "@context": [ + "example" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#" ], "id": "did:web:localhost.in#123456789", - "type": [ + "type" : [ "VerifiableCredential", "LegalParticipant" ], "issuer": "did:web:localhost.in", "issuanceDate": "2023-05-04T07:36:03.633Z", - "credentialSubject": { + "credentialSubject" : { "id": "https://localhost/.well-known/participant.json", "type": "gx:LegalParticipant", "gx:legalName": "Sample Company", - "gx:legalRegistrationNumber": { + "gx:legalRegistrationNumber" : { "gx:taxID": "113123123" }, - "gx:headquarterAddress": { + "gx:headquarterAddress" : { "gx:countrySubdivisionCode": "BE-BRU" }, - "gx:legalAddress": { + "gx:legalAddress" : { "gx:countrySubdivisionCode": "BE-BRU" }, "gx-terms-and-conditions:gaiaxTermsAndConditions": "70c1d713215f95191a11d38fe2341faed27d19e083917bc8732ca4fea4976700" }, - "proof": { + "proof" : { "type": "JsonWebSignature2020", "created": "2023-05-04T07:36:04.079Z", "proofPurpose": "assertionMethod", @@ -462,15 +466,15 @@ }, "required": true }, - "responses": { - "201": { + "responses" : { + "201" : { "description": "Success Response", - "content": { - "application/json": { - "examples": { - "Success Response": { + "content" : { + "application/json" : { + "examples" : { + "Success Response" : { "description": "Success Response", - "value": { + "value" : { "message": "Credential with id did:web:localhost#123456789 has been successfully stored" } } @@ -478,22 +482,22 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": {} + "errors" : {} } } } @@ -501,26 +505,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "404": { + "404" : { "description": "Wallet not found with provided identifier", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided identifier": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with provided identifier" : { "description": "Wallet not found with provided identifier", - "value": { + "value" : { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL000000044001", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL000000044001", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000/credentials", - "properties": { + "properties" : { "timestamp": 1689765541959 } } @@ -529,20 +533,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -552,31 +556,31 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/token": { - "post": { - "tags": [ + "/api/token" : { + "post" : { + "tags" : [ "STS" ], "summary": "Create and Sign Access Tokens", "description": "The endpoint for creating and signing access tokens which are to be used during a verifiable presentation flow.", "operationId": "token_1", - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "$ref": "#/components/schemas/SecureTokenRequest" }, - "examples": { - "Request Secure Token using Scopes": { + "examples" : { + "Request Secure Token using Scopes" : { "description": "Request Secure Token using Scopes", - "value": { + "value" : { "audience": "BPNL000000000009", "client_id": "your_client_id", "client_secret": "your_client_secret", @@ -584,9 +588,9 @@ "bearer_access_scope": "org.eclipse.tractusx.vc.type:ValidCredentialType:read" } }, - "Request Secure Token using Access Token": { + "Request Secure Token using Access Token" : { "description": "Request Secure Token using Access Token", - "value": { + "value" : { "audience": "BPNL000000000009", "client_id": "your_client_id", "client_secret": "your_client_secret", @@ -599,15 +603,15 @@ }, "required": true }, - "responses": { - "201": { + "responses" : { + "201" : { "description": "Created", - "content": { - "application/json": { - "examples": { - "Success response": { + "content" : { + "application/json" : { + "examples" : { + "Success response" : { "description": "Success response", - "value": { + "value" : { "token": "a_jwt_token", "expiresAt": 1706888709315 } @@ -616,35 +620,35 @@ } } }, - "400": { + "400" : { "description": "Bad Request", - "content": { - "application/json": { - "examples": { - "Unknown BPN": { + "content" : { + "application/json" : { + "examples" : { + "Unknown BPN" : { "description": "Unknown BPN", - "value": { + "value" : { "error": "UnknownBusinessPartnerNumber", "errorDescription": "The provided BPN 'BPNL000000000001' is unknown" } }, - "Wrong Grant Type": { + "Wrong Grant Type" : { "description": "Wrong Grant Type", - "value": { + "value" : { "error": "UnsupportedGrantTypeException", "errorDescription": "The provided 'grant_type' is not valid. Use 'client_credentials'." } }, - "Invalid idp Token Response": { + "Invalid idp Token Response" : { "description": "Invalid idp Token Response", - "value": { + "value" : { "error": "InvalidIdpTokenResponse", "errorDescription": "The idp response cannot be null. Possible causes for this are: the 'clientId' is invalid, or the 'client' is not enabled." } }, - "Invalid Secure Token Request": { + "Invalid Secure Token Request" : { "description": "Invalid Secure Token Request", - "value": { + "value" : { "error": "InvalidSecureTokenRequest", "errorDescription": "The provided data could not be used to create and sign a token." } @@ -653,20 +657,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -678,20 +682,20 @@ } } }, - "/api/presentations": { - "post": { - "tags": [ + "/api/presentations" : { + "post" : { + "tags" : [ "Verifiable Presentations - Generation" ], "summary": "Create Verifiable Presentation", "description": "Permission: **update_wallets** OR **update_wallet** (The BPN of the issuer of the Verifiable Presentation must equal to BPN of caller) \n\n Create a verifiable presentation from a list of verifiable credentials, signed by the holder", "operationId": "createPresentation", - "parameters": [ + "parameters" : [ { "name": "audience", "in": "query", "required": false, - "schema": { + "schema" : { "type": "string" } }, @@ -699,45 +703,45 @@ "name": "asJwt", "in": "query", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "type": "object", - "additionalProperties": { + "additionalProperties" : { "type": "object" } }, - "example": { - "verifiableCredentials": [ + "example" : { + "verifiableCredentials" : [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -751,46 +755,46 @@ }, "required": true }, - "responses": { - "200": { + "responses" : { + "200" : { "description": "Verifiable Presentation", - "content": { - "application/json": { - "examples": { - "VP as Json-LD": { + "content" : { + "application/json" : { + "examples" : { + "VP as Json-LD" : { "description": "VP as Json-LD", - "value": { - "vp": { - "@context": [ + "value" : { + "vp" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1" ], "id": "did:web:localhost:BPNL000000000000#b2e69e47-95f3-48ff-af30-eaaab36431d5", - "type": [ + "type" : [ "VerifiablePresentation" ], - "verifiableCredential": [ + "verifiableCredential" : [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -802,9 +806,9 @@ } } }, - "VP as JWT": { + "VP as JWT" : { "description": "VP as JWT", - "value": { + "value" : { "vp": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwiYXVkIjoic21hcnQiLCJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidnAiOnsiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIzM4ZTU2ZTg1LTNkODQtNGEyNS1iZjg1LWFiMjRlYzY4MmMwOSIsInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vY2F0ZW5heC1uZy5naXRodWIuaW8vcHJvZHVjdC1jb3JlLXNjaGVtYXMvYnVzaW5lc3NQYXJ0bmVyRGF0YS5qc29uIiwiaHR0cHM6Ly93M2lkLm9yZy9zZWN1cml0eS9zdWl0ZXMvandzLTIwMjAvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkJwbkNyZWRlbnRpYWwiXSwiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwI2Y3M2UzNjMxLWJhODctNGEwMy1iZWEzLWIyODcwMDA1Njg3OSIsImlzc3VlciI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTA3LTE5VDA5OjExOjM0WiIsImV4cGlyYXRpb25EYXRlIjoiMjAyNC0xMi0zMVQxODozMDowMFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJicG4iOiJCUE5MMDAwMDAwMDAwMDAwIiwidHlwZSI6IkJwbkNyZWRlbnRpYWwifSwicHJvb2YiOnsicHJvb2ZQdXJwb3NlIjoicHJvb2ZQdXJwb3NlIiwidHlwZSI6Ikpzb25XZWJTaWduYXR1cmUyMDIwIiwidmVyaWZpY2F0aW9uTWV0aG9kIjoiZGlkOndlYjpsb2NhbGhvc3Q6QlBOTDAwMDAwMDAwMDAwMCMiLCJjcmVhdGVkIjoiMjAyMy0wNy0xOVQwOToxMTozOVoiLCJqd3MiOiJleUpoYkdjaU9pSkZaRVJUUVNKOS4uZmRuMnFVODVhdU9sdGRIRExkSEk3c0pWVjFaUGRmdHBpWGRfbmRYTjBkRmdTRFdpSXJTY2REMDN3dHZLTHFfSC1zaFFXZmgyUlllTW1ybEV6QWhmRHcifX19LCJleHAiOjE2ODk4MzQ4MDUsImp0aSI6ImIwODYzOWZiLWQ5MWEtNGUwZS1iNmY4LTYzYjdhMzQ1ZTRhZiJ9.80x0AB-OauefdeZfx1cwhitdVKRvCRFeFzYwU73DL7y4w34vu6BdfHWLBGjkwELxkQEoFfiTPOqtuyqhtsyDBg" } } @@ -812,26 +816,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "404": { + "404" : { "description": "Wallet not found with provided identifier", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided identifier": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with provided identifier" : { "description": "Wallet not found with provided identifier", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 404, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -840,20 +844,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -863,28 +867,28 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/presentations/validation": { - "post": { - "tags": [ + "/api/presentations/validation" : { + "post" : { + "tags" : [ "Verifiable Presentations - Validation" ], "summary": "Validate Verifiable Presentation", "description": "Permission: **view_wallets** OR **view_wallet** \n\n Validate Verifiable Presentation with all included credentials", "operationId": "validatePresentation", - "parameters": [ + "parameters" : [ { "name": "audience", "in": "query", "description": "Audience to validate in VP (Only supported in case of JWT formatted VP)", "required": false, - "schema": { + "schema" : { "type": "string" } }, @@ -893,7 +897,7 @@ "in": "query", "description": "Pass true in case of VP is in JWT format", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false } @@ -903,62 +907,62 @@ "in": "query", "description": "Check expiry of VC(Only supported in case of JWT formatted VP)", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "type": "object", - "additionalProperties": { + "additionalProperties" : { "type": "object" } }, - "examples": { - "VP as JWT": { + "examples" : { + "VP as JWT" : { "description": "VP as JWT", - "value": { + "value" : { "vp": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwiYXVkIjoic21hcnQiLCJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidnAiOnsiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIzZmZWRmYWRmLWYxNTItNGNjZS05MWQ1LWNjMjhhNzhlMTExMyIsInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vY2F0ZW5heC1uZy5naXRodWIuaW8vcHJvZHVjdC1jb3JlLXNjaGVtYXMvYnVzaW5lc3NQYXJ0bmVyRGF0YS5qc29uIiwiaHR0cHM6Ly93M2lkLm9yZy9zZWN1cml0eS9zdWl0ZXMvandzLTIwMjAvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkJwbkNyZWRlbnRpYWwiXSwiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwI2Y3M2UzNjMxLWJhODctNGEwMy1iZWEzLWIyODcwMDA1Njg3OSIsImlzc3VlciI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTA3LTE5VDA5OjExOjM0WiIsImV4cGlyYXRpb25EYXRlIjoiMjAyNC0xMi0zMVQxODozMDowMFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJicG4iOiJCUE5MMDAwMDAwMDAwMDAwIiwidHlwZSI6IkJwbkNyZWRlbnRpYWwifSwicHJvb2YiOnsicHJvb2ZQdXJwb3NlIjoicHJvb2ZQdXJwb3NlIiwidHlwZSI6Ikpzb25XZWJTaWduYXR1cmUyMDIwIiwidmVyaWZpY2F0aW9uTWV0aG9kIjoiZGlkOndlYjpsb2NhbGhvc3Q6QlBOTDAwMDAwMDAwMDAwMCMiLCJjcmVhdGVkIjoiMjAyMy0wNy0xOVQwOToxMTozOVoiLCJqd3MiOiJleUpoYkdjaU9pSkZaRVJUUVNKOS4uZmRuMnFVODVhdU9sdGRIRExkSEk3c0pWVjFaUGRmdHBpWGRfbmRYTjBkRmdTRFdpSXJTY2REMDN3dHZLTHFfSC1zaFFXZmgyUlllTW1ybEV6QWhmRHcifX19LCJleHAiOjE2ODk3NTg1NDQsImp0aSI6IjdlNWE4MzQ4LTgwZjUtNGIzMS1iMDNlLTBiOTJmNzc4ZTVjZiJ9.c7FS-CLwm3vxfO9847M5sqcVxv3QbwwSmSsFWcGif7MOesjt1pdnARlQ4pvHzgsFj1UqBEvHwZQvyYyPCQg_Cw" } }, - "VP as json-ld": { + "VP as json-ld" : { "description": "VP as json-ld", - "value": { - "vp": { + "value" : { + "vp" : { "id": "b9d97cef-758d-4a7c-843d-86f17632b08a", - "type": [ + "type" : [ "VerifiablePresentation" ], - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1" ], - "verifiableCredential": [ + "verifiableCredential" : [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -975,15 +979,15 @@ }, "required": true }, - "responses": { - "200": { + "responses" : { + "200" : { "description": "Verifiable presentation validate", - "content": { - "application/json": { - "examples": { - "VP as JWT": { + "content" : { + "application/json" : { + "examples" : { + "VP as JWT" : { "description": "VP as JWT", - "value": { + "value" : { "valid": true, "validateJWTExpiryDate": true, "validateAudience": true, @@ -995,35 +999,35 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Validation of VP in form of JSON-LD is not supported": { + "content" : { + "application/json" : { + "examples" : { + "Validation of VP in form of JSON-LD is not supported" : { "description": "Validation of VP in form of JSON-LD is not supported", - "value": { + "value" : { "type": "about:blank", "title": "Validation of VP in form of JSON-LD is not supported", "status": 400, "detail": "Validation of VP in form of JSON-LD is not supported", "instance": "/api/presentations/validation", - "properties": { + "properties" : { "timestamp": 1689835085703 } } }, - "Response in case of invalid data provided": { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": { + "errors" : { "filed": "filed error message" } } @@ -1033,26 +1037,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -1062,32 +1066,32 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/credentials": { - "get": { - "tags": [ + "/api/credentials" : { + "get" : { + "tags" : [ "Verifiable Credential - Holder" ], "summary": "Query Verifiable Credentials", "description": "Permission: **view_wallets** OR **view_wallet** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", "operationId": "getCredentials", - "parameters": [ + "parameters" : [ { "name": "credentialId", "in": "query", "description": "Credential Id", "required": false, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "Credential Id": { + "examples" : { + "Credential Id" : { "description": "Credential Id", "value": "did:web:localhost:BPNL000000000000#12528899-160a-48bd-ba15-f396c3959ae9" } @@ -1098,15 +1102,15 @@ "in": "query", "description": "Issuer identifier(did of BPN)", "required": false, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "bpn": { + "examples" : { + "bpn" : { "description": "bpn", "value": "BPNL000000000000" }, - "did": { + "did" : { "description": "did", "value": "did:web:localhost:BPNL000000000000" } @@ -1117,19 +1121,19 @@ "in": "query", "description": "Type of VC", "required": false, - "schema": { + "schema" : { "type": "array", "maxItems": 100, - "items": { + "items" : { "type": "string" } }, - "examples": { - "SummaryCredential": { + "examples" : { + "SummaryCredential" : { "description": "SummaryCredential", "value": "SummaryCredential" }, - "BpnCredential": { + "BpnCredential" : { "description": "BpnCredential", "value": "BpnCredential" } @@ -1140,32 +1144,32 @@ "in": "query", "description": "Sort column name", "required": false, - "schema": { + "schema" : { "type": "string", "default": "createdAt" }, - "examples": { - "creation date": { + "examples" : { + "creation date" : { "description": "creation date", "value": "createdAt" }, - "Self issued credential": { + "Self issued credential" : { "description": "Self issued credential", "value": "selfIssued" }, - "Stored credential": { + "Stored credential" : { "description": "Stored credential", "value": "stored" }, - "Issuer did": { + "Issuer did" : { "description": "Issuer did", "value": "issuerDid" }, - "Credential type": { + "Credential type" : { "description": "Credential type", "value": "type" }, - "Credential id": { + "Credential id" : { "description": "Credential id", "value": "credentialId" } @@ -1176,16 +1180,16 @@ "in": "query", "description": "Sort order", "required": false, - "schema": { + "schema" : { "type": "string", "default": "desc" }, - "examples": { - "Ascending order": { + "examples" : { + "Ascending order" : { "description": "Ascending order", "value": "asc" }, - "Descending order": { + "Descending order" : { "description": "Descending order", "value": "desc" } @@ -1196,7 +1200,7 @@ "in": "query", "description": "Page number, Page number start with zero", "required": false, - "schema": { + "schema" : { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1209,7 +1213,7 @@ "in": "query", "description": "Number of records per page", "required": false, - "schema": { + "schema" : { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1222,58 +1226,58 @@ "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false }, - "examples": { - "Create VC as JWT": { + "examples" : { + "Create VC as JWT" : { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT": { + "Do not create VC as JWT" : { "description": "Do not create VC as JWT", "value": false } } } ], - "responses": { - "200": { + "responses" : { + "200" : { "description": "Credential list", - "content": { - "application/json": { - "examples": { - "Credential list": { + "content" : { + "application/json" : { + "examples" : { + "Credential list" : { "description": "Credential list", - "value": { - "content": [ + "value" : { + "content" : [ { - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#954d43de-ebed-481d-9e35-e3bbb311b8f5", - "type": [ + "type" : [ "VerifiableCredential", "SummaryCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-14T11:05:48Z", "expirationDate": "2023-09-30T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "contractTemplate": "https://public.catena-x.org/contracts/", "holderIdentifier": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "items": [ + "items" : [ "BpnCredential" ], "type": "SummaryCredential" } ], - "proof": { + "proof" : { "created": "2023-07-14T11:05:50Z", "jws": "eyJhbGciOiJFZERTQSJ9..4xwFUCtP0xXVEo5_lXd90Vv-TWO2FijZut-HZ5cozAQseexj8EpTkK1erhFbf2Ua1kb8pi_H5At5HiPkTxSIAQ", "proofPurpose": "proofPurpose", @@ -1282,8 +1286,8 @@ } } ], - "pageable": { - "sort": { + "pageable" : { + "sort" : { "empty": false, "sorted": true, "unsorted": false @@ -1299,7 +1303,7 @@ "last": true, "size": 2147483647, "number": 0, - "sort": { + "sort" : { "empty": false, "sorted": true, "unsorted": false @@ -1313,22 +1317,22 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": {} + "errors" : {} } } } @@ -1336,26 +1340,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "404": { + "404" : { "description": "Wallet not found with caller BPN", - "content": { - "application/json": { - "examples": { - "Wallet not found with caller BPN": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with caller BPN" : { "description": "Wallet not found with caller BPN", - "value": { + "value" : { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL0000000", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000/credentials", - "properties": { + "properties" : { "timestamp": 1689765541959 } } @@ -1364,20 +1368,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -1387,65 +1391,65 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] }, - "post": { - "tags": [ + "post" : { + "tags" : [ "Verifiable Credential - Holder" ], "summary": "Issue Verifiable Credential", "description": "Permission: **update_wallets** OR **update_wallet** (The BPN of the issuer of the Verifiable Credential must equal BPN of caller)\nIssue a verifiable credential with a given issuer DID", "operationId": "issueCredential", - "parameters": [ + "parameters" : [ { "name": "asJwt", "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false }, - "examples": { - "Create VC as JWT": { + "examples" : { + "Create VC as JWT" : { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT": { + "Do not create VC as JWT" : { "description": "Do not create VC as JWT", "value": false } } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "type": "object", - "additionalProperties": { + "additionalProperties" : { "type": "object" } }, - "example": { - "@context": [ + "example" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type": [ + "type" : [ "VerifiableCredential", "BankDetails" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1459,29 +1463,29 @@ }, "required": true }, - "responses": { - "201": { + "responses" : { + "201" : { "description": "Success Response", - "content": { - "application/json": { - "examples": { - "Success Response": { + "content" : { + "application/json" : { + "examples" : { + "Success Response" : { "description": "Success Response", - "value": { - "@context": [ + "value" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#319a2641-9407-4c39-bf51-a4a109b59604", - "type": [ + "type" : [ "VerifiableCredential", "BankDetails" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T13:41:52Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "bankName": "Dummy Bank", @@ -1490,7 +1494,7 @@ "accountNumber": "123456789" } ], - "proof": { + "proof" : { "proofPurpose": "proofPurpose", "verificationMethod": "did:web:localhost:BPNL000000000000#", "type": "JsonWebSignature2020", @@ -1503,22 +1507,22 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": { + "errors" : { "filed": "filed error message" } } @@ -1528,26 +1532,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "404": { + "404" : { "description": "Wallet not found with caller BPN", - "content": { - "application/json": { - "examples": { - "Wallet not found with caller BPN": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with caller BPN" : { "description": "Wallet not found with caller BPN", - "value": { + "value" : { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000501", - "properties": { + "properties" : { "timestamp": 1689764377224 } } @@ -1556,20 +1560,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -1579,64 +1583,64 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/credentials/validation": { - "post": { - "tags": [ + "/api/credentials/validation" : { + "post" : { + "tags" : [ "Verifiable Credential - Validation" ], "summary": "Validate Verifiable Credentials", "description": "Permission: **view_wallets** OR **view_wallet** \n\n Validate Verifiable Credentials", "operationId": "credentialsValidation", - "parameters": [ + "parameters" : [ { "name": "withCredentialExpiryDate", "in": "query", "description": "Check expiry of VC", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "$ref": "#/components/schemas/CredentialVerificationRequest" }, - "examples": { - "Validate credential in JSON-LD format": { + "examples" : { + "Validate credential in JSON-LD format" : { "description": "Validate credential in JSON-LD format", - "value": { - "@context": [ + "value" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:34Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -1645,9 +1649,9 @@ } } }, - "Validate credential in JWT format": { + "Validate credential in JWT format" : { "description": "Validate credential in JWT format", - "value": { + "value" : { "jwt": "eyJraWQiOiJkaWQ6d2ViOmFmODgtMjAzLTEyOS0yMTMtMTA3Lm5ncm9rLWZyZWUuYXBwOkJQTkwwMDAwMDAwMDAwMDAjOGYyZWU5ZDItYTM2Yy00MTM4LWJlMWYtYjZmZWZiNmY4MDI0IiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJpc3MiOiJkaWQ6d2ViOmFmODgtMjAzLTEyOS0yMTMtMTA3Lm5ncm9rLWZyZWUuYXBwOkJQTkwwMDAwMDAwMDAwMDAiLCJzdWIiOiJkaWQ6d2ViOmFmODgtMjAzLTEyOS0yMTMtMTA3Lm5ncm9rLWZyZWUuYXBwOkJQTkwwMDAwMDAwMDAwMTEiLCJleHAiOjE3MzU2Njk4MDAsInZjIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIiwiaHR0cHM6Ly9jb2Zpbml0eS14LmdpdGh1Yi5pby9zY2hlbWEtcmVnaXN0cnkvdjEuMS9Vc2VDYXNlVkMuanNvbiIsImh0dHBzOi8vdzNpZC5vcmcvc2VjdXJpdHkvc3VpdGVzL2p3cy0yMDIwL3YxIl0sImlkIjoiZGlkOndlYjphZjg4LTIwMy0xMjktMjEzLTEwNy5uZ3Jvay1mcmVlLmFwcDpCUE5MMDAwMDAwMDAwMDAwI2Q4Y2ZjZDBiLWY0NGQtNDVkMC05OGEzLTA4ZDZkNmU5Y2E5NSIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJVc2VDYXNlRnJhbWV3b3JrQ29uZGl0aW9uIl0sImlzc3VlciI6ImRpZDp3ZWI6YWY4OC0yMDMtMTI5LTIxMy0xMDcubmdyb2stZnJlZS5hcHA6QlBOTDAwMDAwMDAwMDAwMCIsImNyZWRlbnRpYWxTdWJqZWN0IjpbeyJob2xkZXJJZGVudGlmaWVyIjoiQlBOTDAwMDAwMDAwMDAxMSIsImlkIjoiZGlkOndlYjphZjg4LTIwMy0xMjktMjEzLTEwNy5uZ3Jvay1mcmVlLmFwcDpCUE5MMDAwMDAwMDAwMDExIiwidHlwZSI6IkJlaGF2aW9yVHdpbkNyZWRlbnRpYWwiLCJjb250cmFjdFRlbXBsYXRlIjoiaHR0cHM6Ly9wdWJsaWMuY2F0ZW5hLXgub3JnL2NvbnRyYWN0cy90cmFjZWFiaWx0eS52MS5wZGYiLCJjb250cmFjdFZlcnNpb24iOiIxLjAuMCJ9XSwiY3JlZGVudGlhbFN0YXR1cyI6bnVsbCwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wMi0wOFQxNDowMjo1M1oiLCJleHBpcmF0aW9uRGF0ZSI6IjIwMjQtMTItMzFUMTg6MzA6MDBaIn0sImp0aSI6IjliYWFhMjIzLTAxMjctNDEyZS05NjZhLTA3ZTJmZGU4NGNlNCJ9.X3rkj8Gv4OD5nEaeFG5pSA-dogbcYA91YEPmHiKT4FhAiIr7QAdSEULGXHYOn8-eK0jSDHNdAxNYIK1UwYRsCA" } } @@ -1656,19 +1660,19 @@ }, "required": true }, - "responses": { - "200": { + "responses" : { + "200" : { "description": "Validate Verifiable Credentials", - "content": { - "application/json": { - "examples": { - "Verifiable Credentials without check expiry": { + "content" : { + "application/json" : { + "examples" : { + "Verifiable Credentials without check expiry" : { "description": "Verifiable Credentials without check expiry", - "value": { + "value" : { "valid": true, - "vc": { + "vc" : { "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1676,18 +1680,18 @@ } ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" }, - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -1697,14 +1701,14 @@ } } }, - "Verifiable Credentials with check expiry": { + "Verifiable Credentials with check expiry" : { "description": "Verifiable Credentials with check expiry", - "value": { + "value" : { "valid": true, "validateExpiryDate": true, - "vc": { + "vc" : { "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1712,18 +1716,18 @@ } ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" }, - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -1733,14 +1737,14 @@ } } }, - "Verifiable expired credentials with check expiry ": { + "Verifiable expired credentials with check expiry " : { "description": "Verifiable expired credentials with check expiry ", - "value": { + "value" : { "valid": false, "validateExpiryDate": false, - "vc": { + "vc" : { "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1748,18 +1752,18 @@ } ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" }, - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -1769,17 +1773,17 @@ } } }, - "Revocable Verifiable credentials with check expiry ": { + "Revocable Verifiable credentials with check expiry " : { "description": "Revocable Verifiable credentials with check expiry ", - "value": { + "value" : { "credentialStatus": "active", "valid": true, "validateExpiryDate": true, - "vc": { - "credentialSubject": [ + "vc" : { + "credentialSubject" : [ { "holderIdentifier": "BPNL000000000001", - "allowedVehicleBrands": [ + "allowedVehicleBrands" : [ "Audi", "Abarth", "Alfa Romeo", @@ -1792,25 +1796,25 @@ ], "issuanceDate": "2024-01-05T05:42:53Z", "id": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000#8507aa50-b2a4-4532-8e45-f50e7654b23b", - "proof": { + "proof" : { "proofPurpose": "assertionMethod", "verificationMethod": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000#a39d8ccf-2a66-488d-bfec-916768082e91", "type": "JsonWebSignature2020", "created": "2024-01-05T05:42:53Z", "jws": "eyJhbGciOiJFZERTQSJ9..15NdxA8L_Iw7Igxevm7YGMAQA-Kt6PMOpix6p0jaYHCtfQnTy3q61SDvsnsltGT6fzM90JOubOuig2WFy-GPDg" }, - "type": [ + "type" : [ "VerifiableCredential", "DismantlerCredential" ], - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://cofinity-x.github.io/schema-registry/v1.1/DismantlerVC.json", "https://w3id.org/security/suites/jws-2020/v1", "https://w3id.org/vc/status-list/2021/v1" ], "issuer": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000", - "credentialStatus": { + "credentialStatus" : { "id": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000#0", "statusPurpose": "revocation", "statusListIndex": "0", @@ -1821,32 +1825,32 @@ } } }, - "Verifiable Credentials with invalid signature": { + "Verifiable Credentials with invalid signature" : { "description": "Verifiable Credentials with invalid signature", - "value": { + "value" : { "valid": false, - "vc": { - "@context": [ + "vc" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhf", "proofPurpose": "proofPurpose", @@ -1860,26 +1864,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -1889,32 +1893,32 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/credentials/issuer": { - "get": { - "tags": [ + "/api/credentials/issuer" : { + "get" : { + "tags" : [ "Verifiable Credential - Issuer" ], "summary": "Query Verifiable Credentials", "description": "Permission: **view_wallets** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", "operationId": "getCredentials_1", - "parameters": [ + "parameters" : [ { "name": "credentialId", "in": "query", "description": "Credential Id", "required": false, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "Credential Id": { + "examples" : { + "Credential Id" : { "description": "Credential Id", "value": "did:web:localhost:BPNL000000000000#12528899-160a-48bd-ba15-f396c3959ae9" } @@ -1925,15 +1929,15 @@ "in": "query", "description": "Holder identifier(did of BPN)", "required": false, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "bpn": { + "examples" : { + "bpn" : { "description": "bpn", "value": "BPNL000000000001" }, - "did": { + "did" : { "description": "did", "value": "did:web:localhost:BPNL000000000001" } @@ -1944,19 +1948,19 @@ "in": "query", "description": "Type of VC", "required": false, - "schema": { + "schema" : { "type": "array", "maxItems": 100, - "items": { + "items" : { "type": "string" } }, - "examples": { - "SummaryCredential": { + "examples" : { + "SummaryCredential" : { "description": "SummaryCredential", "value": "SummaryCredential" }, - "BpnCredential": { + "BpnCredential" : { "description": "BpnCredential", "value": "BpnCredential" } @@ -1967,7 +1971,7 @@ "in": "query", "description": "Page number, Page number start with zero", "required": false, - "schema": { + "schema" : { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1980,7 +1984,7 @@ "in": "query", "description": "Number of records per page", "required": false, - "schema": { + "schema" : { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1993,24 +1997,24 @@ "in": "query", "description": "Sort column name", "required": false, - "schema": { + "schema" : { "type": "string", "default": "createdAt" }, - "examples": { - "creation date": { + "examples" : { + "creation date" : { "description": "creation date", "value": "createdAt" }, - "Holder did": { + "Holder did" : { "description": "Holder did", "value": "holderDid" }, - "Credential type": { + "Credential type" : { "description": "Credential type", "value": "type" }, - "Credential id": { + "Credential id" : { "description": "Credential id", "value": "credentialId" } @@ -2021,16 +2025,16 @@ "in": "query", "description": "Sort order", "required": false, - "schema": { + "schema" : { "type": "string", "default": "desc" }, - "examples": { - "Ascending order": { + "examples" : { + "Ascending order" : { "description": "Ascending order", "value": "asc" }, - "Descending order": { + "Descending order" : { "description": "Descending order", "value": "desc" } @@ -2041,54 +2045,54 @@ "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false }, - "examples": { - "Create VC as JWT": { + "examples" : { + "Create VC as JWT" : { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT": { + "Do not create VC as JWT" : { "description": "Do not create VC as JWT", "value": false } } } ], - "responses": { - "200": { + "responses" : { + "200" : { "description": "Issuer credential list", - "content": { - "application/json": { - "examples": { - "Issuer credential list": { + "content" : { + "application/json" : { + "examples" : { + "Issuer credential list" : { "description": "Issuer credential list", - "value": { - "content": [ + "value" : { + "content" : [ { - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#ae364f71-f054-4d91-b579-f001bcb3e59e", - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:27:42Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:27:44Z", "jws": "eyJhbGciOiJFZERTQSJ9..evDHQfW4EzJUt2HnS_WlmO8FFtywTGnwyywtCE7WP41my4Iscpqr4tbuVOqnZg85b4U8L3_ut8_pEONIhbExCQ", "proofPurpose": "proofPurpose", @@ -2097,11 +2101,11 @@ } }, { - "type": [ + "type" : [ "VerifiableCredential", "SummaryCredential" ], - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -2109,18 +2113,18 @@ "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:39Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "contractTemplate": "https://public.catena-x.org/contracts/", "holderIdentifier": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "items": [ + "items" : [ "BpnCredential" ], "type": "SummaryCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:41Z", "jws": "eyJhbGciOiJFZERTQSJ9..YvoFhDip3TQAfZUIu0yc843oA4uGTg049dMFt_GoaMmPjiNB_B1EFOL-gDpwjIxTYNlGOO_CLp9qStbzlDTNBg", "proofPurpose": "proofPurpose", @@ -2129,27 +2133,27 @@ } }, { - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:34Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -2158,8 +2162,8 @@ } } ], - "pageable": { - "sort": { + "pageable" : { + "sort" : { "empty": false, "unsorted": false, "sorted": true @@ -2176,7 +2180,7 @@ "first": true, "size": 2147483647, "number": 0, - "sort": { + "sort" : { "empty": false, "unsorted": false, "sorted": true @@ -2189,22 +2193,22 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": {} + "errors" : {} } } } @@ -2212,26 +2216,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -2241,30 +2245,30 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] }, - "post": { - "tags": [ + "post" : { + "tags" : [ "Verifiable Credential - Issuer" ], "summary": "Issue Verifiable Credential", "description": "Permission: **update_wallets** (The BPN of the base wallet must equal BPN of caller)\nIssue a verifiable credential with a given issuer DID", "operationId": "issueCredentialUsingBaseWallet", - "parameters": [ + "parameters" : [ { "name": "holderDid", "in": "query", "description": "Holder DID", "required": true, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "did": { + "examples" : { + "did" : { "description": "did", "value": "did:web:localhost:BPNL000000000000" } @@ -2275,46 +2279,46 @@ "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false }, - "examples": { - "Create VC as JWT": { + "examples" : { + "Create VC as JWT" : { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT": { + "Do not create VC as JWT" : { "description": "Do not create VC as JWT", "value": false } } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { "type": "object", - "additionalProperties": { + "additionalProperties" : { "type": "object" } }, - "example": { - "@context": [ + "example" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:34Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -2326,36 +2330,36 @@ }, "required": true }, - "responses": { - "201": { + "responses" : { + "201" : { "description": "Issuer credential", - "content": { - "application/json": { - "examples": { - "Issuer credential": { + "content" : { + "application/json" : { + "examples" : { + "Issuer credential" : { "description": "Issuer credential", - "value": { - "@context": [ + "value" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#ff084e7a-1b46-4a2f-a78d-3d701a0bd6e4", - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T12:18:30Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#", @@ -2368,193 +2372,23 @@ } } }, - "400": { - "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { - "description": "Response in case of invalid data provided", - "value": { - "type": "about:blank", - "title": "Invalid data provided", - "status": 400, - "detail": "details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689760833962, - "errors": { - "filed": "filed error message" - } - } - } - } - } - } - } - }, - "401": { - "description": "The request could not be completed due to a failed authorization." - }, - "403": { - "description": "The request could not be completed due to a forbidden access" - }, - "404": { - "description": "Wallet not found with provided identifier", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided identifier": { - "description": "Wallet not found with provided identifier", - "value": { - "type": "about:blank", - "title": "Error Title", - "status": 404, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - } - } - } - } - }, - "500": { - "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { - "description": "Internal server error", - "value": { - "type": "about:blank", - "title": "Error Title", - "status": 500, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - } - } - } - } - } - }, - "security": [ - { - "Authenticate using access_token": [] - } - ] - } - }, - "/api/credentials/issuer/membership": { - "post": { - "tags": [ - "Verifiable Credential - Issuer" - ], - "summary": "Issue a Membership Verifiable Credential with base wallet issuer", - "description": "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet", - "operationId": "issueMembershipCredential", - "parameters": [ + "400" : { - "name": "asJwt", - "in": "query", - "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", - "required": false, - "schema": { - "type": "boolean", - "default": false - }, - "examples": { - "Create VC as JWT": { - "description": "Create VC as JWT", - "value": true - }, - "Do not create VC as JWT": { - "description": "Do not create VC as JWT", - "value": false - } - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IssueMembershipCredentialRequest" - }, - "example": { - "bpn": "BPNL000000000000" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Issuer credential", - "content": { - "application/json": { - "examples": { - "Membership credential": { - "description": "Membership credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#0d6b6447-99de-4bc5-94f3-3ac0ae8ee188", - "type": [ - "VerifiableCredential", - "MembershipCredential" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:13:53Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "startTime": "2023-07-19T13:13:53.581081Z", - "memberOf": "Catena-X", - "id": "did:web:localhost:BPNL000000000000", - "type": "MembershipCredential", - "status": "Active" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "type": "JsonWebSignature2020", - "created": "2023-07-19T13:13:57Z", - "jws": "eyJhbGciOiJFZERTQSJ9..zt7SyONY1shO7N6KrabQJr9uNrToM1Bc4eagTQc1LxAfZ1v-SSp9Y-2cpZNDV8AR08r4L8VbtWrR9t2dNoAfDw" - } - } - } - } - } - } - }, - "400": { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": { + "errors" : { "filed": "filed error message" } } @@ -2564,26 +2398,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "404": { + "404" : { "description": "Wallet not found with provided identifier", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided identifier": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with provided identifier" : { "description": "Wallet not found with provided identifier", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 404, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -2592,42 +2426,20 @@ } } }, - "409": { - "description": "The request could not be completed due to a conflict.", - "content": { - "application/json": { - "examples": { - "MembershipCredential already exist": { - "description": "MembershipCredential already exist", - "value": { - "type": "about:blank", - "title": "Credential of type MembershipCredential is already exists ", - "status": 409, - "detail": "Credential of type MembershipCredential is already exists ", - "instance": "/api/credentials/issuer/membership", - "properties": { - "timestamp": 1689772483831 - } - } - } - } - } - } - }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -2637,654 +2449,57 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/credentials/issuer/framework": { - "post": { - "tags": [ - "Verifiable Credential - Issuer" - ], - "summary": "Issue a Use Case Verifiable Credential with base wallet issuer", - "description": "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet", - "operationId": "issueFrameworkCredential", - "parameters": [ - { - "name": "asJwt", - "in": "query", - "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", - "required": false, - "schema": { - "type": "boolean", - "default": false - }, - "examples": { - "Create VC as JWT": { - "description": "Create VC as JWT", - "value": true - }, - "Do not create VC as JWT": { - "description": "Do not create VC as JWT", - "value": false - } - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IssueFrameworkCredentialRequest" - }, - "examples": { - "BehaviorTwinCredential": { - "description": "BehaviorTwinCredential", - "value": { - "holderIdentifier": "BPNL000000000000", - "type": "BehaviorTwinCredential", - "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contract-version": "1.0.0" - } - }, - "PcfCredential": { - "description": "PcfCredential", - "value": { - "holderIdentifier": "BPNL000000000000", - "type": "PcfCredential", - "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contract-version": "1.0.0" - } - }, - "SustainabilityCredential": { - "description": "SustainabilityCredential", - "value": { - "holderIdentifier": "BPNL000000000000", - "type": "SustainabilityCredential", - "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contract-version": "1.0.0" - } - }, - "QualityCredential": { - "description": "QualityCredential", - "value": { - "holderIdentifier": "BPNL000000000000", - "type": "QualityCredential", - "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contract-version": "1.0.0" - } - }, - "TraceabilityCredential": { - "description": "TraceabilityCredential", - "value": { - "holderIdentifier": "BPNL000000000000", - "type": "TraceabilityCredential", - "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contract-version": "1.0.0" - } - }, - "ResiliencyCredential": { - "description": "ResiliencyCredential", - "value": { - "holderIdentifier": "BPNL000000000000", - "type": "ResiliencyCredential", - "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contract-version": "1.0.0" - } - } - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Framework credential", - "content": { - "application/json": { - "examples": { - "BehaviorTwin credential": { - "description": "BehaviorTwin credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "BehaviorTwinCredential", - "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - }, - "Pcf Credential": { - "description": "Pcf Credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "PcfCredential", - "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - }, - "Sustainability Credential": { - "description": "Sustainability Credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "SustainabilityCredential", - "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - }, - "Quality Credential": { - "description": "Quality Credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "QualityCredential", - "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - }, - "Traceability Credential": { - "description": "Traceability Credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "TraceabilityCredential", - "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - }, - "Resiliency Credential": { - "description": "Resiliency Credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", - "type": [ - "VerifiableCredential", - "UseCaseFrameworkCondition" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:49:58Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "ResiliencyCredential", - "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contractVersion": "1.0.0" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "created": "2023-07-19T13:50:02Z", - "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - } - } - } - } - } - } - }, - "400": { - "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { - "description": "Response in case of invalid data provided", - "value": { - "type": "about:blank", - "title": "Invalid data provided", - "status": 400, - "detail": "details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689760833962, - "errors": { - "filed": "filed error message" - } - } - } - } - } - } - } - }, - "401": { - "description": "The request could not be completed due to a failed authorization." - }, - "403": { - "description": "The request could not be completed due to a forbidden access" - }, - "404": { - "description": "Wallet not found with provided identifier", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided identifier": { - "description": "Wallet not found with provided identifier", - "value": { - "type": "about:blank", - "title": "Error Title", - "status": 404, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - } - } - } - } - }, - "500": { - "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { - "description": "Internal server error", - "value": { - "type": "about:blank", - "title": "Error Title", - "status": 500, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - } - } - } - } - } - }, - "security": [ - { - "Authenticate using access_token": [] - } - ] - } - }, - "/api/credentials/issuer/dismantler": { - "post": { - "tags": [ - "Verifiable Credential - Issuer" - ], - "summary": "Issue a Dismantler Verifiable Credential with base wallet issuer", - "description": "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet", - "operationId": "issueDismantlerCredential", - "parameters": [ - { - "name": "asJwt", - "in": "query", - "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", - "required": false, - "schema": { - "type": "boolean", - "default": false - }, - "examples": { - "Create VC as JWT": { - "description": "Create VC as JWT", - "value": true - }, - "Do not create VC as JWT": { - "description": "Do not create VC as JWT", - "value": false - } - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IssueDismantlerCredentialRequest" - }, - "example": { - "bpn": "BPNL000000000000", - "activityType": "vehicleDismantle", - "allowedVehicleBrands": [ - "Audi", - "Abarth", - "Alfa Romeo", - "Chrysler" - ] - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Dismantler Credential", - "content": { - "application/json": { - "examples": { - "Dismantler Credential": { - "description": "Dismantler Credential", - "value": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:web:localhost:BPNL000000000000#5caac86c-8ef8-4aab-9d2b-fb18c62560a9", - "type": [ - "VerifiableCredential", - "DismantlerCredential" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2023-07-19T13:35:33Z", - "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject": [ - { - "holderIdentifier": "BPNL000000000000", - "allowedVehicleBrands": [ - "Audi", - "Abarth", - "Alfa Romeo", - "Chrysler" - ], - "id": "did:web:localhost:BPNL000000000000", - "activityType": "vehicleDismantle", - "type": "DismantlerCredential" - } - ], - "proof": { - "proofPurpose": "proofPurpose", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "type": "JsonWebSignature2020", - "created": "2023-07-19T13:35:38Z", - "jws": "eyJhbGciOiJFZERTQSJ9..UI82uq6iyqoaKjZIhJiV24v_Bqnj_7EqWiqZ3VWjqkoHLnr7JDtW5KVywWPl27j_baLBxxnM5jqjQdSK4rfbBg" - } - } - } - } - } - } - }, - "400": { - "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { - "description": "Response in case of invalid data provided", - "value": { - "type": "about:blank", - "title": "Invalid data provided", - "status": 400, - "detail": "details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689760833962, - "errors": { - "filed": "filed error message" - } - } - } - } - } - } - } - }, - "401": { - "description": "The request could not be completed due to a failed authorization." - }, - "403": { - "description": "The request could not be completed due to a forbidden access" - }, - "404": { - "description": "Wallet not found with provided identifier", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided identifier": { - "description": "Wallet not found with provided identifier", - "value": { - "type": "about:blank", - "title": "Error Title", - "status": 404, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - } - } - } - } - }, - "409": { - "description": "The request could not be completed due to a conflict.", - "content": { - "application/json": { - "examples": { - "DismantlerCredential already exist": { - "description": "DismantlerCredential already exist", - "value": { - "type": "about:blank", - "title": "Credential of type DismantlerCredential is already exists ", - "status": 409, - "detail": "Credential of type DismantlerCredential is already exists ", - "instance": "/api/credentials/issuer/dismantler", - "properties": { - "timestamp": 1689773804746 - } - } - } - } - } - } - }, - "500": { - "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { - "description": "Internal server error", - "value": { - "type": "about:blank", - "title": "Error Title", - "status": 500, - "detail": "Error Details", - "instance": "API endpoint", - "properties": { - "timestamp": 1689762476720 - } - } - } - } - } - } - } - }, - "security": [ - { - "Authenticate using access_token": [] - } - ] - } - }, - "/{bpn}/did.json": { - "get": { - "tags": [ + "/{bpn}/did.json" : { + "get" : { + "tags" : [ "DIDDocument" ], "summary": "Resolve DID Document", "description": "Resolve the DID document for a given BPN", "operationId": "getDidResolve", - "parameters": [ + "parameters" : [ { "name": "bpn", "in": "path", "description": "BPN", "required": true, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "bpn": { + "examples" : { + "bpn" : { "description": "bpn", "value": "BPNL000000000000" } } } ], - "responses": { - "200": { + "responses" : { + "200" : { "description": "DID document", - "content": { - "application/json": { - "examples": { - " DID document": { + "content" : { + "application/json" : { + "examples" : { + " DID document" : { "description": " DID document", - "value": { - "@context": [ + "value" : { + "@context" : [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000000", - "verificationMethod": [ + "verificationMethod" : [ { "controller": "did:web:localhost:BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "publicKeyJwk": { + "publicKeyJwk" : { "crv": "Ed25519", "kty": "OKP", "x": "wAOQvr92L1m7RwrpeOrgWByVYvWmhRr4fJbiMwHEIdY" @@ -3298,20 +2513,20 @@ } } }, - "404": { + "404" : { "description": "Wallet not found with provided bpn", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided bpn": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with provided bpn" : { "description": "Wallet not found with provided bpn", - "value": { + "value" : { "type": "about:blank", "title": "Wallet not found for identifier BPNL00000000000", "status": 404, "detail": "Wallet not found for identifier BPNL00000000000", "instance": "/BPNL00000000000/did.json", - "properties": { + "properties" : { "timestamp": 1689767698010 } } @@ -3320,20 +2535,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -3343,36 +2558,36 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/wallets/{identifier}": { - "get": { - "tags": [ + "/api/wallets/{identifier}" : { + "get" : { + "tags" : [ "Wallets" ], "summary": "Retrieve wallet by BPN", "description": "Permission: **view_wallets** OR **view_wallet** (The BPN of Wallet to retrieve must equal the BPN of caller or Base wallet, authority wallet can see all wallets) \n\n Retrieve single wallet by identifier, with or without its credentials", "operationId": "getWalletByIdentifier", - "parameters": [ + "parameters" : [ { "name": "identifier", "in": "path", "description": "Did or BPN", "required": true, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "bpn": { + "examples" : { + "bpn" : { "description": "bpn", "value": "BPNL000000000000" }, - "did": { + "did" : { "description": "did", "value": "did:web:localhost:BPNL000000000000" } @@ -3382,36 +2597,36 @@ "name": "withCredentials", "in": "query", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false } } ], - "responses": { - "200": { + "responses" : { + "200" : { "description": "Wallet Details", - "content": { - "application/json": { - "examples": { - "Wallet details without with credentials false": { + "content" : { + "application/json" : { + "examples" : { + "Wallet details without with credentials false" : { "description": "Wallet details without with credentials false", - "value": { + "value" : { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000001", "algorithm": "ED25519", - "didDocument": { - "@context": [ + "didDocument" : { + "@context" : [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod": [ + "verificationMethod" : [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#", - "publicKeyJwk": { + "publicKeyJwk" : { "crv": "Ed25519", "kty": "OKP", "x": "mhph0ZSVk7cDVmazbaaC3jBDpphW4eNygAK9gHPlMow" @@ -3422,24 +2637,24 @@ } } }, - "Wallet details without with credentials true": { + "Wallet details without with credentials true" : { "description": "Wallet details without with credentials true", - "value": { + "value" : { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000001", "algorithm": "ED25519", - "didDocument": { - "@context": [ + "didDocument" : { + "@context" : [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod": [ + "verificationMethod" : [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#", - "publicKeyJwk": { + "publicKeyJwk" : { "crv": "Ed25519", "kty": "OKP", "x": "mhph0ZSVk7cDVmazbaaC3jBDpphW4eNygAK9gHPlMow" @@ -3448,29 +2663,29 @@ } ] }, - "verifiableCredentials": [ + "verifiableCredentials" : [ { - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#a1f8ae36-9919-4ed8-8546-535280acc5bf", - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:14:45Z", "expirationDate": "2023-09-30T18:30:00Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000001", "id": "did:web:localhost:BPNL000000000001", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:14:47Z", "jws": "eyJhbGciOiJFZERTQSJ9..O69dLGMDVgZQJ7chFx3aUbkJFvibH8WWunw634rIDC77_pdiUHvQpQ0hq15_7OgFMy3dp-9H-pNgxTZ-i4UXCw", "proofPurpose": "proofPurpose", @@ -3485,22 +2700,22 @@ } } }, - "400": { + "400" : { "description": "The input does not comply to the syntax requirements", - "content": { - "application/json": { - "examples": { - "Response in case of invalid data provided": { + "content" : { + "application/json" : { + "examples" : { + "Response in case of invalid data provided" : { "description": "Response in case of invalid data provided", - "value": { + "value" : { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689760833962, - "errors": {} + "errors" : {} } } } @@ -3508,26 +2723,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden access" }, - "404": { + "404" : { "description": "Wallet not found with provided identifier", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided identifier": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with provided identifier" : { "description": "Wallet not found with provided identifier", - "value": { + "value" : { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000501", - "properties": { + "properties" : { "timestamp": 1689764377224 } } @@ -3536,20 +2751,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -3559,72 +2774,72 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } }, - "/api/presentations/iatp": { - "get": { - "tags": [ + "/api/presentations/iatp" : { + "get" : { + "tags" : [ "Verifiable Presentations - Generation" ], "summary": "Create Verifiable Presentation", "description": "Create a verifiable presentation for the verifiable credential types listed in STS token", "operationId": "createPresentation_1", - "parameters": [ + "parameters" : [ { "name": "asJwt", "in": "query", "required": false, - "schema": { + "schema" : { "type": "boolean", "default": false } } ], - "responses": { - "200": { + "responses" : { + "200" : { "description": "Verifiable Presentation", - "content": { - "application/json": { - "examples": { - "VP as Json-LD": { + "content" : { + "application/json" : { + "examples" : { + "VP as Json-LD" : { "description": "VP as Json-LD", - "value": { - "vp": { - "@context": [ + "value" : { + "vp" : { + "@context" : [ "https://www.w3.org/2018/credentials/v1" ], "id": "did:web:localhost:BPNL000000000000#b2e69e47-95f3-48ff-af30-eaaab36431d5", - "type": [ + "type" : [ "VerifiablePresentation" ], - "verifiableCredential": [ + "verifiableCredential" : [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context": [ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type": [ + "type" : [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject": [ + "credentialSubject" : [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof": { + "proof" : { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -3636,9 +2851,9 @@ } } }, - "VP as JWT": { + "VP as JWT" : { "description": "VP as JWT", - "value": { + "value" : { "vp": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwiYXVkIjoic21hcnQiLCJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidnAiOnsiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIzM4ZTU2ZTg1LTNkODQtNGEyNS1iZjg1LWFiMjRlYzY4MmMwOSIsInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vY2F0ZW5heC1uZy5naXRodWIuaW8vcHJvZHVjdC1jb3JlLXNjaGVtYXMvYnVzaW5lc3NQYXJ0bmVyRGF0YS5qc29uIiwiaHR0cHM6Ly93M2lkLm9yZy9zZWN1cml0eS9zdWl0ZXMvandzLTIwMjAvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkJwbkNyZWRlbnRpYWwiXSwiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwI2Y3M2UzNjMxLWJhODctNGEwMy1iZWEzLWIyODcwMDA1Njg3OSIsImlzc3VlciI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTA3LTE5VDA5OjExOjM0WiIsImV4cGlyYXRpb25EYXRlIjoiMjAyNC0xMi0zMVQxODozMDowMFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJicG4iOiJCUE5MMDAwMDAwMDAwMDAwIiwidHlwZSI6IkJwbkNyZWRlbnRpYWwifSwicHJvb2YiOnsicHJvb2ZQdXJwb3NlIjoicHJvb2ZQdXJwb3NlIiwidHlwZSI6Ikpzb25XZWJTaWduYXR1cmUyMDIwIiwidmVyaWZpY2F0aW9uTWV0aG9kIjoiZGlkOndlYjpsb2NhbGhvc3Q6QlBOTDAwMDAwMDAwMDAwMCMiLCJjcmVhdGVkIjoiMjAyMy0wNy0xOVQwOToxMTozOVoiLCJqd3MiOiJleUpoYkdjaU9pSkZaRVJUUVNKOS4uZmRuMnFVODVhdU9sdGRIRExkSEk3c0pWVjFaUGRmdHBpWGRfbmRYTjBkRmdTRFdpSXJTY2REMDN3dHZLTHFfSC1zaFFXZmgyUlllTW1ybEV6QWhmRHcifX19LCJleHAiOjE2ODk4MzQ4MDUsImp0aSI6ImIwODYzOWZiLWQ5MWEtNGUwZS1iNmY4LTYzYjdhMzQ1ZTRhZiJ9.80x0AB-OauefdeZfx1cwhitdVKRvCRFeFzYwU73DL7y4w34vu6BdfHWLBGjkwELxkQEoFfiTPOqtuyqhtsyDBg" } } @@ -3646,26 +2861,26 @@ } } }, - "401": { + "401" : { "description": "The request could not be completed due to a failed authorization." }, - "403": { + "403" : { "description": "The request could not be completed due to a forbidden scope value" }, - "404": { + "404" : { "description": "One or more of the requested verifiable credential types were not found", - "content": { - "application/json": { - "examples": { - "One or more of the requested verifiable credential types were not found": { + "content" : { + "application/json" : { + "examples" : { + "One or more of the requested verifiable credential types were not found" : { "description": "One or more of the requested verifiable credential types were not found", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 404, "detail": "Verifiable credential types that were not found", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -3674,20 +2889,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -3697,61 +2912,61 @@ } } }, - "security": [ + "security" : [ { - "sts_token": [] + "sts_token" : [] } ] } }, - "/api/didDocuments/{identifier}": { - "get": { - "tags": [ + "/api/didDocuments/{identifier}" : { + "get" : { + "tags" : [ "DIDDocument" ], "summary": "Resolve DID Document", "description": "Resolve the DID document for a given DID or BPN", "operationId": "getDidDocument", - "parameters": [ + "parameters" : [ { "name": "identifier", "in": "path", "description": "Did or BPN", "required": true, - "schema": { + "schema" : { "type": "string" }, - "examples": { - "bpn": { + "examples" : { + "bpn" : { "description": "bpn", "value": "BPNL000000000000" }, - "did": { + "did" : { "description": "did", "value": "did:web:localhost:BPNL000000000000" } } } ], - "responses": { - "200": { + "responses" : { + "200" : { "description": "DID document", - "content": { - "application/json": { - "examples": { - " DID document": { + "content" : { + "application/json" : { + "examples" : { + " DID document" : { "description": " DID document", - "value": { - "@context": [ + "value" : { + "@context" : [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000000", - "verificationMethod": [ + "verificationMethod" : [ { "controller": "did:web:localhost:BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "publicKeyJwk": { + "publicKeyJwk" : { "crv": "Ed25519", "kty": "OKP", "x": "wAOQvr92L1m7RwrpeOrgWByVYvWmhRr4fJbiMwHEIdY" @@ -3765,20 +2980,20 @@ } } }, - "404": { + "404" : { "description": "Wallet not found with provided bpn", - "content": { - "application/json": { - "examples": { - "Wallet not found with provided bpn": { + "content" : { + "application/json" : { + "examples" : { + "Wallet not found with provided bpn" : { "description": "Wallet not found with provided bpn", - "value": { + "value" : { "type": "about:blank", "title": "Wallet not found for identifier BPNL00000000000", "status": 404, "detail": "Wallet not found for identifier BPNL00000000000", "instance": "/BPNL00000000000/did.json", - "properties": { + "properties" : { "timestamp": 1689767698010 } } @@ -3787,20 +3002,20 @@ } } }, - "500": { + "500" : { "description": "Any other internal server error", - "content": { - "application/json": { - "examples": { - "Internal server error": { + "content" : { + "application/json" : { + "examples" : { + "Internal server error" : { "description": "Internal server error", - "value": { + "value" : { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties": { + "properties" : { "timestamp": 1689762476720 } } @@ -3810,160 +3025,97 @@ } } }, - "security": [ + "security" : [ { - "Authenticate using access_token": [] + "Authenticate using access_token" : [] } ] } } }, - "components": { - "schemas": { - "CreateWalletRequest": { - "required": [ + "components" : { + "schemas" : { + "CreateWalletRequest" : { + "required" : [ "businessPartnerNumber", "companyName", "didUrl" ], "type": "object", - "properties": { - "businessPartnerNumber": { + "properties" : { + "businessPartnerNumber" : { "pattern": "^(BPN)(L|S|A)[0-9A-Z]{12}", "type": "string" }, - "companyName": { + "companyName" : { "maxLength": 255, "minLength": 1, "type": "string" }, - "didUrl": { + "didUrl" : { "maxLength": 2000, "minLength": 1, "type": "string" } } }, - "SecureTokenRequest": { + "SecureTokenRequest" : { "type": "object", - "properties": { - "audience": { + "properties" : { + "audience" : { "type": "string" }, - "client_id": { + "client_id" : { "type": "string" }, - "client_secret": { + "client_secret" : { "type": "string" }, - "grant_type": { + "grant_type" : { "type": "string" }, - "access_token": { + "access_token" : { "type": "string" }, - "bearer_access_alias": { + "bearer_access_alias" : { "type": "string" }, - "bearer_access_scope": { + "bearer_access_scope" : { "type": "string" } } }, - "CredentialVerificationRequest": { + "CredentialVerificationRequest" : { "type": "object", - "properties": { - "jwt": { + "properties" : { + "jwt" : { "type": "string", "writeOnly": true }, - "vc": { + "vc" : { "type": "object", - "additionalProperties": { + "additionalProperties" : { "type": "object" }, "writeOnly": true }, - "empty": { + "empty" : { "type": "boolean" } }, - "additionalProperties": { + "additionalProperties" : { "type": "object" } - }, - "IssueMembershipCredentialRequest": { - "required": [ - "bpn" - ], - "type": "object", - "properties": { - "bpn": { - "pattern": "^(BPN)(L|S|A)[0-9A-Z]{12}", - "type": "string" - } - } - }, - "IssueFrameworkCredentialRequest": { - "required": [ - "contract-template", - "contract-version", - "holderIdentifier", - "type" - ], - "type": "object", - "properties": { - "holderIdentifier": { - "maxLength": 255, - "minLength": 5, - "type": "string" - }, - "type": { - "type": "string" - }, - "contract-template": { - "type": "string" - }, - "contract-version": { - "type": "string" - } - } - }, - "IssueDismantlerCredentialRequest": { - "required": [ - "activityType", - "bpn" - ], - "type": "object", - "properties": { - "bpn": { - "pattern": "^(BPN)(L|S|A)[0-9A-Z]{12}", - "type": "string" - }, - "activityType": { - "maxLength": 2147483647, - "minLength": 1, - "type": "string" - }, - "allowedVehicleBrands": { - "uniqueItems": true, - "maxItems": 100, - "type": "array", - "items": { - "type": "string" - } - } - } } }, - "securitySchemes": { - "Authenticate using access_token": { + "securitySchemes" : { + "Authenticate using access_token" : { "type": "apiKey", "description": "**Bearer (apiKey)**\nJWT Authorization header using the Bearer scheme.\nEnter **Bearer** [space] and then your token in the text input below:\nExample: Bearer 12345abcdef\n", "name": "Authorization", "in": "header" }, - "sts_token": { + "sts_token" : { "type": "apiKey", "description": "**STS token**\nJWT Authorization header.\nEnter your token in the text input below:\nExample: 12345abcdef\n", "name": "Authorization", From b10fa38eeae221b48adc6ebdace8ffdf4781bb09 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Thu, 13 Jun 2024 12:39:14 +0530 Subject: [PATCH 09/10] fix: formatting issue with api json file --- docs/api/openapi_v001.json | 1657 ++++++++++++++++++------------------ 1 file changed, 826 insertions(+), 831 deletions(-) diff --git a/docs/api/openapi_v001.json b/docs/api/openapi_v001.json index 9d93d17b7..d29890256 100644 --- a/docs/api/openapi_v001.json +++ b/docs/api/openapi_v001.json @@ -1,45 +1,41 @@ { "openapi": "3.0.1", - "info" : { + "info": { "title": "Managed Identity Wallets API", "description": "Managed Identity Wallets API", "termsOfService": "https://www.eclipse.org/legal/termsofuse.php", - "contact" : { + "contact": { "name": "Eclipse Tractus-X", "url": "https://projects.eclipse.org/projects/automotive.tractusx", "email": "tractusx-dev@eclipse.org" }, - "license" : { + "license": { "name": "Apache 2.0", "url": "https://github.com/eclipse-tractusx/managed-identity-wallets/blob/develop/LICENSE" }, "version": "0.0.1" }, - "security" : [ - { - "Authenticate using access_token" : [] - }, - { - "sts_token" : [] - } + "security": [ + {"Authenticate using access_token": []}, + {"sts_token": []} ], - "servers" : [], - "paths" : { - "/api/wallets" : { - "get" : { - "tags" : [ + "servers": [], + "paths": { + "/api/wallets": { + "get": { + "tags": [ "Wallets" ], "summary": "List of wallets", "description": "Permission: **view_wallets** \n\n Retrieve list of registered wallets", "operationId": "getWallets", - "parameters" : [ + "parameters": [ { "name": "pageNumber", "in": "query", "description": "Page number, Page number start with zero", "required": false, - "schema" : { + "schema": { "type": "integer", "format": "int32", "default": 0 @@ -50,7 +46,7 @@ "in": "query", "description": "Number of records per page", "required": false, - "schema" : { + "schema": { "type": "integer", "format": "int32", "default": 2147483647 @@ -61,24 +57,24 @@ "in": "query", "description": "Sort column name", "required": false, - "schema" : { + "schema": { "type": "string", "default": "createdAt" }, - "examples" : { - "Creation date" : { + "examples": { + "Creation date": { "description": "Creation date", "value": "createdAt" }, - "Wallet BPN" : { + "Wallet BPN": { "description": "Wallet BPN", "value": "bpn" }, - "Wallet did" : { + "Wallet did": { "description": "Wallet did", "value": "did" }, - "Wallet name" : { + "Wallet name": { "description": "Wallet name", "value": "name" } @@ -89,48 +85,48 @@ "in": "query", "description": "Sort order", "required": false, - "schema" : { + "schema": { "type": "string", "default": "desc" }, - "examples" : { - "Ascending order" : { + "examples": { + "Ascending order": { "description": "Ascending order", "value": "asc" }, - "Descending order" : { + "Descending order": { "description": "Descending order", "value": "desc" } } } ], - "responses" : { - "200" : { + "responses": { + "200": { "description": "Wallet list", - "content" : { - "application/json" : { - "examples" : { - "Wallet list" : { + "content": { + "application/json": { + "examples": { + "Wallet list": { "description": "Wallet list", - "value" : { - "content" : [ + "value": { + "content": [ { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000001", "algorithm": "ED25519", - "didDocument" : { - "@context" : [ + "didDocument": { + "@context": [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod" : [ + "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#", - "publicKeyJwk" : { + "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", "x": "mhph0ZSVk7cDVmazbaaC3jBDpphW4eNygAK9gHPlMow" @@ -141,8 +137,8 @@ } } ], - "pageable" : { - "sort" : { + "pageable": { + "sort": { "empty": false, "sorted": true, "unsorted": false @@ -158,7 +154,7 @@ "last": false, "size": 1, "number": 0, - "sort" : { + "sort": { "empty": false, "sorted": true, "unsorted": false @@ -172,22 +168,22 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : {} + "errors": {} } } } @@ -195,26 +191,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -224,29 +220,29 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] }, - "post" : { - "tags" : [ + "post": { + "tags": [ "Wallets" ], "summary": "Create Wallet", "description": "Permission: **add_wallets** (The BPN of the base wallet must equal BPN of caller)\n\n Create a wallet and store it", "operationId": "createWallet", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CreateWalletRequest" }, - "examples" : { - "Create wallet with BPN" : { + "examples": { + "Create wallet with BPN": { "description": "Create wallet with BPN", - "value" : { + "value": { "businessPartnerNumber": "BPNL000000000001", "companyName": "companyA", "didUrl": "portal.com:BPNL000000000001" @@ -257,30 +253,30 @@ }, "required": true }, - "responses" : { - "201" : { + "responses": { + "201": { "description": "Created", - "content" : { - "application/json" : { - "examples" : { - "Success response" : { + "content": { + "application/json": { + "examples": { + "Success response": { "description": "Success response", - "value" : { + "value": { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000501", "algorithm": "ED25519", - "didDocument" : { - "@context" : [ + "didDocument": { + "@context": [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod" : [ + "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#key-1", - "publicKeyJwk" : { + "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", "x": "0Ap6FsX5UuRBIoOzxWtcFA2ymnqXw0U08Ino_mIuYM4" @@ -290,7 +286,7 @@ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#key-2", - "publicKeyJwk" : { + "publicKeyJwk": { "crv": "secp256k1", "kty": "EC", "x": "f9PkTOpsbcgKe_-s6bNCve3-aB1VZAFsCub8C5bhDn0", @@ -306,22 +302,22 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : { + "errors": { "filed": "filed error message" } } @@ -331,26 +327,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "409" : { + "409": { "description": "The request could not be completed due to a conflict.", - "content" : { - "application/json" : { - "examples" : { - "Wallet already exist" : { + "content": { + "application/json": { + "examples": { + "Wallet already exist": { "description": "Wallet already exist", - "value" : { + "value": { "type": "about:blank", "title": "Wallet is already exists for bpn BPNL000000000001", "status": 409, "detail": "Wallet is already exists for bpn BPNL000000000001", "instance": "/api/wallets", - "properties" : { + "properties": { "timestamp": 1689762639948 } } @@ -359,20 +355,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -382,79 +378,79 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/wallets/{identifier}/credentials" : { - "post" : { - "tags" : [ + "/api/wallets/{identifier}/credentials": { + "post": { + "tags": [ "Wallets" ], "summary": "Store Verifiable Credential", "description": "Permission: **update_wallets** OR **update_wallet** (The BPN of wallet to extract credentials from must equal BPN of caller) \n\n Store a verifiable credential in the wallet of the given identifier", "operationId": "storeCredential", - "parameters" : [ + "parameters": [ { "name": "identifier", "in": "path", "description": "Did or BPN", "required": true, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "bpn" : { + "examples": { + "bpn": { "description": "bpn", "value": "BPNL000000000000" }, - "did" : { + "did": { "description": "did", "value": "did:web:localhost:BPNL000000000000" } } } ], - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "object", - "additionalProperties" : { + "additionalProperties": { "type": "object" } }, - "example" : { - "@context" : [ + "example": { + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#" ], "id": "did:web:localhost.in#123456789", - "type" : [ + "type": [ "VerifiableCredential", "LegalParticipant" ], "issuer": "did:web:localhost.in", "issuanceDate": "2023-05-04T07:36:03.633Z", - "credentialSubject" : { + "credentialSubject": { "id": "https://localhost/.well-known/participant.json", "type": "gx:LegalParticipant", "gx:legalName": "Sample Company", - "gx:legalRegistrationNumber" : { + "gx:legalRegistrationNumber": { "gx:taxID": "113123123" }, - "gx:headquarterAddress" : { + "gx:headquarterAddress": { "gx:countrySubdivisionCode": "BE-BRU" }, - "gx:legalAddress" : { + "gx:legalAddress": { "gx:countrySubdivisionCode": "BE-BRU" }, "gx-terms-and-conditions:gaiaxTermsAndConditions": "70c1d713215f95191a11d38fe2341faed27d19e083917bc8732ca4fea4976700" }, - "proof" : { + "proof": { "type": "JsonWebSignature2020", "created": "2023-05-04T07:36:04.079Z", "proofPurpose": "assertionMethod", @@ -466,15 +462,15 @@ }, "required": true }, - "responses" : { - "201" : { + "responses": { + "201": { "description": "Success Response", - "content" : { - "application/json" : { - "examples" : { - "Success Response" : { + "content": { + "application/json": { + "examples": { + "Success Response": { "description": "Success Response", - "value" : { + "value": { "message": "Credential with id did:web:localhost#123456789 has been successfully stored" } } @@ -482,22 +478,22 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : {} + "errors": {} } } } @@ -505,26 +501,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "404" : { + "404": { "description": "Wallet not found with provided identifier", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with provided identifier" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with provided identifier": { "description": "Wallet not found with provided identifier", - "value" : { + "value": { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL000000044001", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL000000044001", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000/credentials", - "properties" : { + "properties": { "timestamp": 1689765541959 } } @@ -533,20 +529,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -556,31 +552,31 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/token" : { - "post" : { - "tags" : [ + "/api/token": { + "post": { + "tags": [ "STS" ], "summary": "Create and Sign Access Tokens", "description": "The endpoint for creating and signing access tokens which are to be used during a verifiable presentation flow.", "operationId": "token_1", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/SecureTokenRequest" }, - "examples" : { - "Request Secure Token using Scopes" : { + "examples": { + "Request Secure Token using Scopes": { "description": "Request Secure Token using Scopes", - "value" : { + "value": { "audience": "BPNL000000000009", "client_id": "your_client_id", "client_secret": "your_client_secret", @@ -588,9 +584,9 @@ "bearer_access_scope": "org.eclipse.tractusx.vc.type:ValidCredentialType:read" } }, - "Request Secure Token using Access Token" : { + "Request Secure Token using Access Token": { "description": "Request Secure Token using Access Token", - "value" : { + "value": { "audience": "BPNL000000000009", "client_id": "your_client_id", "client_secret": "your_client_secret", @@ -603,15 +599,15 @@ }, "required": true }, - "responses" : { - "201" : { + "responses": { + "201": { "description": "Created", - "content" : { - "application/json" : { - "examples" : { - "Success response" : { + "content": { + "application/json": { + "examples": { + "Success response": { "description": "Success response", - "value" : { + "value": { "token": "a_jwt_token", "expiresAt": 1706888709315 } @@ -620,35 +616,35 @@ } } }, - "400" : { + "400": { "description": "Bad Request", - "content" : { - "application/json" : { - "examples" : { - "Unknown BPN" : { + "content": { + "application/json": { + "examples": { + "Unknown BPN": { "description": "Unknown BPN", - "value" : { + "value": { "error": "UnknownBusinessPartnerNumber", "errorDescription": "The provided BPN 'BPNL000000000001' is unknown" } }, - "Wrong Grant Type" : { + "Wrong Grant Type": { "description": "Wrong Grant Type", - "value" : { + "value": { "error": "UnsupportedGrantTypeException", "errorDescription": "The provided 'grant_type' is not valid. Use 'client_credentials'." } }, - "Invalid idp Token Response" : { + "Invalid idp Token Response": { "description": "Invalid idp Token Response", - "value" : { + "value": { "error": "InvalidIdpTokenResponse", "errorDescription": "The idp response cannot be null. Possible causes for this are: the 'clientId' is invalid, or the 'client' is not enabled." } }, - "Invalid Secure Token Request" : { + "Invalid Secure Token Request": { "description": "Invalid Secure Token Request", - "value" : { + "value": { "error": "InvalidSecureTokenRequest", "errorDescription": "The provided data could not be used to create and sign a token." } @@ -657,20 +653,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -682,20 +678,20 @@ } } }, - "/api/presentations" : { - "post" : { - "tags" : [ + "/api/presentations": { + "post": { + "tags": [ "Verifiable Presentations - Generation" ], "summary": "Create Verifiable Presentation", "description": "Permission: **update_wallets** OR **update_wallet** (The BPN of the issuer of the Verifiable Presentation must equal to BPN of caller) \n\n Create a verifiable presentation from a list of verifiable credentials, signed by the holder", "operationId": "createPresentation", - "parameters" : [ + "parameters": [ { "name": "audience", "in": "query", "required": false, - "schema" : { + "schema": { "type": "string" } }, @@ -703,45 +699,45 @@ "name": "asJwt", "in": "query", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false } } ], - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "object", - "additionalProperties" : { + "additionalProperties": { "type": "object" } }, - "example" : { - "verifiableCredentials" : [ + "example": { + "verifiableCredentials": [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -755,46 +751,46 @@ }, "required": true }, - "responses" : { - "200" : { + "responses": { + "200": { "description": "Verifiable Presentation", - "content" : { - "application/json" : { - "examples" : { - "VP as Json-LD" : { + "content": { + "application/json": { + "examples": { + "VP as Json-LD": { "description": "VP as Json-LD", - "value" : { - "vp" : { - "@context" : [ + "value": { + "vp": { + "@context": [ "https://www.w3.org/2018/credentials/v1" ], "id": "did:web:localhost:BPNL000000000000#b2e69e47-95f3-48ff-af30-eaaab36431d5", - "type" : [ + "type": [ "VerifiablePresentation" ], - "verifiableCredential" : [ + "verifiableCredential": [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -806,9 +802,9 @@ } } }, - "VP as JWT" : { + "VP as JWT": { "description": "VP as JWT", - "value" : { + "value": { "vp": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwiYXVkIjoic21hcnQiLCJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidnAiOnsiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIzM4ZTU2ZTg1LTNkODQtNGEyNS1iZjg1LWFiMjRlYzY4MmMwOSIsInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vY2F0ZW5heC1uZy5naXRodWIuaW8vcHJvZHVjdC1jb3JlLXNjaGVtYXMvYnVzaW5lc3NQYXJ0bmVyRGF0YS5qc29uIiwiaHR0cHM6Ly93M2lkLm9yZy9zZWN1cml0eS9zdWl0ZXMvandzLTIwMjAvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkJwbkNyZWRlbnRpYWwiXSwiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwI2Y3M2UzNjMxLWJhODctNGEwMy1iZWEzLWIyODcwMDA1Njg3OSIsImlzc3VlciI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTA3LTE5VDA5OjExOjM0WiIsImV4cGlyYXRpb25EYXRlIjoiMjAyNC0xMi0zMVQxODozMDowMFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJicG4iOiJCUE5MMDAwMDAwMDAwMDAwIiwidHlwZSI6IkJwbkNyZWRlbnRpYWwifSwicHJvb2YiOnsicHJvb2ZQdXJwb3NlIjoicHJvb2ZQdXJwb3NlIiwidHlwZSI6Ikpzb25XZWJTaWduYXR1cmUyMDIwIiwidmVyaWZpY2F0aW9uTWV0aG9kIjoiZGlkOndlYjpsb2NhbGhvc3Q6QlBOTDAwMDAwMDAwMDAwMCMiLCJjcmVhdGVkIjoiMjAyMy0wNy0xOVQwOToxMTozOVoiLCJqd3MiOiJleUpoYkdjaU9pSkZaRVJUUVNKOS4uZmRuMnFVODVhdU9sdGRIRExkSEk3c0pWVjFaUGRmdHBpWGRfbmRYTjBkRmdTRFdpSXJTY2REMDN3dHZLTHFfSC1zaFFXZmgyUlllTW1ybEV6QWhmRHcifX19LCJleHAiOjE2ODk4MzQ4MDUsImp0aSI6ImIwODYzOWZiLWQ5MWEtNGUwZS1iNmY4LTYzYjdhMzQ1ZTRhZiJ9.80x0AB-OauefdeZfx1cwhitdVKRvCRFeFzYwU73DL7y4w34vu6BdfHWLBGjkwELxkQEoFfiTPOqtuyqhtsyDBg" } } @@ -816,26 +812,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "404" : { + "404": { "description": "Wallet not found with provided identifier", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with provided identifier" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with provided identifier": { "description": "Wallet not found with provided identifier", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 404, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -844,20 +840,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -867,28 +863,28 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/presentations/validation" : { - "post" : { - "tags" : [ + "/api/presentations/validation": { + "post": { + "tags": [ "Verifiable Presentations - Validation" ], "summary": "Validate Verifiable Presentation", "description": "Permission: **view_wallets** OR **view_wallet** \n\n Validate Verifiable Presentation with all included credentials", "operationId": "validatePresentation", - "parameters" : [ + "parameters": [ { "name": "audience", "in": "query", "description": "Audience to validate in VP (Only supported in case of JWT formatted VP)", "required": false, - "schema" : { + "schema": { "type": "string" } }, @@ -897,7 +893,7 @@ "in": "query", "description": "Pass true in case of VP is in JWT format", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false } @@ -907,62 +903,62 @@ "in": "query", "description": "Check expiry of VC(Only supported in case of JWT formatted VP)", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false } } ], - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "object", - "additionalProperties" : { + "additionalProperties": { "type": "object" } }, - "examples" : { - "VP as JWT" : { + "examples": { + "VP as JWT": { "description": "VP as JWT", - "value" : { + "value": { "vp": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwiYXVkIjoic21hcnQiLCJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidnAiOnsiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIzZmZWRmYWRmLWYxNTItNGNjZS05MWQ1LWNjMjhhNzhlMTExMyIsInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vY2F0ZW5heC1uZy5naXRodWIuaW8vcHJvZHVjdC1jb3JlLXNjaGVtYXMvYnVzaW5lc3NQYXJ0bmVyRGF0YS5qc29uIiwiaHR0cHM6Ly93M2lkLm9yZy9zZWN1cml0eS9zdWl0ZXMvandzLTIwMjAvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkJwbkNyZWRlbnRpYWwiXSwiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwI2Y3M2UzNjMxLWJhODctNGEwMy1iZWEzLWIyODcwMDA1Njg3OSIsImlzc3VlciI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTA3LTE5VDA5OjExOjM0WiIsImV4cGlyYXRpb25EYXRlIjoiMjAyNC0xMi0zMVQxODozMDowMFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJicG4iOiJCUE5MMDAwMDAwMDAwMDAwIiwidHlwZSI6IkJwbkNyZWRlbnRpYWwifSwicHJvb2YiOnsicHJvb2ZQdXJwb3NlIjoicHJvb2ZQdXJwb3NlIiwidHlwZSI6Ikpzb25XZWJTaWduYXR1cmUyMDIwIiwidmVyaWZpY2F0aW9uTWV0aG9kIjoiZGlkOndlYjpsb2NhbGhvc3Q6QlBOTDAwMDAwMDAwMDAwMCMiLCJjcmVhdGVkIjoiMjAyMy0wNy0xOVQwOToxMTozOVoiLCJqd3MiOiJleUpoYkdjaU9pSkZaRVJUUVNKOS4uZmRuMnFVODVhdU9sdGRIRExkSEk3c0pWVjFaUGRmdHBpWGRfbmRYTjBkRmdTRFdpSXJTY2REMDN3dHZLTHFfSC1zaFFXZmgyUlllTW1ybEV6QWhmRHcifX19LCJleHAiOjE2ODk3NTg1NDQsImp0aSI6IjdlNWE4MzQ4LTgwZjUtNGIzMS1iMDNlLTBiOTJmNzc4ZTVjZiJ9.c7FS-CLwm3vxfO9847M5sqcVxv3QbwwSmSsFWcGif7MOesjt1pdnARlQ4pvHzgsFj1UqBEvHwZQvyYyPCQg_Cw" } }, - "VP as json-ld" : { + "VP as json-ld": { "description": "VP as json-ld", - "value" : { - "vp" : { + "value": { + "vp": { "id": "b9d97cef-758d-4a7c-843d-86f17632b08a", - "type" : [ + "type": [ "VerifiablePresentation" ], - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1" ], - "verifiableCredential" : [ + "verifiableCredential": [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -979,15 +975,15 @@ }, "required": true }, - "responses" : { - "200" : { + "responses": { + "200": { "description": "Verifiable presentation validate", - "content" : { - "application/json" : { - "examples" : { - "VP as JWT" : { + "content": { + "application/json": { + "examples": { + "VP as JWT": { "description": "VP as JWT", - "value" : { + "value": { "valid": true, "validateJWTExpiryDate": true, "validateAudience": true, @@ -999,35 +995,35 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Validation of VP in form of JSON-LD is not supported" : { + "content": { + "application/json": { + "examples": { + "Validation of VP in form of JSON-LD is not supported": { "description": "Validation of VP in form of JSON-LD is not supported", - "value" : { + "value": { "type": "about:blank", "title": "Validation of VP in form of JSON-LD is not supported", "status": 400, "detail": "Validation of VP in form of JSON-LD is not supported", "instance": "/api/presentations/validation", - "properties" : { + "properties": { "timestamp": 1689835085703 } } }, - "Response in case of invalid data provided" : { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : { + "errors": { "filed": "filed error message" } } @@ -1037,26 +1033,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -1066,32 +1062,32 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/credentials" : { - "get" : { - "tags" : [ + "/api/credentials": { + "get": { + "tags": [ "Verifiable Credential - Holder" ], "summary": "Query Verifiable Credentials", "description": "Permission: **view_wallets** OR **view_wallet** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", "operationId": "getCredentials", - "parameters" : [ + "parameters": [ { "name": "credentialId", "in": "query", "description": "Credential Id", "required": false, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "Credential Id" : { + "examples": { + "Credential Id": { "description": "Credential Id", "value": "did:web:localhost:BPNL000000000000#12528899-160a-48bd-ba15-f396c3959ae9" } @@ -1102,15 +1098,15 @@ "in": "query", "description": "Issuer identifier(did of BPN)", "required": false, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "bpn" : { + "examples": { + "bpn": { "description": "bpn", "value": "BPNL000000000000" }, - "did" : { + "did": { "description": "did", "value": "did:web:localhost:BPNL000000000000" } @@ -1121,19 +1117,19 @@ "in": "query", "description": "Type of VC", "required": false, - "schema" : { + "schema": { "type": "array", "maxItems": 100, - "items" : { + "items": { "type": "string" } }, - "examples" : { - "SummaryCredential" : { + "examples": { + "SummaryCredential": { "description": "SummaryCredential", "value": "SummaryCredential" }, - "BpnCredential" : { + "BpnCredential": { "description": "BpnCredential", "value": "BpnCredential" } @@ -1144,32 +1140,32 @@ "in": "query", "description": "Sort column name", "required": false, - "schema" : { + "schema": { "type": "string", "default": "createdAt" }, - "examples" : { - "creation date" : { + "examples": { + "creation date": { "description": "creation date", "value": "createdAt" }, - "Self issued credential" : { + "Self issued credential": { "description": "Self issued credential", "value": "selfIssued" }, - "Stored credential" : { + "Stored credential": { "description": "Stored credential", "value": "stored" }, - "Issuer did" : { + "Issuer did": { "description": "Issuer did", "value": "issuerDid" }, - "Credential type" : { + "Credential type": { "description": "Credential type", "value": "type" }, - "Credential id" : { + "Credential id": { "description": "Credential id", "value": "credentialId" } @@ -1180,16 +1176,16 @@ "in": "query", "description": "Sort order", "required": false, - "schema" : { + "schema": { "type": "string", "default": "desc" }, - "examples" : { - "Ascending order" : { + "examples": { + "Ascending order": { "description": "Ascending order", "value": "asc" }, - "Descending order" : { + "Descending order": { "description": "Descending order", "value": "desc" } @@ -1200,7 +1196,7 @@ "in": "query", "description": "Page number, Page number start with zero", "required": false, - "schema" : { + "schema": { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1213,7 +1209,7 @@ "in": "query", "description": "Number of records per page", "required": false, - "schema" : { + "schema": { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1226,58 +1222,58 @@ "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false }, - "examples" : { - "Create VC as JWT" : { + "examples": { + "Create VC as JWT": { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT" : { + "Do not create VC as JWT": { "description": "Do not create VC as JWT", "value": false } } } ], - "responses" : { - "200" : { + "responses": { + "200": { "description": "Credential list", - "content" : { - "application/json" : { - "examples" : { - "Credential list" : { + "content": { + "application/json": { + "examples": { + "Credential list": { "description": "Credential list", - "value" : { - "content" : [ + "value": { + "content": [ { - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#954d43de-ebed-481d-9e35-e3bbb311b8f5", - "type" : [ + "type": [ "VerifiableCredential", "SummaryCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-14T11:05:48Z", "expirationDate": "2023-09-30T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "contractTemplate": "https://public.catena-x.org/contracts/", "holderIdentifier": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "items" : [ + "items": [ "BpnCredential" ], "type": "SummaryCredential" } ], - "proof" : { + "proof": { "created": "2023-07-14T11:05:50Z", "jws": "eyJhbGciOiJFZERTQSJ9..4xwFUCtP0xXVEo5_lXd90Vv-TWO2FijZut-HZ5cozAQseexj8EpTkK1erhFbf2Ua1kb8pi_H5At5HiPkTxSIAQ", "proofPurpose": "proofPurpose", @@ -1286,8 +1282,8 @@ } } ], - "pageable" : { - "sort" : { + "pageable": { + "sort": { "empty": false, "sorted": true, "unsorted": false @@ -1303,7 +1299,7 @@ "last": true, "size": 2147483647, "number": 0, - "sort" : { + "sort": { "empty": false, "sorted": true, "unsorted": false @@ -1317,22 +1313,22 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : {} + "errors": {} } } } @@ -1340,26 +1336,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "404" : { + "404": { "description": "Wallet not found with caller BPN", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with caller BPN" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with caller BPN": { "description": "Wallet not found with caller BPN", - "value" : { + "value": { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL0000000", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000/credentials", - "properties" : { + "properties": { "timestamp": 1689765541959 } } @@ -1368,20 +1364,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -1391,65 +1387,65 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] }, - "post" : { - "tags" : [ + "post": { + "tags": [ "Verifiable Credential - Holder" ], "summary": "Issue Verifiable Credential", "description": "Permission: **update_wallets** OR **update_wallet** (The BPN of the issuer of the Verifiable Credential must equal BPN of caller)\nIssue a verifiable credential with a given issuer DID", "operationId": "issueCredential", - "parameters" : [ + "parameters": [ { "name": "asJwt", "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false }, - "examples" : { - "Create VC as JWT" : { + "examples": { + "Create VC as JWT": { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT" : { + "Do not create VC as JWT": { "description": "Do not create VC as JWT", "value": false } } } ], - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "object", - "additionalProperties" : { + "additionalProperties": { "type": "object" } }, - "example" : { - "@context" : [ + "example": { + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type" : [ + "type": [ "VerifiableCredential", "BankDetails" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1463,29 +1459,29 @@ }, "required": true }, - "responses" : { - "201" : { + "responses": { + "201": { "description": "Success Response", - "content" : { - "application/json" : { - "examples" : { - "Success Response" : { + "content": { + "application/json": { + "examples": { + "Success Response": { "description": "Success Response", - "value" : { - "@context" : [ + "value": { + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#319a2641-9407-4c39-bf51-a4a109b59604", - "type" : [ + "type": [ "VerifiableCredential", "BankDetails" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T13:41:52Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "bankName": "Dummy Bank", @@ -1494,7 +1490,7 @@ "accountNumber": "123456789" } ], - "proof" : { + "proof": { "proofPurpose": "proofPurpose", "verificationMethod": "did:web:localhost:BPNL000000000000#", "type": "JsonWebSignature2020", @@ -1507,22 +1503,22 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : { + "errors": { "filed": "filed error message" } } @@ -1532,26 +1528,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "404" : { + "404": { "description": "Wallet not found with caller BPN", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with caller BPN" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with caller BPN": { "description": "Wallet not found with caller BPN", - "value" : { + "value": { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000501", - "properties" : { + "properties": { "timestamp": 1689764377224 } } @@ -1560,20 +1556,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -1583,64 +1579,64 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/credentials/validation" : { - "post" : { - "tags" : [ + "/api/credentials/validation": { + "post": { + "tags": [ "Verifiable Credential - Validation" ], "summary": "Validate Verifiable Credentials", "description": "Permission: **view_wallets** OR **view_wallet** \n\n Validate Verifiable Credentials", "operationId": "credentialsValidation", - "parameters" : [ + "parameters": [ { "name": "withCredentialExpiryDate", "in": "query", "description": "Check expiry of VC", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false } } ], - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CredentialVerificationRequest" }, - "examples" : { - "Validate credential in JSON-LD format" : { + "examples": { + "Validate credential in JSON-LD format": { "description": "Validate credential in JSON-LD format", - "value" : { - "@context" : [ + "value": { + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:34Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -1649,9 +1645,9 @@ } } }, - "Validate credential in JWT format" : { + "Validate credential in JWT format": { "description": "Validate credential in JWT format", - "value" : { + "value": { "jwt": "eyJraWQiOiJkaWQ6d2ViOmFmODgtMjAzLTEyOS0yMTMtMTA3Lm5ncm9rLWZyZWUuYXBwOkJQTkwwMDAwMDAwMDAwMDAjOGYyZWU5ZDItYTM2Yy00MTM4LWJlMWYtYjZmZWZiNmY4MDI0IiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJpc3MiOiJkaWQ6d2ViOmFmODgtMjAzLTEyOS0yMTMtMTA3Lm5ncm9rLWZyZWUuYXBwOkJQTkwwMDAwMDAwMDAwMDAiLCJzdWIiOiJkaWQ6d2ViOmFmODgtMjAzLTEyOS0yMTMtMTA3Lm5ncm9rLWZyZWUuYXBwOkJQTkwwMDAwMDAwMDAwMTEiLCJleHAiOjE3MzU2Njk4MDAsInZjIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIiwiaHR0cHM6Ly9jb2Zpbml0eS14LmdpdGh1Yi5pby9zY2hlbWEtcmVnaXN0cnkvdjEuMS9Vc2VDYXNlVkMuanNvbiIsImh0dHBzOi8vdzNpZC5vcmcvc2VjdXJpdHkvc3VpdGVzL2p3cy0yMDIwL3YxIl0sImlkIjoiZGlkOndlYjphZjg4LTIwMy0xMjktMjEzLTEwNy5uZ3Jvay1mcmVlLmFwcDpCUE5MMDAwMDAwMDAwMDAwI2Q4Y2ZjZDBiLWY0NGQtNDVkMC05OGEzLTA4ZDZkNmU5Y2E5NSIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJVc2VDYXNlRnJhbWV3b3JrQ29uZGl0aW9uIl0sImlzc3VlciI6ImRpZDp3ZWI6YWY4OC0yMDMtMTI5LTIxMy0xMDcubmdyb2stZnJlZS5hcHA6QlBOTDAwMDAwMDAwMDAwMCIsImNyZWRlbnRpYWxTdWJqZWN0IjpbeyJob2xkZXJJZGVudGlmaWVyIjoiQlBOTDAwMDAwMDAwMDAxMSIsImlkIjoiZGlkOndlYjphZjg4LTIwMy0xMjktMjEzLTEwNy5uZ3Jvay1mcmVlLmFwcDpCUE5MMDAwMDAwMDAwMDExIiwidHlwZSI6IkJlaGF2aW9yVHdpbkNyZWRlbnRpYWwiLCJjb250cmFjdFRlbXBsYXRlIjoiaHR0cHM6Ly9wdWJsaWMuY2F0ZW5hLXgub3JnL2NvbnRyYWN0cy90cmFjZWFiaWx0eS52MS5wZGYiLCJjb250cmFjdFZlcnNpb24iOiIxLjAuMCJ9XSwiY3JlZGVudGlhbFN0YXR1cyI6bnVsbCwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wMi0wOFQxNDowMjo1M1oiLCJleHBpcmF0aW9uRGF0ZSI6IjIwMjQtMTItMzFUMTg6MzA6MDBaIn0sImp0aSI6IjliYWFhMjIzLTAxMjctNDEyZS05NjZhLTA3ZTJmZGU4NGNlNCJ9.X3rkj8Gv4OD5nEaeFG5pSA-dogbcYA91YEPmHiKT4FhAiIr7QAdSEULGXHYOn8-eK0jSDHNdAxNYIK1UwYRsCA" } } @@ -1660,19 +1656,19 @@ }, "required": true }, - "responses" : { - "200" : { + "responses": { + "200": { "description": "Validate Verifiable Credentials", - "content" : { - "application/json" : { - "examples" : { - "Verifiable Credentials without check expiry" : { + "content": { + "application/json": { + "examples": { + "Verifiable Credentials without check expiry": { "description": "Verifiable Credentials without check expiry", - "value" : { + "value": { "valid": true, - "vc" : { + "vc": { "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1680,18 +1676,18 @@ } ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" }, - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -1701,14 +1697,14 @@ } } }, - "Verifiable Credentials with check expiry" : { + "Verifiable Credentials with check expiry": { "description": "Verifiable Credentials with check expiry", - "value" : { + "value": { "valid": true, "validateExpiryDate": true, - "vc" : { + "vc": { "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1716,18 +1712,18 @@ } ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" }, - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -1737,14 +1733,14 @@ } } }, - "Verifiable expired credentials with check expiry " : { + "Verifiable expired credentials with check expiry ": { "description": "Verifiable expired credentials with check expiry ", - "value" : { + "value": { "valid": false, "validateExpiryDate": false, - "vc" : { + "vc": { "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -1752,18 +1748,18 @@ } ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" }, - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -1773,17 +1769,17 @@ } } }, - "Revocable Verifiable credentials with check expiry " : { + "Revocable Verifiable credentials with check expiry ": { "description": "Revocable Verifiable credentials with check expiry ", - "value" : { + "value": { "credentialStatus": "active", "valid": true, "validateExpiryDate": true, - "vc" : { - "credentialSubject" : [ + "vc": { + "credentialSubject": [ { "holderIdentifier": "BPNL000000000001", - "allowedVehicleBrands" : [ + "allowedVehicleBrands": [ "Audi", "Abarth", "Alfa Romeo", @@ -1796,25 +1792,25 @@ ], "issuanceDate": "2024-01-05T05:42:53Z", "id": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000#8507aa50-b2a4-4532-8e45-f50e7654b23b", - "proof" : { + "proof": { "proofPurpose": "assertionMethod", "verificationMethod": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000#a39d8ccf-2a66-488d-bfec-916768082e91", "type": "JsonWebSignature2020", "created": "2024-01-05T05:42:53Z", "jws": "eyJhbGciOiJFZERTQSJ9..15NdxA8L_Iw7Igxevm7YGMAQA-Kt6PMOpix6p0jaYHCtfQnTy3q61SDvsnsltGT6fzM90JOubOuig2WFy-GPDg" }, - "type" : [ + "type": [ "VerifiableCredential", "DismantlerCredential" ], - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://cofinity-x.github.io/schema-registry/v1.1/DismantlerVC.json", "https://w3id.org/security/suites/jws-2020/v1", "https://w3id.org/vc/status-list/2021/v1" ], "issuer": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000", - "credentialStatus" : { + "credentialStatus": { "id": "did:web:6e3e-203-129-213-107.ngrok-free.app:BPNL000000000000#0", "statusPurpose": "revocation", "statusListIndex": "0", @@ -1825,32 +1821,32 @@ } } }, - "Verifiable Credentials with invalid signature" : { + "Verifiable Credentials with invalid signature": { "description": "Verifiable Credentials with invalid signature", - "value" : { + "value": { "valid": false, - "vc" : { - "@context" : [ + "vc": { + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhf", "proofPurpose": "proofPurpose", @@ -1864,26 +1860,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -1893,32 +1889,32 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/credentials/issuer" : { - "get" : { - "tags" : [ + "/api/credentials/issuer": { + "get": { + "tags": [ "Verifiable Credential - Issuer" ], "summary": "Query Verifiable Credentials", "description": "Permission: **view_wallets** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", "operationId": "getCredentials_1", - "parameters" : [ + "parameters": [ { "name": "credentialId", "in": "query", "description": "Credential Id", "required": false, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "Credential Id" : { + "examples": { + "Credential Id": { "description": "Credential Id", "value": "did:web:localhost:BPNL000000000000#12528899-160a-48bd-ba15-f396c3959ae9" } @@ -1929,15 +1925,15 @@ "in": "query", "description": "Holder identifier(did of BPN)", "required": false, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "bpn" : { + "examples": { + "bpn": { "description": "bpn", "value": "BPNL000000000001" }, - "did" : { + "did": { "description": "did", "value": "did:web:localhost:BPNL000000000001" } @@ -1948,19 +1944,19 @@ "in": "query", "description": "Type of VC", "required": false, - "schema" : { + "schema": { "type": "array", "maxItems": 100, - "items" : { + "items": { "type": "string" } }, - "examples" : { - "SummaryCredential" : { + "examples": { + "SummaryCredential": { "description": "SummaryCredential", "value": "SummaryCredential" }, - "BpnCredential" : { + "BpnCredential": { "description": "BpnCredential", "value": "BpnCredential" } @@ -1971,7 +1967,7 @@ "in": "query", "description": "Page number, Page number start with zero", "required": false, - "schema" : { + "schema": { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1984,7 +1980,7 @@ "in": "query", "description": "Number of records per page", "required": false, - "schema" : { + "schema": { "maximum": 2147483647, "minimum": 0, "type": "integer", @@ -1997,24 +1993,24 @@ "in": "query", "description": "Sort column name", "required": false, - "schema" : { + "schema": { "type": "string", "default": "createdAt" }, - "examples" : { - "creation date" : { + "examples": { + "creation date": { "description": "creation date", "value": "createdAt" }, - "Holder did" : { + "Holder did": { "description": "Holder did", "value": "holderDid" }, - "Credential type" : { + "Credential type": { "description": "Credential type", "value": "type" }, - "Credential id" : { + "Credential id": { "description": "Credential id", "value": "credentialId" } @@ -2025,16 +2021,16 @@ "in": "query", "description": "Sort order", "required": false, - "schema" : { + "schema": { "type": "string", "default": "desc" }, - "examples" : { - "Ascending order" : { + "examples": { + "Ascending order": { "description": "Ascending order", "value": "asc" }, - "Descending order" : { + "Descending order": { "description": "Descending order", "value": "desc" } @@ -2045,54 +2041,54 @@ "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false }, - "examples" : { - "Create VC as JWT" : { + "examples": { + "Create VC as JWT": { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT" : { + "Do not create VC as JWT": { "description": "Do not create VC as JWT", "value": false } } } ], - "responses" : { - "200" : { + "responses": { + "200": { "description": "Issuer credential list", - "content" : { - "application/json" : { - "examples" : { - "Issuer credential list" : { + "content": { + "application/json": { + "examples": { + "Issuer credential list": { "description": "Issuer credential list", - "value" : { - "content" : [ + "value": { + "content": [ { - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#ae364f71-f054-4d91-b579-f001bcb3e59e", - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:27:42Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:27:44Z", "jws": "eyJhbGciOiJFZERTQSJ9..evDHQfW4EzJUt2HnS_WlmO8FFtywTGnwyywtCE7WP41my4Iscpqr4tbuVOqnZg85b4U8L3_ut8_pEONIhbExCQ", "proofPurpose": "proofPurpose", @@ -2101,11 +2097,11 @@ } }, { - "type" : [ + "type": [ "VerifiableCredential", "SummaryCredential" ], - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", "https://w3id.org/security/suites/jws-2020/v1" @@ -2113,18 +2109,18 @@ "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:39Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "contractTemplate": "https://public.catena-x.org/contracts/", "holderIdentifier": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "items" : [ + "items": [ "BpnCredential" ], "type": "SummaryCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:41Z", "jws": "eyJhbGciOiJFZERTQSJ9..YvoFhDip3TQAfZUIu0yc843oA4uGTg049dMFt_GoaMmPjiNB_B1EFOL-gDpwjIxTYNlGOO_CLp9qStbzlDTNBg", "proofPurpose": "proofPurpose", @@ -2133,27 +2129,27 @@ } }, { - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:34Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -2162,8 +2158,8 @@ } } ], - "pageable" : { - "sort" : { + "pageable": { + "sort": { "empty": false, "unsorted": false, "sorted": true @@ -2180,7 +2176,7 @@ "first": true, "size": 2147483647, "number": 0, - "sort" : { + "sort": { "empty": false, "unsorted": false, "sorted": true @@ -2193,22 +2189,22 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : {} + "errors": {} } } } @@ -2216,26 +2212,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -2245,30 +2241,30 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] }, - "post" : { - "tags" : [ + "post": { + "tags": [ "Verifiable Credential - Issuer" ], "summary": "Issue Verifiable Credential", "description": "Permission: **update_wallets** (The BPN of the base wallet must equal BPN of caller)\nIssue a verifiable credential with a given issuer DID", "operationId": "issueCredentialUsingBaseWallet", - "parameters" : [ + "parameters": [ { "name": "holderDid", "in": "query", "description": "Holder DID", "required": true, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "did" : { + "examples": { + "did": { "description": "did", "value": "did:web:localhost:BPNL000000000000" } @@ -2279,46 +2275,46 @@ "in": "query", "description": "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). If set to true, the VC will be generated in JWT formatSetting this parameter to false will result in the VC being created as JSON-LD Defaults to false if not specified.", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false }, - "examples" : { - "Create VC as JWT" : { + "examples": { + "Create VC as JWT": { "description": "Create VC as JWT", "value": true }, - "Do not create VC as JWT" : { + "Do not create VC as JWT": { "description": "Do not create VC as JWT", "value": false } } } ], - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { + "requestBody": { + "content": { + "application/json": { + "schema": { "type": "object", - "additionalProperties" : { + "additionalProperties": { "type": "object" } }, - "example" : { - "@context" : [ + "example": { + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:11:34Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", @@ -2330,36 +2326,36 @@ }, "required": true }, - "responses" : { - "201" : { + "responses": { + "201": { "description": "Issuer credential", - "content" : { - "application/json" : { - "examples" : { - "Issuer credential" : { + "content": { + "application/json": { + "examples": { + "Issuer credential": { "description": "Issuer credential", - "value" : { - "@context" : [ + "value": { + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#ff084e7a-1b46-4a2f-a78d-3d701a0bd6e4", - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T12:18:30Z", "expirationDate": "2024-12-31T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#", @@ -2372,23 +2368,22 @@ } } }, - "400" : - { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "Invalid data provided", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : { + "errors": { "filed": "filed error message" } } @@ -2398,26 +2393,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "404" : { + "404": { "description": "Wallet not found with provided identifier", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with provided identifier" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with provided identifier": { "description": "Wallet not found with provided identifier", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 404, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -2426,20 +2421,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -2449,57 +2444,57 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/{bpn}/did.json" : { - "get" : { - "tags" : [ + "/{bpn}/did.json": { + "get": { + "tags": [ "DIDDocument" ], "summary": "Resolve DID Document", "description": "Resolve the DID document for a given BPN", "operationId": "getDidResolve", - "parameters" : [ + "parameters": [ { "name": "bpn", "in": "path", "description": "BPN", "required": true, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "bpn" : { + "examples": { + "bpn": { "description": "bpn", "value": "BPNL000000000000" } } } ], - "responses" : { - "200" : { + "responses": { + "200": { "description": "DID document", - "content" : { - "application/json" : { - "examples" : { - " DID document" : { + "content": { + "application/json": { + "examples": { + " DID document": { "description": " DID document", - "value" : { - "@context" : [ + "value": { + "@context": [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000000", - "verificationMethod" : [ + "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "publicKeyJwk" : { + "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", "x": "wAOQvr92L1m7RwrpeOrgWByVYvWmhRr4fJbiMwHEIdY" @@ -2513,20 +2508,20 @@ } } }, - "404" : { + "404": { "description": "Wallet not found with provided bpn", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with provided bpn" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with provided bpn": { "description": "Wallet not found with provided bpn", - "value" : { + "value": { "type": "about:blank", "title": "Wallet not found for identifier BPNL00000000000", "status": 404, "detail": "Wallet not found for identifier BPNL00000000000", "instance": "/BPNL00000000000/did.json", - "properties" : { + "properties": { "timestamp": 1689767698010 } } @@ -2535,20 +2530,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -2558,36 +2553,36 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/wallets/{identifier}" : { - "get" : { - "tags" : [ + "/api/wallets/{identifier}": { + "get": { + "tags": [ "Wallets" ], "summary": "Retrieve wallet by BPN", "description": "Permission: **view_wallets** OR **view_wallet** (The BPN of Wallet to retrieve must equal the BPN of caller or Base wallet, authority wallet can see all wallets) \n\n Retrieve single wallet by identifier, with or without its credentials", "operationId": "getWalletByIdentifier", - "parameters" : [ + "parameters": [ { "name": "identifier", "in": "path", "description": "Did or BPN", "required": true, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "bpn" : { + "examples": { + "bpn": { "description": "bpn", "value": "BPNL000000000000" }, - "did" : { + "did": { "description": "did", "value": "did:web:localhost:BPNL000000000000" } @@ -2597,36 +2592,36 @@ "name": "withCredentials", "in": "query", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false } } ], - "responses" : { - "200" : { + "responses": { + "200": { "description": "Wallet Details", - "content" : { - "application/json" : { - "examples" : { - "Wallet details without with credentials false" : { + "content": { + "application/json": { + "examples": { + "Wallet details without with credentials false": { "description": "Wallet details without with credentials false", - "value" : { + "value": { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000001", "algorithm": "ED25519", - "didDocument" : { - "@context" : [ + "didDocument": { + "@context": [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod" : [ + "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#", - "publicKeyJwk" : { + "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", "x": "mhph0ZSVk7cDVmazbaaC3jBDpphW4eNygAK9gHPlMow" @@ -2637,24 +2632,24 @@ } } }, - "Wallet details without with credentials true" : { + "Wallet details without with credentials true": { "description": "Wallet details without with credentials true", - "value" : { + "value": { "name": "companyA", "did": "did:web:localhost:BPNL000000000001", "bpn": "BPNL000000000001", "algorithm": "ED25519", - "didDocument" : { - "@context" : [ + "didDocument": { + "@context": [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000001", - "verificationMethod" : [ + "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000001", "id": "did:web:localhost:BPNL000000000001#", - "publicKeyJwk" : { + "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", "x": "mhph0ZSVk7cDVmazbaaC3jBDpphW4eNygAK9gHPlMow" @@ -2663,29 +2658,29 @@ } ] }, - "verifiableCredentials" : [ + "verifiableCredentials": [ { - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:localhost:BPNL000000000000#a1f8ae36-9919-4ed8-8546-535280acc5bf", - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T09:14:45Z", "expirationDate": "2023-09-30T18:30:00Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000001", "id": "did:web:localhost:BPNL000000000001", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:14:47Z", "jws": "eyJhbGciOiJFZERTQSJ9..O69dLGMDVgZQJ7chFx3aUbkJFvibH8WWunw634rIDC77_pdiUHvQpQ0hq15_7OgFMy3dp-9H-pNgxTZ-i4UXCw", "proofPurpose": "proofPurpose", @@ -2700,22 +2695,22 @@ } } }, - "400" : { + "400": { "description": "The input does not comply to the syntax requirements", - "content" : { - "application/json" : { - "examples" : { - "Response in case of invalid data provided" : { + "content": { + "application/json": { + "examples": { + "Response in case of invalid data provided": { "description": "Response in case of invalid data provided", - "value" : { + "value": { "type": "about:blank", "title": "title", "status": 400, "detail": "details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689760833962, - "errors" : {} + "errors": {} } } } @@ -2723,26 +2718,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden access" }, - "404" : { + "404": { "description": "Wallet not found with provided identifier", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with provided identifier" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with provided identifier": { "description": "Wallet not found with provided identifier", - "value" : { + "value": { "type": "about:blank", "title": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "status": 404, "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000501", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000501", - "properties" : { + "properties": { "timestamp": 1689764377224 } } @@ -2751,20 +2746,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -2774,72 +2769,72 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } }, - "/api/presentations/iatp" : { - "get" : { - "tags" : [ + "/api/presentations/iatp": { + "get": { + "tags": [ "Verifiable Presentations - Generation" ], "summary": "Create Verifiable Presentation", "description": "Create a verifiable presentation for the verifiable credential types listed in STS token", "operationId": "createPresentation_1", - "parameters" : [ + "parameters": [ { "name": "asJwt", "in": "query", "required": false, - "schema" : { + "schema": { "type": "boolean", "default": false } } ], - "responses" : { - "200" : { + "responses": { + "200": { "description": "Verifiable Presentation", - "content" : { - "application/json" : { - "examples" : { - "VP as Json-LD" : { + "content": { + "application/json": { + "examples": { + "VP as Json-LD": { "description": "VP as Json-LD", - "value" : { - "vp" : { - "@context" : [ + "value": { + "vp": { + "@context": [ "https://www.w3.org/2018/credentials/v1" ], "id": "did:web:localhost:BPNL000000000000#b2e69e47-95f3-48ff-af30-eaaab36431d5", - "type" : [ + "type": [ "VerifiablePresentation" ], - "verifiableCredential" : [ + "verifiableCredential": [ { "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", - "@context" : [ + "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], - "type" : [ + "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", - "credentialSubject" : [ + "credentialSubject": [ { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", "type": "BpnCredential" } ], - "proof" : { + "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", @@ -2851,9 +2846,9 @@ } } }, - "VP as JWT" : { + "VP as JWT": { "description": "VP as JWT", - "value" : { + "value": { "vp": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwiYXVkIjoic21hcnQiLCJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidnAiOnsiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIzM4ZTU2ZTg1LTNkODQtNGEyNS1iZjg1LWFiMjRlYzY4MmMwOSIsInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vY2F0ZW5heC1uZy5naXRodWIuaW8vcHJvZHVjdC1jb3JlLXNjaGVtYXMvYnVzaW5lc3NQYXJ0bmVyRGF0YS5qc29uIiwiaHR0cHM6Ly93M2lkLm9yZy9zZWN1cml0eS9zdWl0ZXMvandzLTIwMjAvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkJwbkNyZWRlbnRpYWwiXSwiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwI2Y3M2UzNjMxLWJhODctNGEwMy1iZWEzLWIyODcwMDA1Njg3OSIsImlzc3VlciI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTA3LTE5VDA5OjExOjM0WiIsImV4cGlyYXRpb25EYXRlIjoiMjAyNC0xMi0zMVQxODozMDowMFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJicG4iOiJCUE5MMDAwMDAwMDAwMDAwIiwidHlwZSI6IkJwbkNyZWRlbnRpYWwifSwicHJvb2YiOnsicHJvb2ZQdXJwb3NlIjoicHJvb2ZQdXJwb3NlIiwidHlwZSI6Ikpzb25XZWJTaWduYXR1cmUyMDIwIiwidmVyaWZpY2F0aW9uTWV0aG9kIjoiZGlkOndlYjpsb2NhbGhvc3Q6QlBOTDAwMDAwMDAwMDAwMCMiLCJjcmVhdGVkIjoiMjAyMy0wNy0xOVQwOToxMTozOVoiLCJqd3MiOiJleUpoYkdjaU9pSkZaRVJUUVNKOS4uZmRuMnFVODVhdU9sdGRIRExkSEk3c0pWVjFaUGRmdHBpWGRfbmRYTjBkRmdTRFdpSXJTY2REMDN3dHZLTHFfSC1zaFFXZmgyUlllTW1ybEV6QWhmRHcifX19LCJleHAiOjE2ODk4MzQ4MDUsImp0aSI6ImIwODYzOWZiLWQ5MWEtNGUwZS1iNmY4LTYzYjdhMzQ1ZTRhZiJ9.80x0AB-OauefdeZfx1cwhitdVKRvCRFeFzYwU73DL7y4w34vu6BdfHWLBGjkwELxkQEoFfiTPOqtuyqhtsyDBg" } } @@ -2861,26 +2856,26 @@ } } }, - "401" : { + "401": { "description": "The request could not be completed due to a failed authorization." }, - "403" : { + "403": { "description": "The request could not be completed due to a forbidden scope value" }, - "404" : { + "404": { "description": "One or more of the requested verifiable credential types were not found", - "content" : { - "application/json" : { - "examples" : { - "One or more of the requested verifiable credential types were not found" : { + "content": { + "application/json": { + "examples": { + "One or more of the requested verifiable credential types were not found": { "description": "One or more of the requested verifiable credential types were not found", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 404, "detail": "Verifiable credential types that were not found", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -2889,20 +2884,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -2912,61 +2907,61 @@ } } }, - "security" : [ + "security": [ { - "sts_token" : [] + "sts_token": [] } ] } }, - "/api/didDocuments/{identifier}" : { - "get" : { - "tags" : [ + "/api/didDocuments/{identifier}": { + "get": { + "tags": [ "DIDDocument" ], "summary": "Resolve DID Document", "description": "Resolve the DID document for a given DID or BPN", "operationId": "getDidDocument", - "parameters" : [ + "parameters": [ { "name": "identifier", "in": "path", "description": "Did or BPN", "required": true, - "schema" : { + "schema": { "type": "string" }, - "examples" : { - "bpn" : { + "examples": { + "bpn": { "description": "bpn", "value": "BPNL000000000000" }, - "did" : { + "did": { "description": "did", "value": "did:web:localhost:BPNL000000000000" } } } ], - "responses" : { - "200" : { + "responses": { + "200": { "description": "DID document", - "content" : { - "application/json" : { - "examples" : { - " DID document" : { + "content": { + "application/json": { + "examples": { + " DID document": { "description": " DID document", - "value" : { - "@context" : [ + "value": { + "@context": [ "https://www.w3.org/ns/did/v1", "https://w3c.github.io/vc-jws-2020/contexts/v1" ], "id": "did:web:localhost:BPNL000000000000", - "verificationMethod" : [ + "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "publicKeyJwk" : { + "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", "x": "wAOQvr92L1m7RwrpeOrgWByVYvWmhRr4fJbiMwHEIdY" @@ -2980,20 +2975,20 @@ } } }, - "404" : { + "404": { "description": "Wallet not found with provided bpn", - "content" : { - "application/json" : { - "examples" : { - "Wallet not found with provided bpn" : { + "content": { + "application/json": { + "examples": { + "Wallet not found with provided bpn": { "description": "Wallet not found with provided bpn", - "value" : { + "value": { "type": "about:blank", "title": "Wallet not found for identifier BPNL00000000000", "status": 404, "detail": "Wallet not found for identifier BPNL00000000000", "instance": "/BPNL00000000000/did.json", - "properties" : { + "properties": { "timestamp": 1689767698010 } } @@ -3002,20 +2997,20 @@ } } }, - "500" : { + "500": { "description": "Any other internal server error", - "content" : { - "application/json" : { - "examples" : { - "Internal server error" : { + "content": { + "application/json": { + "examples": { + "Internal server error": { "description": "Internal server error", - "value" : { + "value": { "type": "about:blank", "title": "Error Title", "status": 500, "detail": "Error Details", "instance": "API endpoint", - "properties" : { + "properties": { "timestamp": 1689762476720 } } @@ -3025,97 +3020,97 @@ } } }, - "security" : [ + "security": [ { - "Authenticate using access_token" : [] + "Authenticate using access_token": [] } ] } } }, - "components" : { - "schemas" : { - "CreateWalletRequest" : { - "required" : [ + "components": { + "schemas": { + "CreateWalletRequest": { + "required": [ "businessPartnerNumber", "companyName", "didUrl" ], "type": "object", - "properties" : { - "businessPartnerNumber" : { + "properties": { + "businessPartnerNumber": { "pattern": "^(BPN)(L|S|A)[0-9A-Z]{12}", "type": "string" }, - "companyName" : { + "companyName": { "maxLength": 255, "minLength": 1, "type": "string" }, - "didUrl" : { + "didUrl": { "maxLength": 2000, "minLength": 1, "type": "string" } } }, - "SecureTokenRequest" : { + "SecureTokenRequest": { "type": "object", - "properties" : { - "audience" : { + "properties": { + "audience": { "type": "string" }, - "client_id" : { + "client_id": { "type": "string" }, - "client_secret" : { + "client_secret": { "type": "string" }, - "grant_type" : { + "grant_type": { "type": "string" }, - "access_token" : { + "access_token": { "type": "string" }, - "bearer_access_alias" : { + "bearer_access_alias": { "type": "string" }, - "bearer_access_scope" : { + "bearer_access_scope": { "type": "string" } } }, - "CredentialVerificationRequest" : { + "CredentialVerificationRequest": { "type": "object", - "properties" : { - "jwt" : { + "properties": { + "jwt": { "type": "string", "writeOnly": true }, - "vc" : { + "vc": { "type": "object", - "additionalProperties" : { + "additionalProperties": { "type": "object" }, "writeOnly": true }, - "empty" : { + "empty": { "type": "boolean" } }, - "additionalProperties" : { + "additionalProperties": { "type": "object" } } }, - "securitySchemes" : { - "Authenticate using access_token" : { + "securitySchemes": { + "Authenticate using access_token": { "type": "apiKey", "description": "**Bearer (apiKey)**\nJWT Authorization header using the Bearer scheme.\nEnter **Bearer** [space] and then your token in the text input below:\nExample: Bearer 12345abcdef\n", "name": "Authorization", "in": "header" }, - "sts_token" : { + "sts_token": { "type": "apiKey", "description": "**STS token**\nJWT Authorization header.\nEnter your token in the text input below:\nExample: 12345abcdef\n", "name": "Authorization", @@ -3123,4 +3118,4 @@ } } } -} +} \ No newline at end of file From 0e13e42808b9af91510091349f37972eda5b3371 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Thu, 13 Jun 2024 15:33:51 +0530 Subject: [PATCH 10/10] doc: arc42 updated --- docs/arc42/main.md | 517 +-------------------------------------------- 1 file changed, 4 insertions(+), 513 deletions(-) diff --git a/docs/arc42/main.md b/docs/arc42/main.md index a56720345..ba5f7fe2f 100644 --- a/docs/arc42/main.md +++ b/docs/arc42/main.md @@ -165,167 +165,18 @@ end box group "Create Wallet" box "Create Wallet" user -> MIW: "/api/wallet" with BPN and Name - group "Wallet Creation" + group "Wallet Creation" MIW -> MIW: Create Database entry MIW -> MIW: Create Private and Public Key MIW -> MIW: Store Private Key AES encrypted in DB MIW -> MIW: Create DID:web Document MIW -> MIW: Store DID-Document end group - group "BPN Credential" - MIW -> MIW: Create BPN Credential - MIW -> MIW: Sign JSON-LD BPN Credential with issuer private key (Private Key of Issuer Wallet) - MIW -> MIW: Store BPN Credential - end group - group "Summary Credential" - MIW -> MIW: Access User Wallet - MIW -> MIW: Check if Summary Credential is already Created - MIW -> MIW: Check BPN Credential is not already in Summary Credential - MIW -> MIW: Create Summary Credential with BPN - MIW -> MIW: Store Summary Credential in Issuer Wallet - MIW -> MIW: Store Summary Credential in Holder Wallet - end group MIW --> user: Return Wallet end box end group ``` -### Issue Membership Credential - -```plantuml -title Issue Membership Credential - -actor User as User - -participant PortalIDP as keycloak -participant ManagedIdentityWallet as MIW - -box "Get Accesstoken" - User -> keycloak: Get AccessToken - keycloak --> User: AccessToken -end box - -group "Issue Membership" - User -> MIW: "/api/credentials/issuer/membership" with BPN - group "Create Membership Credential" - MIW -> MIW: Create Use Case Credential - MIW -> MIW: Sign JSON-LD Use Case Credential with issuer private key (Private Key of Issuer Wallet) - MIW -> MIW: Store Credential in Issuer Wallet - MIW -> MIW: Store Credential in Holder Wallet - end group - group "Summary Credential" - MIW -> MIW: Access User Wallet - MIW -> MIW: Check if Summary Credential is already Created - MIW -> MIW: Check Membership Credential is not already in Summary Credential - MIW -> MIW: Delete Summary Credential in User Wallet - MIW -> MIW: Create Summary Credential with specific Use Case - MIW -> MIW: Store Summary Credential in Issuer Wallet - MIW -> MIW: Store Summary Credential in Holder Wallet - end group - MIW --> User: Return signed Membership Credential -end group -``` - -### Issue Usecase Credential - -```plantuml -title Issue UseCaseFrameworkCredential - -actor User as User - -participant PortalIDP as keycloak -participant ManagedIdentityWallet as MIW - -box "Get Accesstoken" - User -> keycloak: Get AccessToken - keycloak --> User: AccessToken -end box - -group "Issue UseCaseCredential" - User -> MIW: "/api/credentials/issuer/framework" with (BPN, Type, ContractVersion, ContractTemplate) - group "Use Case Credential" - MIW -> MIW: Create Use Case Credential - MIW -> MIW: Sign JSON-LD Use Case Credential with issuer private key (Private Key of Issuer Wallet) - MIW -> MIW: Store Credential in Issuer Wallet - end group - group "Summary Credential" - MIW -> MIW: Access User Wallet - MIW -> MIW: Check if Summary Credential is already Created - MIW -> MIW: Check Use Case Credential is not already in Summary Credential - MIW -> MIW: If not delete Summary Credential in User Wallet - MIW -> MIW: Create Summary Credential with specific Use Case - MIW -> MIW: Store Summary Credential in Issuer Wallet - MIW -> MIW: Store Summary Credential in Holder Wallet - end group - MIW --> User: Return signed Use Case Credential -end group -``` - -### Issue Dismantler Credential - -```plantuml -title Issue Dismantler Credential - -actor User as User - -participant PortalIDP as keycloak -participant ManagedIdentityWallet as MIW - -box "Get Accesstoken" - User -> keycloak: Get AccessToken - keycloak --> User: AccessToken -end box - -group "Issue Dismantler Credential" - User -> MIW: "/api/credentials/issuer/dismantler" with bpn, activityType, allowedVehicleBrands - group "Create Dismantler Credential" - MIW -> MIW: Create Dismantler Credential - MIW -> MIW: Sign JSON-LD Dismantler Credential with issuer private key (Private Key of Issuer Wallet) - MIW -> MIW: Store Credential in Issuer Wallet - MIW -> MIW: Store Credential in Holder Wallet - end group - group "Summary Credential" - MIW -> MIW: Access User Wallet - MIW -> MIW: Check if Summary Credential is already Created - MIW -> MIW: Check Dismantler Credential is not already in Summary Credential - MIW -> MIW: Delete Summary Credential in User Wallet - MIW -> MIW: Create Summary Credential with Dismantler added - MIW -> MIW: Store Summary Credential in Issuer Wallet - MIW -> MIW: Store Summary Credential in Holder Wallet - end group - MIW --> User: Return signed Dismantler Credential -end group -``` - -### Fetch Summary Verifiable Presentation - -```plantuml -title Fetch SummaryVP - -actor User as User - -participant PortalIDP as keycloak -participant ManagedIdentityWallet as MIW - -box "Get Accesstoken" - User -> keycloak: Get AccessToken - keycloak --> User: AccessToken -end box - -group "Get Summary VP" - group "Get Summary Credential" - User -> MIW: "/api/credentials?type=['SummaryCredential']" - MIW -> MIW: Lookup Credential in Wallet with Type - MIW --> User: Return Credential(s) with Type - end group - group "Create Summary Presentation" - User -> MIW: "/api/presentations?withAudience=['Audience1','Audience2']+asJwt=true" - MIW -> MIW: Issue VP with Audience as JWT - MIW --> User: Return signed Presentation - end group -end group -``` - ### Validate Verifiable Presentation ```plantuml @@ -343,7 +194,7 @@ end box group "Verify/Validate Verifiable Presentation" User -> MIW: "/api/presentations/validation?withDateValidation=true" with VP - group "Presentation Validation" + group "Presentation Validation" MIW -> MIW: Validate Presentation JsonLD MIW -> MIW: Verify Presentation Signature end group @@ -420,354 +271,6 @@ examples: - `[uuid]` is a UUIDv4 type of UUID, e.g. `f01d7219-d1aa-48c6-beaa-9e433e80ac79` - `[IRI]` is a URL-type of ID, but with extended characters, e.g. `"https://example.com/credentials/123" -#### BPN Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/businessPartnerData"
-    ],
-    "id": "[uuid]",
-    "type": [
-        "VerifiableCredential",
-        "BpnCredential"
-    ],
-    "issuer": "[did]",
-    "issuanceDate": "[iso8601-timestamp]",
-    "credentialSubject": {
-        "id": "[did]"
-        "type": "BpnCredential",
-        "bpn": "[bpn]"
-    }
-}
-
- -#### Behavior Twin Use Case Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/UseCaseVC"
-    ],
-    "id": "[IRI]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "UseCaseFrameworkCondition"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]",
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-        "usecase-agreement": {
-            "value": "Behavior Twin",
-            "type": "cx-behavior-twin",
-            "contract-template": "https://public.catena-x.org/contracts/behavior_twin.v1.pdf",
-            "contract-version": "1.0.0"
-        }
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- -#### Membership Credential - -Attestation of membership, currently used for Catena-X membership - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/businessPartnerData"
-    ],
-    "id": "[uuid]",
-    "type": [
-        "VerifiableCredential",
-        "MembershipCredential"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]",
-    "issuer": "[did]",
-    "credentialSubject": {
-        "id": "[did]"
-        "type": "MembershipCredential",
-        "holderIdentifier": "[bpn]",
-        "memberOf": "Catena-X",
-        "status": "Active",
-        "startTime": "[iso8601-timestamp]",
-    }
-}
-
- -#### Dismantler Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/businessPartnerData"
-    ],
-    "id": "[uuid]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "DismantlerCredential"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]",
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-        "allowedVehicleBrands": [
-            "[brand 1]",
-            "[brand 2]",
-            "[brand 3]"
-        ]
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- -#### PCF Use Case Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://www.w3.org/2018/credentials/examples/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/UseCaseVC"
-    ],
-    "id": "[uuid]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "UseCaseFrameworkCondition"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]", //Optional field
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-        "usecaseAgreement": {
-            "value": "PCF",
-            "type": "cx-pcf",
-            "contract-template": "https://public.catena-x.org/contracts/pcf.v1.pdf",
-            "contract-version": "1.0.0"
-        }
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- -#### Quality Use Case Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/UseCaseVC"
-    ],
-    "id": "[uuid]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "UseCaseFrameworkCondition"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]",
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-        "usecase-agreement": {
-            "value": "Quality",
-            "type": "cx-quality",
-            "contract-template": "https://public.catena-x.org/contracts/quality.v1.pdf",
-            "contract-version": "1.0.0"
-        }
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- -#### Resiliency Use Case Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/UseCaseVC"
-    ],
-    "id": "[uuid]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "UseCaseFrameworkCondition"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]",
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-        "usecase-agreement": {
-            "value": "Resiliency",
-            "type": "cx-resiliency",
-            "contract-template": "https://public.catena-x.org/contracts/resiliency.v1.pdf",
-            "contract-version": "1.0.0"
-        }
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- -#### Sustainability Use Case Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/UseCaseVC"
-    ],
-    "id": "[uuid]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "UseCaseFrameworkCondition"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]",
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-        "usecase-agreement": {
-            "value": "Sustainability",
-            "type": "cx-sustainability",
-            "contract-template": "https://public.catena-x.org/contracts/sustainability.v1.pdf",
-            "contract-version": "1.0.0"
-        }
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- -#### Trace Use Case Credential - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/UseCaseVC"
-    ],
-    "id": "[uuid]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "UseCaseFrameworkCondition"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]", //Optional field
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-        "usecaseAgreement": {
-            "value": "ID_3.0_Trace",
-            "type": "cx-traceability",
-            "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf",
-            "contract-version": "1.0.0",
-        }
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- -#### Summary Credential (scheduled for deprecation) - -The flow of creating a summary credential - -```plantuml -``` - -
-{
-    "@context": [
-        "https://www.w3.org/2018/credentials/v1",
-        "https://w3id.org/security/suites/jws-2020/v1",
-        "https://raw.githubusercontent.com/catenax-ng/product-core-schemas/main/UseCaseVC"
-    ],
-    "id": "[uuid]",
-    "issuer": "[did]",
-    "type": [
-        "VerifiableCredential",
-        "SummaryCredential"
-    ],
-    "issuanceDate": "[iso8601-timestamp]",
-    "expirationDate": "[iso8601-timestamp]", //Optional field
-    "credentialSubject": {
-        "id": "[did]",
-        "holderIdentifier": "[bpn]",
-    },
-    "proof": {
-        "type": "JsonWebSignature2020",
-        "created": "[iso8601-timestamp]",
-        "jws": "[jws]",
-        "proofPurpose": "assertionMethod",
-        "verificationMethod": "[did#key-id]"
-    }
-}
-
- # Deployment @@ -848,7 +351,7 @@ requirements where relevant and applicable: - Security & Compliance: Container Scan - Security & Compliance: Infrastructure as Code -# Technical Debts +# Technical Debts ## DID Technical Debts @@ -859,14 +362,7 @@ requirements where relevant and applicable: - No real tenant system - Private Keys are AES encrypted and stored in the MIW Postgres database - No revocation service available -- Summary Credential used as a token. -- Only 1 verifiable credential (VC) in a verifiable presentation (VP) possible -- Summary VC (S-VC) created with the private key of the auhtority - DID documents are stored in the MIW -- Summary VC always get deleted when new CX-Credential is added to the - MIW -- The creation of CX-Credential is located in the MIW, should be a dedicated - service outside of the wallet service - Only managed wallet available. No self-mangaged wallet - No Issuer Registry. Only one trusted issuer available - Download of VC to own wallet not possible @@ -874,11 +370,6 @@ requirements where relevant and applicable: - No key rotation - No update possibility for credentials, they need to be deleted and new ones generated -## Verifiable Credential - -- CX-Credentials are not consistent -- Only Summary Credential will be used because of the http header limition of 8KB - ## Verifiable Presentation Protocol (VVP) The *Verifiable Presentation Protocol (VPP)* is designed to address the problem of resolving Verifiable Presentations @@ -909,7 +400,7 @@ Declaring file: [VVP Flow Declaration](images/VVP-Flow.puml) ## SSI Library - + - No validation for JsonWebSignature2020 with RSA key - No Security valdition only Sercurity Assessment done, no attack vectors are tested