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

Rebuild comm package #60

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Rebuild comm package #60

wants to merge 3 commits into from

Conversation

ftheirs
Copy link
Collaborator

@ftheirs ftheirs commented Dec 20, 2023

HDPath changed to string
The user can select which elements are hardened. The previous implementation used an array and the hardening was hidden from the user.

  • Previous: path := []uint32{44, 118, 0, 0, 21}
  • New: path := "m/44'/118'/0'/0/21"

Removed all legacy v1 and v2 functions

  • GetVersion
  • GetAddressAndPubKey
  • sign

Sign function will require

  • HRP (compatibility with EVM chains: Injective, Evmos)
  • Transaction type (SignModeAmino / SignModeTextual)

Encapsulation from responses in structures

  • VersionResponse
  • AddressResponse
  • SignatureResponse

Fixed issues
#52
#53
#54

Copy link

@raynaudoe raynaudoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a few nits!

common.go Outdated Show resolved Hide resolved
common.go Show resolved Hide resolved
common.go Outdated
// Validate HRP: Max length = 83
// All characters must be in range [33, 126], displayable chars in Ledger devices
func serializeHRP(hrp string) (hrpBytes []byte, err error) {
if len(hrp) > 83 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using magic numbers if possible, for example here you could create a constants.go file and add something like:

const (
HRP_MAX_LENGTH = 83
// all other constant values
)

common.go Show resolved Hide resolved
common.go Outdated
return nil
hrpBytes = []byte(hrp)
for _, b := range hrpBytes {
if b < 33 || b > 126 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samething here

common.go Outdated Show resolved Hide resolved
common.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants