From 2cc7b1d6ae9e4886252356a268a875f2c7056eff Mon Sep 17 00:00:00 2001 From: Goncalo-FradeIOHK Date: Mon, 25 Sep 2023 09:59:07 +0100 Subject: [PATCH] fix: constructor and access to some methods were missing in ios Signed-off-by: Ahmed Moussa --- .../io/iohk/atala/prism/apollo/utils/KMMEdKeyPair.kt | 4 ++-- .../io/iohk/atala/prism/apollo/utils/KMMX25519KeyPair.kt | 4 ++-- .../iohk/atala/prism/apollo/utils/KMMX25519PrivateKey.kt | 7 ++----- .../iohk/atala/prism/apollo/utils/KMMX25519PublicKey.kt | 8 +------- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMEdKeyPair.kt b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMEdKeyPair.kt index b564f741f..e44be96b0 100644 --- a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMEdKeyPair.kt +++ b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMEdKeyPair.kt @@ -5,8 +5,8 @@ actual class KMMEdKeyPair actual constructor( actual val publicKey: KMMEdPublicKey ) { - actual companion object : Ed25519KeyPairGeneration { - override fun generateKeyPair(): KMMEdKeyPair { + public actual companion object : Ed25519KeyPairGeneration { + public override fun generateKeyPair(): KMMEdKeyPair { val privateKey = KMMEdPrivateKey() return KMMEdKeyPair(privateKey, privateKey.publicKey()) } diff --git a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519KeyPair.kt b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519KeyPair.kt index 4294b92c9..cf9e7dada 100644 --- a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519KeyPair.kt +++ b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519KeyPair.kt @@ -4,8 +4,8 @@ actual class KMMX25519KeyPair actual constructor( actual val privateKey: KMMX25519PrivateKey, actual val publicKey: KMMX25519PublicKey ) { - actual companion object : X25519KeyPairGeneration { - override fun generateKeyPair(): KMMX25519KeyPair { + public actual companion object : X25519KeyPairGeneration { + public override fun generateKeyPair(): KMMX25519KeyPair { val privateKey = KMMX25519PrivateKey() return KMMX25519KeyPair(privateKey, privateKey.publicKey()) } diff --git a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PrivateKey.kt b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PrivateKey.kt index 15d80badb..ea166128a 100644 --- a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PrivateKey.kt +++ b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PrivateKey.kt @@ -2,13 +2,10 @@ package io.iohk.atala.prism.apollo.utils import swift.cryptoKit.X25519 -actual class KMMX25519PrivateKey { - public val raw: ByteArray +actual class KMMX25519PrivateKey(val raw: ByteArray) { @Throws(RuntimeException::class) - constructor() { - this.raw = X25519.createPrivateKey().success()?.toByteArray() ?: throw RuntimeException("Null result") - } + public constructor() : this(X25519.createPrivateKey().success()?.toByteArray() ?: throw RuntimeException("Null result")) @Throws(RuntimeException::class) public fun publicKey(): KMMX25519PublicKey { diff --git a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PublicKey.kt b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PublicKey.kt index 628fa15b1..34d1de8e3 100644 --- a/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PublicKey.kt +++ b/base-asymmetric-encryption/src/iosMain/kotlin/io/iohk/atala/prism/apollo/utils/KMMX25519PublicKey.kt @@ -1,9 +1,3 @@ package io.iohk.atala.prism.apollo.utils -actual class KMMX25519PublicKey { - public val raw: ByteArray - - constructor(raw: ByteArray) { - this.raw = raw - } -} +actual class KMMX25519PublicKey(val raw: ByteArray = ByteArray(0))