diff --git a/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt b/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt index ba14f6bc8a..d0ae006f95 100644 --- a/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt +++ b/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt @@ -18,10 +18,11 @@ import org.session.libsignal.utilities.Hex @RunWith(AndroidJUnit4::class) class InstrumentedTests { + val seed = + Hex.fromStringCondensed("0123456789abcdef0123456789abcdef00000000000000000000000000000000") + private val keyPair: KeyPair get() { - val seed = - Hex.fromStringCondensed("0123456789abcdef0123456789abcdef00000000000000000000000000000000") return Sodium.ed25519KeyPair(seed) } @@ -32,6 +33,19 @@ class InstrumentedTests { assertEquals("network.loki.messenger.libsession_util.test", appContext.packageName) } + @Test + fun jni_test_sodium_kp_ed_curve() { + val kp = keyPair + val curvePkBytes = Sodium.ed25519PkToCurve25519(kp.pubKey) + + val edPk = Hex.toString(kp.pubKey) + val curvePk = Hex.toString(curvePkBytes) + + assertEquals("4cb76fdc6d32278e3f83dbf608360ecc6b65727934b85d2fb86862ff98c46ab7", edPk) + assertEquals("d2ad010eeb72d72e561d9de7bd7b6989af77dcabffa03a5111a6c859ae5c3a72", curvePk) + assertEquals(kp.secretKey.take(32), seed) + } + @Test fun jni_contacts() { val contacts = Contacts.newInstance(keyPair.secretKey)