Closed tosynthegeek closed 2 months ago
I'm fairly new to Go, would be great to put the additional improvement everywhere. Thanks for the contribution!
Sure, would do that. Just to know, do you have any idea when the new version of the code be published?
There are incorrect usage of
secp256k1
methods instead of the go-ethereum crypto package (ethCrypto
) methods in the implementation ofSecp256k1PrivateKey
andSecp256k1PublicKey
within the Aptos Go SDK here: https://github.com/aptos-labs/aptos-go-sdk/blob/main/crypto/secp256k1.goThese issues affect the correct handling of private keys and signature verification. Additionally, there are opportunities to improve the code readability and performance by addressing type assertion warnings and other minor issues.
I have identified the following problems and have a proposed solution. I will submit a pull request to address these issues.
Problem Details
File: https://github.com/aptos-labs/aptos-go-sdk/blob/main/crypto/secp256k1.go
Function:
SignMessage
Current code:
Sign
method fromsecp256k1
is used instead ofethCrypto
Function:
Verify
Current Code:
Issue: The
VerifySignature
method fromsecp256k1
is used instead ofethCrypto
.Proposed solution
SignMessage
functionVerifySignature
functionAdditional improvement
Type assertion warning: