From 7524ec7e12bcbcd1cf9bf0c44fe6c8d11abd8204 Mon Sep 17 00:00:00 2001 From: Yurii Shynbuiev Date: Mon, 16 Dec 2024 21:49:53 +0700 Subject: [PATCH] fix: createCredentialIssueRecordRequest schemaId field to be Option[String] (#1481) Signed-off-by: Yurii Shynbuiev --- .../client/kotlin/.openapi-generator-ignore | 6 - .../CreateIssueCredentialRecordRequest.kt | 86 ----------- .../typescript/.openapi-generator-ignore | 1 - .../CreateIssueCredentialRecordRequest.ts | 135 ------------------ ...redentialSchemaReferenceParsingLogic.scala | 8 +- .../CreateIssueCredentialRecordRequest.scala | 2 +- tests/integration-tests/build.gradle.kts | 2 +- .../connectionless/ConnectionLessSteps.kt | 2 +- .../steps/credentials/JwtCredentialSteps.kt | 2 +- .../steps/credentials/SdJwtCredentialSteps.kt | 2 +- .../agent-performance-tests-k6/package.json | 2 +- .../agent-performance-tests-k6/yarn.lock | 8 +- 12 files changed, 13 insertions(+), 243 deletions(-) delete mode 100644 cloud-agent/client/kotlin/src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequest.kt delete mode 100644 cloud-agent/client/typescript/models/CreateIssueCredentialRecordRequest.ts diff --git a/cloud-agent/client/kotlin/.openapi-generator-ignore b/cloud-agent/client/kotlin/.openapi-generator-ignore index 658834d27c..87d057cc2b 100644 --- a/cloud-agent/client/kotlin/.openapi-generator-ignore +++ b/cloud-agent/client/kotlin/.openapi-generator-ignore @@ -17,9 +17,6 @@ src/main/kotlin/org/hyperledger/identus/client/models/DateTimeParameter.kt src/main/kotlin/org/hyperledger/identus/client/models/DidParameter.kt src/main/kotlin/org/hyperledger/identus/client/models/VcVerificationParameter.kt -src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequest.kt -src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequestSchemaId.kt - src/test/kotlin/org/hyperledger/identus/client/models/UpdateManagedDIDServiceActionTest.kt src/test/kotlin/org/hyperledger/identus/client/models/UpdateManagedDIDServiceActionTypeTest.kt @@ -29,6 +26,3 @@ src/test/kotlin/org/hyperledger/identus/client/models/ServiceTypeTest.kt src/test/kotlin/org/hyperledger/identus/client/models/StatusPurposeTest.kt src/test/kotlin/org/hyperledger/identus/client/models/CredentialSubjectTest.kt -src/test/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequestTest.kt -src/test/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequestSchemaIdTest.kt - diff --git a/cloud-agent/client/kotlin/src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequest.kt b/cloud-agent/client/kotlin/src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequest.kt deleted file mode 100644 index 7518b6a52e..0000000000 --- a/cloud-agent/client/kotlin/src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequest.kt +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.hyperledger.identus.client.models - -import com.google.gson.annotations.JsonAdapter -import com.google.gson.annotations.SerializedName -import org.hyperledger.identus.client.adapters.StringOrStringArrayAdapter - -/** - * - * - * @param claims The set of claims that will be included in the issued credential. The JSON object should comply with the schema applicable for this offer (i.e. 'schemaId' or 'credentialDefinitionId'). - * @param issuingDID The issuer Prism DID by which the verifiable credential will be issued. DID can be short for or long form. - * @param validityPeriod The validity period in seconds of the verifiable credential that will be issued. - * @param schemaId - * @param credentialDefinitionId The unique identifier (UUID) of the credential definition that will be used for this offer. It should be the identifier of a credential definition that exists in the issuer agent's database. Note that this parameter only applies when the offer is of type 'AnonCreds'. - * @param credentialFormat The credential format for this offer (defaults to 'JWT') - * @param automaticIssuance Specifies whether or not the credential should be automatically generated and issued when receiving the `CredentialRequest` from the holder. If set to `false`, a manual approval by the issuer via another API call will be required for the VC to be issued. - * @param issuingKid Specified the key ID (kid) of the DID, it will be used to sign credential. User should specify just the partial identifier of the key. The full id of the kid MUST be \"#\" Note the cryto algorithm used with depend type of the key. - * @param connectionId The unique identifier of a DIDComm connection that already exists between the this issuer agent and the holder cloud or edeg agent. It should be the identifier of a connection that exists in the issuer agent's database. This connection will be used to execute the issue credential protocol. Note: connectionId is only required when the offer is from existing connection. connectionId is not required when the offer is from invitation for connectionless issuance. - * @param goalCode A self-attested code the receiver may want to display to the user or use in automatically deciding what to do with the out-of-band message. goalcode is optional and can be provided when the offer is from invitation for connectionless issuance. - * @param goal A self-attested string that the receiver may want to display to the user about the context-specific goal of the out-of-band message. goal is optional and can be provided when the offer is from invitation for connectionless issuance. - */ - - -data class CreateIssueCredentialRecordRequest( - - /* The set of claims that will be included in the issued credential. The JSON object should comply with the schema applicable for this offer (i.e. 'schemaId' or 'credentialDefinitionId'). */ - @SerializedName("claims") - val claims: kotlin.Any?, - - /* The issuer Prism DID by which the verifiable credential will be issued. DID can be short for or long form. */ - @SerializedName("issuingDID") - val issuingDID: kotlin.String, - - /* The validity period in seconds of the verifiable credential that will be issued. */ - @SerializedName("validityPeriod") - val validityPeriod: kotlin.Double? = null, - - @SerializedName("schemaId") - @JsonAdapter(StringOrStringArrayAdapter::class) - val schemaId: kotlin.collections.List? = null, - - /* The unique identifier (UUID) of the credential definition that will be used for this offer. It should be the identifier of a credential definition that exists in the issuer agent's database. Note that this parameter only applies when the offer is of type 'AnonCreds'. */ - @SerializedName("credentialDefinitionId") - val credentialDefinitionId: java.util.UUID? = null, - - /* The credential format for this offer (defaults to 'JWT') */ - @SerializedName("credentialFormat") - val credentialFormat: kotlin.String? = null, - - /* Specifies whether or not the credential should be automatically generated and issued when receiving the `CredentialRequest` from the holder. If set to `false`, a manual approval by the issuer via another API call will be required for the VC to be issued. */ - @SerializedName("automaticIssuance") - val automaticIssuance: kotlin.Boolean? = null, - - /* Specified the key ID (kid) of the DID, it will be used to sign credential. User should specify just the partial identifier of the key. The full id of the kid MUST be \"#\" Note the cryto algorithm used with depend type of the key. */ - @SerializedName("issuingKid") - val issuingKid: kotlin.String? = null, - - /* The unique identifier of a DIDComm connection that already exists between the this issuer agent and the holder cloud or edeg agent. It should be the identifier of a connection that exists in the issuer agent's database. This connection will be used to execute the issue credential protocol. Note: connectionId is only required when the offer is from existing connection. connectionId is not required when the offer is from invitation for connectionless issuance. */ - @SerializedName("connectionId") - val connectionId: java.util.UUID? = null, - - /* A self-attested code the receiver may want to display to the user or use in automatically deciding what to do with the out-of-band message. goalcode is optional and can be provided when the offer is from invitation for connectionless issuance. */ - @SerializedName("goalCode") - val goalCode: kotlin.String? = null, - - /* A self-attested string that the receiver may want to display to the user about the context-specific goal of the out-of-band message. goal is optional and can be provided when the offer is from invitation for connectionless issuance. */ - @SerializedName("goal") - val goal: kotlin.String? = null - -) - diff --git a/cloud-agent/client/typescript/.openapi-generator-ignore b/cloud-agent/client/typescript/.openapi-generator-ignore index cf11c2202e..af11cd214d 100644 --- a/cloud-agent/client/typescript/.openapi-generator-ignore +++ b/cloud-agent/client/typescript/.openapi-generator-ignore @@ -6,4 +6,3 @@ models/CredentialRequest.ts models/Proof2.ts models/Service.ts models/UpdateManagedDIDServiceAction.ts -models/CreateIssueCredentialRecordRequest.ts diff --git a/cloud-agent/client/typescript/models/CreateIssueCredentialRecordRequest.ts b/cloud-agent/client/typescript/models/CreateIssueCredentialRecordRequest.ts deleted file mode 100644 index 14190cd10d..0000000000 --- a/cloud-agent/client/typescript/models/CreateIssueCredentialRecordRequest.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Identus Cloud Agent API Reference - * The Identus Cloud Agent API facilitates the integration and management of self-sovereign identity capabilities within applications. It supports DID (Decentralized Identifiers) management, verifiable credential exchange, and secure messaging based on DIDComm standards. The API is designed to be interoperable with various blockchain and DLT (Distributed Ledger Technology) platforms, ensuring wide compatibility and flexibility. Key features include connection management, credential issuance and verification, and secure, privacy-preserving communication between entities. Additional information and the full list of capabilities can be found in the [Open Enterprise Agent documentation](https://docs.atalaprism.io/docs/category/prism-cloud-agent) - * - * OpenAPI spec version: 1.39.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http'; - -export class CreateIssueCredentialRecordRequest { - /** - * The validity period in seconds of the verifiable credential that will be issued. - */ - 'validityPeriod'?: number; - 'schemaId'?: string | Array; - /** - * The unique identifier (UUID) of the credential definition that will be used for this offer. It should be the identifier of a credential definition that exists in the issuer agent\'s database. Note that this parameter only applies when the offer is of type \'AnonCreds\'. - */ - 'credentialDefinitionId'?: string; - /** - * The credential format for this offer (defaults to \'JWT\') - */ - 'credentialFormat'?: string; - /** - * The set of claims that will be included in the issued credential. The JSON object should comply with the schema applicable for this offer (i.e. \'schemaId\' or \'credentialDefinitionId\'). - */ - 'claims': any | null; - /** - * Specifies whether or not the credential should be automatically generated and issued when receiving the `CredentialRequest` from the holder. If set to `false`, a manual approval by the issuer via another API call will be required for the VC to be issued. - */ - 'automaticIssuance'?: boolean; - /** - * The issuer Prism DID by which the verifiable credential will be issued. DID can be short for or long form. - */ - 'issuingDID': string; - /** - * Specified the key ID (kid) of the DID, it will be used to sign credential. User should specify just the partial identifier of the key. The full id of the kid MUST be \"#\" Note the cryto algorithm used with depend type of the key. - */ - 'issuingKid'?: string; - /** - * The unique identifier of a DIDComm connection that already exists between the this issuer agent and the holder cloud or edeg agent. It should be the identifier of a connection that exists in the issuer agent\'s database. This connection will be used to execute the issue credential protocol. Note: connectionId is only required when the offer is from existing connection. connectionId is not required when the offer is from invitation for connectionless issuance. - */ - 'connectionId'?: string; - /** - * A self-attested code the receiver may want to display to the user or use in automatically deciding what to do with the out-of-band message. goalcode is optional and can be provided when the offer is from invitation for connectionless issuance. - */ - 'goalCode'?: string; - /** - * A self-attested string that the receiver may want to display to the user about the context-specific goal of the out-of-band message. goal is optional and can be provided when the offer is from invitation for connectionless issuance. - */ - 'goal'?: string; - - static readonly discriminator: string | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "validityPeriod", - "baseName": "validityPeriod", - "type": "number", - "format": "double" - }, - { - "name": "schemaId", - "baseName": "schemaId", - "type": "CreateIssueCredentialRecordRequestSchemaId", - "format": "" - }, - { - "name": "credentialDefinitionId", - "baseName": "credentialDefinitionId", - "type": "string", - "format": "uuid" - }, - { - "name": "credentialFormat", - "baseName": "credentialFormat", - "type": "string", - "format": "" - }, - { - "name": "claims", - "baseName": "claims", - "type": "any", - "format": "" - }, - { - "name": "automaticIssuance", - "baseName": "automaticIssuance", - "type": "boolean", - "format": "" - }, - { - "name": "issuingDID", - "baseName": "issuingDID", - "type": "string", - "format": "" - }, - { - "name": "issuingKid", - "baseName": "issuingKid", - "type": "string", - "format": "" - }, - { - "name": "connectionId", - "baseName": "connectionId", - "type": "string", - "format": "uuid" - }, - { - "name": "goalCode", - "baseName": "goalCode", - "type": "string", - "format": "" - }, - { - "name": "goal", - "baseName": "goal", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return CreateIssueCredentialRecordRequest.attributeTypeMap; - } - - public constructor() { - } -} - diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/CredentialSchemaReferenceParsingLogic.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/CredentialSchemaReferenceParsingLogic.scala index 642581a2b3..9772af22d7 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/CredentialSchemaReferenceParsingLogic.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/CredentialSchemaReferenceParsingLogic.scala @@ -16,7 +16,7 @@ trait CredentialSchemaReferenceParsingLogic { // The "type" property in the "credentialSchema" object must be "JsonSchemaValidator2018". // Multiple schemas are not allowed in VCDM 1.1. def parseCredentialSchemaRef_VCDM1_1( - deprecatedSchemaIdProperty: Option[String | List[String]], + deprecatedSchemaIdProperty: Option[String], credentialSchemaRefOption: Option[HTTPCredentialSchemaRef] ): IO[ErrorResponse, DomainCredentialSchemaRef] = { credentialSchemaRefOption match { @@ -31,7 +31,7 @@ trait CredentialSchemaReferenceParsingLogic { } def parseSchemaIdForAnonCredsModelV1( - deprecatedSchemaIdProperty: Option[String | List[String]], + deprecatedSchemaIdProperty: Option[String], schemaIdProperty: Option[String] ): IO[ErrorResponse, UriString] = { schemaIdProperty @@ -40,13 +40,11 @@ trait CredentialSchemaReferenceParsingLogic { } private def handleDeprecatedSchemaId( - deprecatedSchemaIdProperty: Option[String | List[String]] + deprecatedSchemaIdProperty: Option[String] ): IO[ErrorResponse, String] = { deprecatedSchemaIdProperty match { case Some(schemaId: String) => ZIO.succeed(schemaId) - case Some(_: List[String]) => - ZIO.fail(ErrorResponse.badRequest(detail = Some("Multiple credential schemas are not allowed."))) case None => ZIO.fail(ErrorResponse.badRequest(detail = Some("Credential schema property missed."))) } diff --git a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala index cb71c54a8e..ba29538d13 100644 --- a/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala +++ b/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/issue/controller/http/CreateIssueCredentialRecordRequest.scala @@ -37,7 +37,7 @@ final case class CreateIssueCredentialRecordRequest( @description(annotations.schemaId.description) @encodedExample(annotations.schemaId.example) @deprecated("Use anoncredsVcPropertiesV1.schemaId instead", "2.0.0") - schemaId: Option[String | List[String]] = None, + schemaId: Option[String] = None, @description(annotations.credentialDefinitionId.description) @encodedExample(annotations.credentialDefinitionId.example) @deprecated("Use anoncredsVcPropertiesV1.credentialDefinitionId instead", "2.0.0") diff --git a/tests/integration-tests/build.gradle.kts b/tests/integration-tests/build.gradle.kts index 4e2020e689..d7ae480e74 100644 --- a/tests/integration-tests/build.gradle.kts +++ b/tests/integration-tests/build.gradle.kts @@ -33,7 +33,7 @@ dependencies { testImplementation("io.ktor:ktor-server-netty:2.3.0") testImplementation("io.ktor:ktor-client-apache:2.3.0") // RestAPI client - testImplementation("org.hyperledger.identus:cloud-agent-client-kotlin:1.39.1-19ab426") + testImplementation("org.hyperledger.identus:cloud-agent-client-kotlin:1.40.1-d092f31") // Test helpers library testImplementation("io.iohk.atala:atala-automation:0.4.0") // Hoplite for configuration diff --git a/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt b/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt index 15445055b6..1c6b0dd489 100644 --- a/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt @@ -38,7 +38,7 @@ class ConnectionLessSteps { issuer.recall("longFormDid") } val credentialOfferRequest = CreateIssueCredentialRecordRequest( - schemaId = schemaId?.let { listOf(it) }, + schemaId = schemaId, claims = claims, issuingDID = did, issuingKid = "assertion-1", diff --git a/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt b/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt index 2ce655a5c2..338936f78e 100644 --- a/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt @@ -36,7 +36,7 @@ class JwtCredentialSteps { } val credentialOfferRequest = CreateIssueCredentialRecordRequest( - schemaId = schemaId?.let { listOf(it) }, + schemaId = schemaId, claims = claims, issuingDID = did, issuingKid = issuingKid, diff --git a/tests/integration-tests/src/test/kotlin/steps/credentials/SdJwtCredentialSteps.kt b/tests/integration-tests/src/test/kotlin/steps/credentials/SdJwtCredentialSteps.kt index 5f34116b09..8b14fc0d44 100644 --- a/tests/integration-tests/src/test/kotlin/steps/credentials/SdJwtCredentialSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/credentials/SdJwtCredentialSteps.kt @@ -32,7 +32,7 @@ class SdJwtCredentialSteps { } val credentialOfferRequest = CreateIssueCredentialRecordRequest( - schemaId = schemaId?.let { listOf(it) }, + schemaId = schemaId, claims = CredentialSchema.ID_SCHEMA.claims, issuingDID = did, connectionId = connectionId, diff --git a/tests/performance-tests/agent-performance-tests-k6/package.json b/tests/performance-tests/agent-performance-tests-k6/package.json index 4e3d689676..14766454e0 100644 --- a/tests/performance-tests/agent-performance-tests-k6/package.json +++ b/tests/performance-tests/agent-performance-tests-k6/package.json @@ -26,7 +26,7 @@ "webpack": "webpack" }, "dependencies": { - "@hyperledger/identus-cloud-agent-client-ts": "^1.40.0", + "@hyperledger/identus-cloud-agent-client-ts": "^1.40.1-d092f31", "uuid": "^9.0.0" } } diff --git a/tests/performance-tests/agent-performance-tests-k6/yarn.lock b/tests/performance-tests/agent-performance-tests-k6/yarn.lock index 43f3b8e0f1..4e94c5c6ee 100644 --- a/tests/performance-tests/agent-performance-tests-k6/yarn.lock +++ b/tests/performance-tests/agent-performance-tests-k6/yarn.lock @@ -993,10 +993,10 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@hyperledger/identus-cloud-agent-client-ts@^1.40.0": - version "1.40.0" - resolved "https://npm.pkg.github.com/download/@hyperledger/identus-cloud-agent-client-ts/1.40.0/ce8120a0483b02cda6aa348dd7e2f175c7a5b846#ce8120a0483b02cda6aa348dd7e2f175c7a5b846" - integrity sha512-uvxDYP8lJM7Dl7HMSX44fodVOxUaqsXy4WfNL2pdVCNBOksGFyAmxcAOlU8VNoCTCtKowyoPBnCK6zl9jyhgIw== +"@hyperledger/identus-cloud-agent-client-ts@^1.40.1-d092f31": + version "1.40.1-d092f31" + resolved "https://npm.pkg.github.com/download/@hyperledger/identus-cloud-agent-client-ts/1.40.1-d092f31/4bc6944b9b4141337ffdb5b139a33a202cadab6a#4bc6944b9b4141337ffdb5b139a33a202cadab6a" + integrity sha512-tXsUf/zalpTwK0x5ydD8zJTcp4aV9cnTZPoCmoywhIY3EP+jwUA/NRROjbrNpmu6jajssj6U5xKeHKoBEkrumg== dependencies: es6-promise "^4.2.4" url-parse "^1.4.3"