-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adjust Kotlin and TypeScript HTTP client to use the
schemaId
f…
…rom VCDM2.0 (string or list of strings) Signed-off-by: Yurii Shynbuiev <yurii.shynbuiev@iohk.io>
- Loading branch information
1 parent
65cc9a7
commit 4dfb04c
Showing
8 changed files
with
255 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
|
||
rootProject.name = 'cloud-agent-client-kotlin' |
26 changes: 26 additions & 0 deletions
26
...lin/src/main/kotlin/org/hyperledger/identus/client/adapters/StringOrStringArrayAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.hyperledger.identus.client.adapters | ||
|
||
import com.google.gson.* | ||
import java.lang.reflect.Type | ||
|
||
class StringOrStringArrayAdapter : JsonSerializer<List<String>>, JsonDeserializer<List<String>> { | ||
|
||
// Deserialize logic: String or Array of Strings to List<String> | ||
override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): List<String> { | ||
return when { | ||
json.isJsonArray -> context.deserialize(json, typeOfT) | ||
json.isJsonPrimitive -> listOf(json.asString) | ||
json.isJsonNull -> emptyList() | ||
else -> throw JsonParseException("Unexpected type for field") | ||
} | ||
} | ||
|
||
// Serialize logic: List<String> to String or Array of Strings | ||
override fun serialize(src: List<String>?, typeOfSrc: Type?, context: JsonSerializationContext?): JsonElement { | ||
return when { | ||
src.isNullOrEmpty() -> JsonNull.INSTANCE | ||
src.size == 1 -> JsonPrimitive(src[0]) // If only one string, serialize as a single string | ||
else -> context!!.serialize(src) // Otherwise, serialize as a list | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
...c/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* | ||
* 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 \"<issuingDID>#<kid>\" 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<kotlin.String>? = 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 \"<issuingDID>#<kid>\" 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 | ||
|
||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
cloud-agent/client/typescript/models/CreateIssueCredentialRecordRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/** | ||
* 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<string>; | ||
/** | ||
* 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 \"<issuingDID>#<kid>\" 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() { | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters