@@ -28,7 +28,7 @@ class Web3jAdapter(val web3j: Web3j) : Web3 {
2828
2929 class Web3jPersonal : Web3 .Personal {
3030 override fun ecRecover (dataThatWasSigned : ByteArray , signature : Web3 .Signature ): String {
31- val prefixMsgHash = attachEthereumSignedMessage(dataThatWasSigned)
31+ val prefixMsgHash = Web3 . attachEthereumSignedMessage(dataThatWasSigned)
3232 val publicKey = Sign .signedMessageToKey(prefixMsgHash,
3333 Sign .SignatureData (signature.v, signature.r, signature.s))
3434 return Keys .toChecksumAddress(Numeric .prependHexPrefix(Keys .getAddress(publicKey)))
@@ -43,7 +43,7 @@ class Web3jAdapter(val web3j: Web3j) : Web3 {
4343 * from: https://github.com/EuroHsu/TestLibrary/blob/6883528dbcddb283f14955620f042b4ea3253624/src/main/java/com/example/testlibrary/cryptos/signer.java
4444 */
4545 override fun sign (messageHash : ByteArray , privateKey : String ): Web3 .Signature {
46- val prefixMsgHash = attachEthereumSignedMessage(messageHash)
46+ val prefixMsgHash = Web3 . attachEthereumSignedMessage(messageHash)
4747 val ecKeyPair = ECKeyPair .create(Numeric .toBigInt(privateKey))
4848 val signatureData = Sign .signMessage(prefixMsgHash, ecKeyPair)
4949 return Web3 .Signature (signatureData.v,
@@ -205,11 +205,5 @@ class Web3jAdapter(val web3j: Web3j) : Web3 {
205205 Web3j .build(httpService)
206206 }
207207 }
208-
209- private fun attachEthereumSignedMessage (messageHash : ByteArray ): ByteArray? {
210- val prefix = " \u0019 Ethereum Signed Message:\n " .toByteArray(Charsets .UTF_8 )
211- val prefixSize = ByteUtils .concatenate(prefix, messageHash.size.toString().toByteArray(Charsets .UTF_8 ))
212- return ByteUtils .concatenate(prefixSize, messageHash)
213- }
214208 }
215209}
0 commit comments