Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INVESTIGATION] Investigate ci #107

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class HDKey(
* @param index value used to derive a key
*/
fun deriveChild(index: BigIntegerWrapper): HDKey {
println("Derive Child iteration")
val index = index.value
if (chainCode == null) {
throw Exception("No chainCode set")
Expand Down Expand Up @@ -200,9 +201,13 @@ class HDKey(
const val MASTER_SECRET = "Atala Prism"

fun sha512(key: ByteArray, input: ByteArray): ByteArray {
val sha512 = HmacSHA512(key)
sha512.update(input)
return sha512.doFinal()
try {
val sha512 = HmacSHA512(key)
sha512.update(input)
return sha512.doFinal()
} catch (e: Exception) {
throw Error("Sha512 exception: ${e.message}")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,14 @@ class HDKeyTest {
val key = hdKey.getKMMSecp256k1PrivateKey()
assertNotNull(key)
}

@Test
fun testDeriveChild_whithStackOverflowFromCIConditions_then() {
val seedBase64 = "FJsDqiu6AIamix8TYsGmE2aDU6zo80NyXiQkuFQnfJ0pSQ8wxr0KfTJLJ9CKrmK9qf25VIv6iXNZM1SRgTlYUQ"
val seed = seedBase64.base64UrlDecodedBytes
val path = "m/1'/0'/0'"

val hdKey = HDKey(seed, 0, 0)
hdKey.derive(path)
}
}
Loading