diff --git a/openid-data-classes/src/commonMain/kotlin/at/asitplus/openid/CredentialRequestParameters.kt b/openid-data-classes/src/commonMain/kotlin/at/asitplus/openid/CredentialRequestParameters.kt index 63b58ae9..da7cfabc 100644 --- a/openid-data-classes/src/commonMain/kotlin/at/asitplus/openid/CredentialRequestParameters.kt +++ b/openid-data-classes/src/commonMain/kotlin/at/asitplus/openid/CredentialRequestParameters.kt @@ -15,7 +15,6 @@ data class CredentialRequestParameters( * specific parameters such as those defined in Appendix A MUST NOT be present */ @SerialName("credential_identifier") - // TODO Update val credentialIdentifier: String? = null, /** diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/AuthorizationDetails.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/AuthorizationDetails.kt index bb60ec75..bf313194 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/AuthorizationDetails.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/AuthorizationDetails.kt @@ -1,7 +1,7 @@ import at.asitplus.openid.AuthorizationDetails import at.asitplus.rqes.collection_entries.DocumentLocation import at.asitplus.rqes.collection_entries.OAuthDocumentDigest -import at.asitplus.rqes.enums.SignatureQualifierEnum +import at.asitplus.rqes.enums.SignatureQualifier import at.asitplus.signum.indispensable.asn1.ObjectIdSerializer import at.asitplus.signum.indispensable.asn1.ObjectIdentifier import kotlinx.serialization.SerialName @@ -25,7 +25,7 @@ data class CscAuthorizationDetails( * signature to be created */ @SerialName("signatureQualifier") - val signatureQualifier: SignatureQualifierEnum? = null, + val signatureQualifier: SignatureQualifier? = null, /** * CSC: An array composed of entries for every document to be signed. This applies for diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscAuthenticationRequestParameters.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscAuthenticationRequestParameters.kt index 9049d1cd..a865cb9d 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscAuthenticationRequestParameters.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscAuthenticationRequestParameters.kt @@ -4,7 +4,7 @@ import at.asitplus.KmmResult.Companion.wrap import at.asitplus.rqes.Hashes import at.asitplus.rqes.contentEquals import at.asitplus.rqes.contentHashCode -import at.asitplus.rqes.enums.SignatureQualifierEnum +import at.asitplus.rqes.enums.SignatureQualifier import at.asitplus.rqes.serializers.HashesSerializer import at.asitplus.signum.indispensable.asn1.ObjectIdentifier import at.asitplus.signum.indispensable.io.ByteArrayBase64UrlSerializer @@ -122,7 +122,7 @@ data class CscAuthenticationRequestParameters( * signature to be created */ @SerialName("signatureQualifier") - val signatureQualifier: SignatureQualifierEnum? = null, + val signatureQualifier: SignatureQualifier? = null, /** * CSC: Required-"credential" diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscSignatureRequestParameters.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscSignatureRequestParameters.kt index c4cb8c43..a0e73066 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscSignatureRequestParameters.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/CscSignatureRequestParameters.kt @@ -1,8 +1,8 @@ package at.asitplus.rqes import at.asitplus.rqes.collection_entries.CscDocumentDigest -import at.asitplus.rqes.enums.OperationModeEnum -import at.asitplus.rqes.enums.SignatureQualifierEnum +import at.asitplus.rqes.enums.OperationMode +import at.asitplus.rqes.enums.SignatureQualifier import at.asitplus.rqes.serializers.CscSignatureRequestParameterSerializer import at.asitplus.signum.indispensable.Digest import at.asitplus.signum.indispensable.SignatureAlgorithm @@ -34,7 +34,7 @@ sealed interface CscSignatureRequestParameters { * The default value is “S”, so if the parameter is omitted then the remote signing * server will manage the request in synchronous operation mode. */ - val operationMode: OperationModeEnum? + val operationMode: OperationMode? /** * Maximum period of time, expressed in milliseconds, until which the server @@ -68,7 +68,7 @@ data class SignHashParameters( override val sad: String? = null, @SerialName("operationMode") - override val operationMode: OperationModeEnum = OperationModeEnum.SYNCHRONOUS, + override val operationMode: OperationMode = OperationMode.SYNCHRONOUS, @SerialName("validity_period") override val validityPeriod: Int? = null, @@ -164,7 +164,7 @@ data class SignDocParameters( override val sad: String? = null, @SerialName("operationMode") - override val operationMode: OperationModeEnum = OperationModeEnum.SYNCHRONOUS, + override val operationMode: OperationMode = OperationMode.SYNCHRONOUS, @SerialName("validity_period") override val validityPeriod: Int? = null, @@ -180,7 +180,7 @@ data class SignDocParameters( * a Qualified Electronic Signature according to eIDAS */ @SerialName("signatureQualifier") - val signatureQualifier: SignatureQualifierEnum? = null, + val signatureQualifier: SignatureQualifier? = null, @SerialName("documentDigests") val documentDigests: Collection? = null, diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/Misc.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/Misc.kt index 73ba12c2..dc077166 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/Misc.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/Misc.kt @@ -23,7 +23,7 @@ internal fun getSignAlgorithm(signAlgoOid: ObjectIdentifier, signAlgoParams: Asn } @Throws(Exception::class) -fun getHashAlgorithm(hashAlgorithmOid: ObjectIdentifier?, signatureAlgorithm: SignatureAlgorithm? = null) = +internal fun getHashAlgorithm(hashAlgorithmOid: ObjectIdentifier?, signatureAlgorithm: SignatureAlgorithm? = null) = hashAlgorithmOid?.let { Digest.entries.find { digest -> digest.oid == it } } ?: when(signatureAlgorithm) { diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/SignatureRequestParameters.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/SignatureRequestParameters.kt index 8543a329..5056c53e 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/SignatureRequestParameters.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/SignatureRequestParameters.kt @@ -7,9 +7,9 @@ import at.asitplus.openid.RequestParameters import at.asitplus.rqes.collection_entries.CscDocumentDigest import at.asitplus.rqes.collection_entries.DocumentLocation import at.asitplus.rqes.collection_entries.OAuthDocumentDigest -import at.asitplus.rqes.enums.ConformanceLevelEnum +import at.asitplus.rqes.enums.ConformanceLevel import at.asitplus.rqes.enums.SignatureFormat -import at.asitplus.rqes.enums.SignatureQualifierEnum +import at.asitplus.rqes.enums.SignatureQualifier import at.asitplus.rqes.enums.SignedEnvelopeProperty import at.asitplus.signum.indispensable.Digest import at.asitplus.signum.indispensable.X509SignatureAlgorithm @@ -104,7 +104,7 @@ data class SignatureRequestParameters( * signature to be created */ @SerialName("signatureQualifier") - val signatureQualifier: SignatureQualifierEnum = SignatureQualifierEnum.EU_EIDAS_QES, + val signatureQualifier: SignatureQualifier = SignatureQualifier.EU_EIDAS_QES, /** * UC5 Draft REQUIRED. @@ -158,14 +158,14 @@ data class SignatureRequestParameters( signAlgorithm: X509SignatureAlgorithm, signAlgoParam: Asn1Element? = null, signedProps: List? = null, - conformanceLevelEnum: ConformanceLevelEnum? = ConformanceLevelEnum.ADESBB, + conformanceLevel: ConformanceLevel? = ConformanceLevel.ADESBB, signedEnvelopeProperty: SignedEnvelopeProperty? = SignedEnvelopeProperty.defaultProperty(signatureFormat), ): CscDocumentDigest = CscDocumentDigest( hashes = this.documentDigests.map { it.hash }, hashAlgorithmOid = this.hashAlgorithmOid, signatureFormat = signatureFormat, - conformanceLevel = conformanceLevelEnum, + conformanceLevel = conformanceLevel, signAlgoOid = signAlgorithm.oid, signAlgoParams = signAlgoParam, signedProps = signedProps, diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/CscDocumentDigest.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/CscDocumentDigest.kt index 9525416e..33aeef34 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/CscDocumentDigest.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/CscDocumentDigest.kt @@ -3,7 +3,7 @@ package at.asitplus.rqes.collection_entries import at.asitplus.rqes.Hashes import at.asitplus.rqes.contentEquals import at.asitplus.rqes.contentHashCode -import at.asitplus.rqes.enums.ConformanceLevelEnum +import at.asitplus.rqes.enums.ConformanceLevel import at.asitplus.rqes.enums.SignatureFormat import at.asitplus.rqes.enums.SignedEnvelopeProperty import at.asitplus.rqes.getHashAlgorithm @@ -52,7 +52,7 @@ data class CscDocumentDigest( * Requested conformance level. If omitted its value is "AdES-B-B" */ @SerialName("conformance_level") - val conformanceLevel: ConformanceLevelEnum? = null, + val conformanceLevel: ConformanceLevel? = null, /** * The OID of the algorithm to use for signing diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/Document.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/Document.kt index 56f596f1..0c5395b6 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/Document.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/Document.kt @@ -1,6 +1,6 @@ package at.asitplus.rqes.collection_entries -import at.asitplus.rqes.enums.ConformanceLevelEnum +import at.asitplus.rqes.enums.ConformanceLevel import at.asitplus.rqes.enums.SignatureFormat import at.asitplus.rqes.enums.SignedEnvelopeProperty import at.asitplus.rqes.getSignAlgorithm @@ -36,7 +36,7 @@ data class Document( * Requested conformance level. If omitted its value is "Ades-B-B" */ @SerialName("conformance_level") - val conformanceLevel: ConformanceLevelEnum? = null, + val conformanceLevel: ConformanceLevel? = null, /** * The OID of the algorithm to use for signing diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/TransactionData.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/TransactionData.kt index 9ca5013a..4d5efb67 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/TransactionData.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/collection_entries/TransactionData.kt @@ -2,7 +2,7 @@ package at.asitplus.rqes.collection_entries import at.asitplus.KmmResult import at.asitplus.KmmResult.Companion.wrap -import at.asitplus.rqes.enums.SignatureQualifierEnum +import at.asitplus.rqes.enums.SignatureQualifier import at.asitplus.signum.indispensable.asn1.ObjectIdSerializer import at.asitplus.signum.indispensable.asn1.ObjectIdentifier import at.asitplus.signum.indispensable.io.ByteArrayBase64Serializer @@ -31,7 +31,7 @@ sealed class TransactionData { * to denote a Qualified Electronic Signature according to eIDAS. */ @SerialName("signatureQualifier") - val signatureQualifier: SignatureQualifierEnum? = null, + val signatureQualifier: SignatureQualifier? = null, /** * CSC: OPTIONAL. @@ -78,7 +78,7 @@ sealed class TransactionData { * Safe way to construct the object as init throws */ fun create( - signatureQualifier: SignatureQualifierEnum?, + signatureQualifier: SignatureQualifier?, credentialId: String?, documentDigest: List, processID: String?, diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/ConformanceLevelEnum.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/ConformanceLevel.kt similarity index 97% rename from rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/ConformanceLevelEnum.kt rename to rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/ConformanceLevel.kt index 77d4a8bd..78866c66 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/ConformanceLevelEnum.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/ConformanceLevel.kt @@ -9,7 +9,7 @@ import kotlinx.serialization.Serializable */ @Suppress("unused") @Serializable -enum class ConformanceLevelEnum { +enum class ConformanceLevel { /** * “AdES-B” SHALL be used to request the creation diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/OperationModeEnum.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/OperationMode.kt similarity index 93% rename from rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/OperationModeEnum.kt rename to rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/OperationMode.kt index 2637bbbe..10391cb9 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/OperationModeEnum.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/OperationMode.kt @@ -8,7 +8,7 @@ import kotlinx.serialization.Serializable */ @Suppress("unused") @Serializable -enum class OperationModeEnum { +enum class OperationMode { /** * “A”: an asynchronous operation mode is requested. */ diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureFormatsEnum.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureFormats.kt similarity index 100% rename from rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureFormatsEnum.kt rename to rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureFormats.kt diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureQualifierEnum.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureQualifier.kt similarity index 93% rename from rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureQualifierEnum.kt rename to rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureQualifier.kt index bc02494a..fd733a96 100644 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureQualifierEnum.kt +++ b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignatureQualifier.kt @@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable @Suppress("unused") @Serializable -enum class SignatureQualifierEnum { +enum class SignatureQualifier { @SerialName("eu_eidas_qes") EU_EIDAS_QES, diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignedEnvelopePropertyEnum.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignedEnvelopeProperty.kt similarity index 100% rename from rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignedEnvelopePropertyEnum.kt rename to rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/enums/SignedEnvelopeProperty.kt diff --git a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/serializers/AuthenticationDetailsSerializer.kt b/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/serializers/AuthenticationDetailsSerializer.kt deleted file mode 100644 index b4c5d371..00000000 --- a/rqes-data-classes/src/commonMain/kotlin/at/asitplus/rqes/serializers/AuthenticationDetailsSerializer.kt +++ /dev/null @@ -1,20 +0,0 @@ -package at.asitplus.rqes.serializers - -import CscAuthorizationDetails -import at.asitplus.openid.AuthorizationDetails -import at.asitplus.openid.OpenIdAuthorizationDetails -import kotlinx.serialization.DeserializationStrategy -import kotlinx.serialization.json.JsonContentPolymorphicSerializer -import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.jsonObject -// -//object AuthorizationDetailsSerializer : -// JsonContentPolymorphicSerializer(AuthorizationDetails::class) { -// override fun selectDeserializer(element: JsonElement): DeserializationStrategy { -// val parameters = element.jsonObject -// return when { -// "documentDigests" in parameters -> CscAuthorizationDetails.serializer() -// else -> OpenIdAuthorizationDetails.serializer() -// } -// } -//} diff --git a/vck-rqes/src/commonTest/kotlin/at/asitplus/wallet/lib/rqes/RequestDataClassTests.kt b/vck-rqes/src/commonTest/kotlin/at/asitplus/wallet/lib/rqes/RequestDataClassTests.kt index e388daf3..4b54d3d7 100644 --- a/vck-rqes/src/commonTest/kotlin/at/asitplus/wallet/lib/rqes/RequestDataClassTests.kt +++ b/vck-rqes/src/commonTest/kotlin/at/asitplus/wallet/lib/rqes/RequestDataClassTests.kt @@ -5,7 +5,7 @@ import at.asitplus.rqes.SignDocParameters import at.asitplus.rqes.SignHashParameters import at.asitplus.rqes.collection_entries.CscDocumentDigest import at.asitplus.rqes.collection_entries.Document -import at.asitplus.rqes.enums.ConformanceLevelEnum +import at.asitplus.rqes.enums.ConformanceLevel import at.asitplus.rqes.enums.SignatureFormat import at.asitplus.rqes.enums.SignedEnvelopeProperty import at.asitplus.rqes.rdcJsonSerializer @@ -158,7 +158,7 @@ class AuthenticationRequestParameterFromSerializerTest : FreeSpec({ Document( document = "1234".decodeToByteArray(Base64Strict), signatureFormat = SignatureFormat.JADES, - conformanceLevel = ConformanceLevelEnum.ADESBLTA, + conformanceLevel = ConformanceLevel.ADESBLTA, signAlgoOid = X509SignatureAlgorithm.ES256.oid, signAlgoParams = null, signedProps = null, @@ -167,7 +167,7 @@ class AuthenticationRequestParameterFromSerializerTest : FreeSpec({ Document( document = "1234".decodeToByteArray(Base64Strict), signatureFormat = SignatureFormat.CADES, - conformanceLevel = ConformanceLevelEnum.ADEST, + conformanceLevel = ConformanceLevel.ADEST, signAlgoOid = X509SignatureAlgorithm.RS256.oid, signAlgoParams = null, signedProps = null, @@ -182,7 +182,7 @@ class AuthenticationRequestParameterFromSerializerTest : FreeSpec({ hashes = listOf("1234".decodeToByteArray(Base64Strict)), hashAlgorithmOid = Digest.SHA256.oid, signatureFormat = SignatureFormat.XADES, - conformanceLevel = ConformanceLevelEnum.ADESB, + conformanceLevel = ConformanceLevel.ADESB, signAlgoOid = X509SignatureAlgorithm.ES384.oid, signAlgoParams = null, signedProps = null, @@ -192,7 +192,7 @@ class AuthenticationRequestParameterFromSerializerTest : FreeSpec({ hashes = listOf("1234".decodeToByteArray(Base64Strict)), hashAlgorithmOid = null, signatureFormat = SignatureFormat.PADES, - conformanceLevel = ConformanceLevelEnum.ADESTLT, + conformanceLevel = ConformanceLevel.ADESTLT, signAlgoOid = X509SignatureAlgorithm.RS512.oid, signAlgoParams = null, signedProps = null,