Skip to content

Commit

Permalink
fix: linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianIOHK committed Apr 11, 2024
1 parent d0e6249 commit 0c3e6b3
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,4 @@ constructor(
override val code: Int
get() = 59
}



}
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package io.iohk.atala.prism.walletsdk.domain.models

import io.iohk.atala.prism.walletsdk.domain.VC
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.jsonPrimitive

interface JWTPayload {
val iss: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
package io.iohk.atala.prism.walletsdk.domain.models

import kotlinx.serialization.Contextual
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.MissingFieldException
import kotlinx.serialization.Polymorphic
import kotlinx.serialization.PolymorphicSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.builtins.ArraySerializer
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.StructureKind
import kotlinx.serialization.descriptors.buildClassSerialDescriptor
import kotlinx.serialization.descriptors.buildSerialDescriptor
import kotlinx.serialization.descriptors.element
import kotlinx.serialization.encodeToString
import kotlinx.serialization.encoding.CompositeDecoder
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.encoding.encodeStructure
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import java.security.spec.ECParameterSpec
import java.security.spec.ECPoint
import java.security.spec.ECPrivateKeySpec
import java.security.spec.ECPublicKeySpec
import java.util.UUID
import java.util.*
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.encodeToJsonElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,19 @@ import io.iohk.atala.prism.walletsdk.domain.models.JWTPayload
import io.iohk.atala.prism.walletsdk.domain.models.JWTVerifiableCredential
import io.iohk.atala.prism.walletsdk.domain.models.JWTVerifiablePresentation
import io.iohk.atala.prism.walletsdk.domain.models.StorableCredential
import io.iohk.atala.prism.walletsdk.prismagent.PROTOCOL_TYPE
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import kotlinx.serialization.builtins.ArraySerializer
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encodeToString
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.decodeFromJsonElement
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.StructureKind
import kotlinx.serialization.descriptors.listSerialDescriptor
import kotlinx.serialization.encoding.encodeCollection
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonTransformingSerializer
import kotlinx.serialization.json.decodeFromJsonElement
import kotlinx.serialization.json.encodeToJsonElement
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class InputFieldFilterTest {
assertContentEquals(model.const, inputFieldFilter.const)
assertEquals(model.value, inputFieldFilter.value)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -313,8 +311,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(wrongIssuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -355,8 +351,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val wrongHolderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(wrongHolderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -395,8 +389,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -435,8 +427,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -475,8 +465,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -519,8 +507,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -559,8 +545,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -599,8 +583,6 @@ class PolluxImplTest {
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))
val holderKeyPair =
Secp256k1KeyPair.generateKeyPair(Seed(MnemonicHelper.createRandomSeed()), KeyCurve(Curve.SECP256K1))


val issuerDID = castor.createPrismDID(issuerKeyPair.publicKey, emptyArray())
val holderDID = castor.createPrismDID(holderKeyPair.publicKey, emptyArray())

Expand Down Expand Up @@ -629,15 +611,6 @@ class PolluxImplTest {
assertTrue(isVerified)
}

// class General {
// @Test
// fun test() {
// val model = InputFieldFilter("number", enum = listOf())
// val json = Json.encodeToString(model)
// println()
// }
// }

private fun generateSecp256k1KeyPair(): Secp256k1KeyPair {
val mnemonics = listOf(
"blade",
Expand Down Expand Up @@ -677,8 +650,6 @@ class PolluxImplTest {
val expirationDate = nextMonthDate.timeInMillis
val sdf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault())
sdf.timeZone = TimeZone.getTimeZone("UTC")


val jwsHeader = JWSHeader.Builder(JWSAlgorithm.ES256K).build()
val json = Json {
ignoreUnknownKeys = true
Expand Down Expand Up @@ -744,9 +715,6 @@ class PolluxImplTest {
}

data class VerificationTestCase(
// val apollo: Apollo,
// val castor: Castor,
// val pollux: Pollux,
val issuer: DID,
val holder: DID,
val holderPrv: PrivateKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CredentialsAdapter(private var data: MutableList<Credential> = mutableList
val jwt = cred as JWTCredential
type.text = String.format(typeString, "JWT")
// TODO: Check what else to display
jwt.jwtPayload.nbf?.let {
jwt.nbf?.let {
issuanceDate.text = formatTimeStamp(Instant.ofEpochMilli(it * 1000))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ class MessagesViewModel(application: Application) : AndroidViewModel(application
type = CredentialType.JWT,
toDID = DID(toDID),
presentationClaims = PresentationClaims(
claims = mapOf("$.issuer" to InputFieldFilter(
type = "string",
value = StringPredicate("did:prism:b0bde43c0f749705c34e1c1e1b70647068a80a861de14f73b73b03cd1fa472ca:CnoKeBI5CgVrZXktMRACSi4KCXNlY3AyNTZrMRIhA_HT0IOH-l7M5PdHtYXtEMs80xSnwZ8vnGwtSCvBTZYYEjsKB21hc3RlcjAQAUouCglzZWNwMjU2azESIQMxGlCcLnODDcnw9W2949Y5yDyMr2KxPqiKnN1-khXQwQ")
)),
claims = mapOf(
"$.issuer" to InputFieldFilter(
type = "string",
value = StringPredicate("did:prism:b0bde43c0f749705c34e1c1e1b70647068a80a861de14f73b73b03cd1fa472ca:CnoKeBI5CgVrZXktMRACSi4KCXNlY3AyNTZrMRIhA_HT0IOH-l7M5PdHtYXtEMs80xSnwZ8vnGwtSCvBTZYYEjsKB21hc3RlcjAQAUouCglzZWNwMjU2azESIQMxGlCcLnODDcnw9W2949Y5yDyMr2KxPqiKnN1-khXQwQ")
)
),
issuer = "did:prism:b0bde43c0f749705c34e1c1e1b70647068a80a861de14f73b73b03cd1fa472ca:CnoKeBI5CgVrZXktMRACSi4KCXNlY3AyNTZrMRIhA_HT0IOH-l7M5PdHtYXtEMs80xSnwZ8vnGwtSCvBTZYYEjsKB21hc3RlcjAQAUouCglzZWNwMjU2azESIQMxGlCcLnODDcnw9W2949Y5yDyMr2KxPqiKnN1-khXQwQ"
),
domain = "domain",
Expand Down

0 comments on commit 0c3e6b3

Please sign in to comment.