Skip to content

Commit

Permalink
fix: Implement test for key pair creation using mnemonics and seed fo…
Browse files Browse the repository at this point in the history
…r curve SECP256K1 (#54)
  • Loading branch information
cristianIOHK authored Apr 25, 2023
1 parent be0aa7e commit 026dc0d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.iohk.atala.prism.walletsdk.apollo

import io.iohk.atala.prism.apollo.base64.base64UrlEncoded
import io.iohk.atala.prism.apollo.derivation.MnemonicChecksumException
import io.iohk.atala.prism.apollo.derivation.MnemonicLengthException
import io.iohk.atala.prism.apollo.utils.ECConfig
Expand Down Expand Up @@ -116,4 +117,15 @@ class ApolloTests {
assertEquals(32, privateKey.value.size)
assertEquals(32, publicKey.value.size)
}

@Test
fun testCreateKeyPair_whenUsingSeedAndMnemonics_thenKeyPairIsCorrect() {
val mnemonics = arrayOf("blade", "multiply", "coil", "rare", "fox", "doll", "tongue", "please", "icon", "mind", "gesture", "moral", "old", "laugh", "symptom", "assume", "burden", "appear", "always", "oil", "ticket", "vault", "return", "height")
val seed = apollo.createSeed(mnemonics, "")

val expectedPrivateKeyBase64Url = "xURclKhT6as1Tb9vg4AJRRLPAMWb9dYTTthDvXEKjMc"

val keyPair = apollo.createKeyPair(seed, KeyCurve(Curve.SECP256K1))
assertEquals(expectedPrivateKeyBase64Url, keyPair.privateKey.value.base64UrlEncoded)
}
}

0 comments on commit 026dc0d

Please sign in to comment.