Skip to content

Commit

Permalink
Add SignatureResponse classes
Browse files Browse the repository at this point in the history
  • Loading branch information
n0900 committed Nov 6, 2024
1 parent f028a66 commit 2e4557c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sealed class SignatureResponse {
val signatures: List<String>?,
@SerialName("responseID")
val responseId: String?,
): SignatureResponse()
) : SignatureResponse()

@Serializable
data class SignDocResponse(
Expand All @@ -25,6 +25,6 @@ sealed class SignatureResponse {
@SerialName("responseID")
val responseId: String?,
@SerialName("validationInfo")
val validationInfo: JsonObject?
)
val validationInfo: JsonObject?,
) : SignatureResponse()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.serialization.json.jsonObject

object SignatureResponseSerializer : JsonContentPolymorphicSerializer<SignatureResponse>(SignatureResponse::class) {
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<SignatureResponse> = when {
"DocumentWithSignature" in element.jsonObject || "SignatureObject" in element.jsonObject || "validationInfo" in element.jsonObject -> SignatureResponse.SignDocResponse.serializer() as DeserializationStrategy<SignatureResponse>
"DocumentWithSignature" in element.jsonObject || "SignatureObject" in element.jsonObject || "validationInfo" in element.jsonObject -> SignatureResponse.SignDocResponse.serializer()
else -> SignatureResponse.SignHashResponse.serializer()
}
}

0 comments on commit 2e4557c

Please sign in to comment.