Skip to content

Commit

Permalink
chore(BUX-190): refactor PublicKey struct
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed Dec 20, 2023
1 parent 48bd587 commit 8d495cf
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions xpriv/xpriv.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ type Keys struct {
}

// PublicKey is a struct containing public key information
type PublicKey struct {
Xpub string
}
type PublicKey string

// Key represents basic key methods
type Key interface {
Expand Down Expand Up @@ -54,7 +52,7 @@ func (k *Keys) Mnemonic() string {

// String return hierarchical deterministic publick ey
func (k PublicKey) String() string {
return k.Xpub
return string(k)
}

// Generate generates a random set of keys - xpriv, xpb and mnemonic
Expand All @@ -77,7 +75,7 @@ func Generate() (KeyWithMnemonic, error) {

keys := &Keys{
xpriv: hdXpriv.String(),
xpub: PublicKey{hdXpub.String()},
xpub: PublicKey(hdXpub.String()),
mnemonic: mnemonic,
}

Expand All @@ -98,7 +96,7 @@ func FromMnemonic(mnemonic string) (KeyWithMnemonic, error) {

keys := &Keys{
xpriv: hdXpriv.String(),
xpub: PublicKey{hdXpub.String()},
xpub: PublicKey(hdXpub.String()),
mnemonic: mnemonic,
}

Expand All @@ -119,7 +117,7 @@ func FromString(xpriv string) (Key, error) {

keys := &Keys{
xpriv: hdXpriv.String(),
xpub: PublicKey{hdXpub.String()},
xpub: PublicKey(hdXpub.String()),
}

return keys, nil
Expand Down

0 comments on commit 8d495cf

Please sign in to comment.