Skip to content

Commit

Permalink
chore(BUX-190): replace String method with XPriv
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed Dec 20, 2023
1 parent 11b82d8 commit 491976b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/graphql/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {

// Create a client
buxClient, err := buxclient.New(
buxclient.WithXPriv(keys.XPub().String()),
buxclient.WithXPriv(keys.XPriv()),
buxclient.WithGraphQL("localhost:3001"),
buxclient.WithDebugging(true),
buxclient.WithSignRequest(true),
Expand Down
2 changes: 1 addition & 1 deletion examples/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {

// Create a client
buxClient, err := buxclient.New(
buxclient.WithXPriv(keys.String()),
buxclient.WithXPriv(keys.XPriv()),
buxclient.WithHTTP("localhost:3001"),
buxclient.WithDebugging(true),
buxclient.WithSignRequest(true),
Expand Down
8 changes: 4 additions & 4 deletions examples/keys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func main() {
}

fmt.Println("<-- Generate method")
fmt.Println("XPriv: ", keys.String())
fmt.Println("XPriv: ", keys.XPriv())
fmt.Println("XPub: ", keys.XPub().String())
fmt.Println("Mnemonic: ", keys.Mnemonic())

Expand All @@ -24,18 +24,18 @@ func main() {
}

fmt.Println("<-- FromMnemonic method")
fmt.Println("XPriv: ", xpriv3.String())
fmt.Println("XPriv: ", xpriv3.XPriv())
fmt.Println("XPub: ", xpriv3.XPub().String())
fmt.Println("Mnemonic: ", xpriv3.Mnemonic())

//Generate keys from string
xpriv2, err := xpriv.FromString(keys.String())
xpriv2, err := xpriv.FromString(keys.XPriv())
if err != nil {
panic(err)
}

fmt.Println("<-- FromString method")
fmt.Println("XPriv: ", xpriv2.String())
fmt.Println("XPriv: ", xpriv2.XPriv())
fmt.Println("XPub: ", xpriv2.XPub().String())
fmt.Println("Can not get mnemonic from keys generated from string")
}
2 changes: 1 addition & 1 deletion examples/new_paymail/new_paymail.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {

// Create a client
buxClient, err := buxclient.New(
buxclient.WithXPriv(keys.String()),
buxclient.WithXPriv(keys.XPriv()),
buxclient.WithHTTP("localhost:3001"),
buxclient.WithDebugging(true),
buxclient.WithSignRequest(true),
Expand Down
2 changes: 1 addition & 1 deletion examples/register_xpub/register_xpub.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {

// Create a client
buxClient, err := buxclient.New(
buxclient.WithXPriv(keys.String()),
buxclient.WithXPriv(keys.XPriv()),
buxclient.WithHTTP("localhost:3001"),
buxclient.WithDebugging(true),
buxclient.WithSignRequest(true),
Expand Down
6 changes: 3 additions & 3 deletions xpriv/xpriv.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type PublicKey struct {

// Key represents basic key methods
type Key interface {
String() string
XPriv() string
XPub() PubKey
}

Expand All @@ -42,8 +42,8 @@ func (k *Keys) XPub() PubKey {
return k.xpub
}

// String return hierarchical deterministic private key
func (k *Keys) String() string {
// XPriv return hierarchical deterministic private key
func (k *Keys) XPriv() string {
return k.xpriv
}

Expand Down

0 comments on commit 491976b

Please sign in to comment.