Skip to content

Commit

Permalink
fix: remove unused imports to fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianIOHK committed Feb 26, 2024
1 parent 236f375 commit f8a1286
Showing 1 changed file with 148 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package io.iohk.atala.prism.walletsdk.castor

import io.iohk.atala.prism.apollo.base64.base64UrlDecodedBytes
import io.iohk.atala.prism.walletsdk.apollo.ApolloImpl
import io.iohk.atala.prism.walletsdk.apollo.helpers.BytesOps
import io.iohk.atala.prism.walletsdk.apollo.utils.Ed25519KeyPair
import io.iohk.atala.prism.walletsdk.apollo.utils.Ed25519PrivateKey
import io.iohk.atala.prism.walletsdk.apollo.utils.Ed25519PublicKey
import io.iohk.atala.prism.walletsdk.apollo.utils.Secp256k1PrivateKey
import io.iohk.atala.prism.walletsdk.apollo.utils.X25519KeyPair
import io.iohk.atala.prism.walletsdk.apollo.utils.X25519PrivateKey
import io.iohk.atala.prism.walletsdk.apollo.utils.X25519PublicKey
Expand All @@ -17,7 +15,6 @@ import io.iohk.atala.prism.walletsdk.domain.models.keyManagement.CurveKey
import io.iohk.atala.prism.walletsdk.domain.models.keyManagement.KeyPair
import io.iohk.atala.prism.walletsdk.domain.models.keyManagement.KeyTypes
import io.iohk.atala.prism.walletsdk.domain.models.keyManagement.RawKey
import io.iohk.atala.prism.walletsdk.domain.models.keyManagement.SeedKey
import io.iohk.atala.prism.walletsdk.domain.models.keyManagement.TypeKey
import io.iohk.atala.prism.walletsdk.prismagent.DIDCOMM_MESSAGING
import kotlinx.coroutines.ExperimentalCoroutinesApi
Expand All @@ -32,20 +29,161 @@ class DIDCreateTest {
@Test
fun it_should_create_peerDID_correctly() = runTest {
val keyAgreementKeyPair = X25519KeyPair(
X25519PrivateKey(byteArrayOf(-24, 18, -94, -98, 106, 49, -55, -55, -6, -66, 75, 73, -120, -96, 33, 28, -55, -109, 105, -67, 9, 28, 88, -98, 43, -4, -6, 75, 65, -68, 112, 92)),
X25519PublicKey(byteArrayOf(-16, 16, 107, -82, -125, 83, 101, -94, -103, -112, 47, 117, -90, -100, 64, 77, 62, -4, 11, 101, -53, -64, -2, -77, -106, -16, -63, -54, -42, -59, 80, 23))
X25519PrivateKey(
byteArrayOf(
-24,
18,
-94,
-98,
106,
49,
-55,
-55,
-6,
-66,
75,
73,
-120,
-96,
33,
28,
-55,
-109,
105,
-67,
9,
28,
88,
-98,
43,
-4,
-6,
75,
65,
-68,
112,
92
)
),
X25519PublicKey(
byteArrayOf(
-16,
16,
107,
-82,
-125,
83,
101,
-94,
-103,
-112,
47,
117,
-90,
-100,
64,
77,
62,
-4,
11,
101,
-53,
-64,
-2,
-77,
-106,
-16,
-63,
-54,
-42,
-59,
80,
23
)
)
)

val authenticationKeyPair = Ed25519KeyPair(
Ed25519PrivateKey(byteArrayOf(-68, 7, 65, -41, -60, -42, -9, 55, -113, -80, -86, -106, -40, 97, 81, -13, -22, -124, -58, -39, -64, -126, 75, 88, 126, 39, 51, -52, 121, -64, -5, 35)),
Ed25519PublicKey(byteArrayOf(-8, 10, 34, 65, -42, -19, -92, 1, -48, -59, -10, -99, -8, -88, -32, 119, 50, -15, -93, 56, -121, -51, 78, -93, 42, -86, -37, 20, 34, -94, 108, -68))
Ed25519PrivateKey(
byteArrayOf(
-68,
7,
65,
-41,
-60,
-42,
-9,
55,
-113,
-80,
-86,
-106,
-40,
97,
81,
-13,
-22,
-124,
-58,
-39,
-64,
-126,
75,
88,
126,
39,
51,
-52,
121,
-64,
-5,
35
)
),
Ed25519PublicKey(
byteArrayOf(
-8,
10,
34,
65,
-42,
-19,
-92,
1,
-48,
-59,
-10,
-99,
-8,
-88,
-32,
119,
50,
-15,
-93,
56,
-121,
-51,
78,
-93,
42,
-86,
-37,
20,
34,
-94,
108,
-68
)
)
)

val keyPairs: Array<KeyPair> = arrayOf(keyAgreementKeyPair, authenticationKeyPair)

val castor = CastorImpl(ApolloMock())
val did = castor.createPeerDID(keyPairs, emptyArray())
val validPeerDID = "did:peer:2.Ez6LSsqHXypzFPGA7RdCu2NHUf2cK8dAW1AdHa5JDCRnXQ2yk.Vz6Mkw9W7jaqZ7hF5bSKeSpnqNxhFTiVMy3aBZjyEhrMxUQAF"
val validPeerDID =
"did:peer:2.Ez6LSsqHXypzFPGA7RdCu2NHUf2cK8dAW1AdHa5JDCRnXQ2yk.Vz6Mkw9W7jaqZ7hF5bSKeSpnqNxhFTiVMy3aBZjyEhrMxUQAF"
assertEquals(validPeerDID, did.toString())
}

Expand Down Expand Up @@ -87,7 +225,8 @@ class DIDCreateTest {

val castor = CastorImpl(apollo)
val did = castor.createPeerDID(keyPairs, arrayOf(service))
val expectedPeerDID = "did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vZW5kcG9pbnQiLCJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5Il0sImEiOltdfX0"
val expectedPeerDID =
"did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vZW5kcG9pbnQiLCJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5Il0sImEiOltdfX0"
assertEquals(expectedPeerDID, did.toString())
}

Expand Down

0 comments on commit f8a1286

Please sign in to comment.