Skip to content

Commit

Permalink
update wasm copy dir and add basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
curtis-h committed Apr 30, 2024
1 parent ede1d3c commit ff54776
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apollo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ val buildEd25519Bip32Wrapper by tasks.register<Exec>("buildEd25519Bip32Wrapper")
val copyEd25519Bip32Wasm = createCopyTask(
"copyEd25519Bip32GeneratedWasm",
ed25519bip32Dir.resolve("wasm").resolve("build"),
projectDir.resolve("build").resolve("js").resolve("packages").resolve("Apollo").resolve("kotlin")
rootDir.resolve("build").resolve("js").resolve("packages").resolve("Apollo").resolve("kotlin")
)
copyEd25519Bip32Wasm.configure {
mustRunAfter(buildEd25519Bip32Wasm)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.iohk.atala.prism.apollo.derivation

import io.iohk.atala.prism.apollo.utils.decodeHex
import io.iohk.atala.prism.apollo.utils.toHexString
import kotlin.test.Test
import kotlin.test.assertEquals

class EdHDKeyTest {
@Test
fun test_derive_m1() {
val privateKey = "f8a29231ee38d6c5bf715d5bac21c750577aa3798b22d79d65bf97d6fadea15adcd1ee1abdf78bd4be64731a12deb94d3671784112eb6f364b871851fd1c9a24".decodeHex()
val chainCode = "7384db9ad6003bbd08b3b1ddc0d07a597293ff85e961bf252b331262eddfad0d".decodeHex()

val key = EdHDKey(privateKey, chainCode)
val derived = key.derive("m/1'")

assertEquals(derived.privateKey.toHexString(), "4057eb6cab9000e3b6fe7e556341da1ca2f5dde0b689a7b58cb93f1902dfa15a5a10732ff348051c6e0865c62931d4a73fa8050b8ff543b43fc0000a7e2c5700")
assertEquals(derived.chainCode.toHexString(), "9a170f689c8b9b3502ee846f457ab3dd1b017cfb2cd68865c7f24dbabcbc2256")
}
}

0 comments on commit ff54776

Please sign in to comment.