diff --git a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/castor/DIDCreateTest.kt b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/castor/DIDCreateTest.kt index 74c0195bc..f3028d25d 100644 --- a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/castor/DIDCreateTest.kt +++ b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/castor/DIDCreateTest.kt @@ -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 @@ -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 @@ -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 = 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()) } @@ -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()) }