Skip to content
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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ allprojects {
}

group = "org.onflow.flow"
val defaultVersion = "0.0.11"
val defaultVersion = "0.0.12"
version = System.getenv("GITHUB_REF")?.split('/')?.last() ?: defaultVersion
}

Expand Down
9 changes: 5 additions & 4 deletions flow/src/androidMain/kotlin/org/onflow/flow/crypto/Crypto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ actual object Crypto {
var publicKey = PublicKey(
publicKey = pk,
algo = algo,
hex = jsecPrivateKeyToHexString(sk, curveFieldSize)
hex = jsecPublicKeyToHexString(pk, curveFieldSize)
)

return PrivateKey(
Expand Down Expand Up @@ -136,7 +136,7 @@ actual object Crypto {
// x and y must be guaranteed to be less than curveFieldSize each at this point
xBytes.copyInto(paddedPKBytes, max(curveFieldSize - xBytes.size, 0), max(xBytes.size - curveFieldSize, 0))
yBytes.copyInto(paddedPKBytes, curveFieldSize + max(curveFieldSize - yBytes.size, 0), max(yBytes.size - curveFieldSize, 0))
(xBytes + yBytes).bytesToHex()
paddedPKBytes.bytesToHex()
} else {
throw IllegalArgumentException("PublicKey must be an ECPublicKey")
}
Expand Down Expand Up @@ -188,8 +188,9 @@ actual object Crypto {
@JvmStatic
fun formatSignature(r: BigInteger, s: BigInteger, curveOrderSize: Int): ByteArray {
val paddedSignature = ByteArray(2 * curveOrderSize)
val rBytes = r.toByteArray()
val sBytes = s.toByteArray()
// Handle BigInteger.ZERO case specifically to match RLP encoding behavior
val rBytes = if (r == BigInteger.ZERO) byteArrayOf() else r.toByteArray()
val sBytes = if (s == BigInteger.ZERO) byteArrayOf() else s.toByteArray()

// occasionally R/S bytes representation has leading zeroes, so make sure to copy them appropriately
rBytes.copyInto(
Expand Down
Loading
Loading