Skip to content

Commit

Permalink
fix java chomping leading zeros (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer authored Jan 3, 2024
1 parent e12609c commit 943314a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/src/main/java/org/xmtp/android/library/KeyUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ object KeyUtil {
val newPublicKey = ByteArray(64)
System.arraycopy(publicKey, publicKey.size - 64, newPublicKey, 0, 64)
byteArrayOf(0x4.toByte()) + newPublicKey
} else if (publicKey.size < 64) {
val newPublicKey = ByteArray(64)
System.arraycopy(publicKey, 0, newPublicKey, 64 - publicKey.size, publicKey.size)
byteArrayOf(0x4.toByte()) + newPublicKey
} else {
byteArrayOf(0x4.toByte()) + publicKey
}
Expand Down

0 comments on commit 943314a

Please sign in to comment.