diff --git a/authentication.go b/authentication.go index f8316195..7ba021d3 100644 --- a/authentication.go +++ b/authentication.go @@ -1,6 +1,7 @@ package walletclient import ( + "encoding/base64" "fmt" "net/http" "time" @@ -159,7 +160,7 @@ func createSignatureCommon(payload *models.AuthPayload, bodyString string, priva return nil, err } - payload.Signature = string(sigBytes) + payload.Signature = base64.StdEncoding.EncodeToString(sigBytes) return payload, nil } diff --git a/client_options.go b/client_options.go index 2f558548..b5ef1b7a 100644 --- a/client_options.go +++ b/client_options.go @@ -1,6 +1,7 @@ package walletclient import ( + "encoding/hex" "fmt" "net/http" "net/url" @@ -101,11 +102,18 @@ func (w *signRequest) Configure(c *WalletClient) { c.signRequest = w.Sign } -// initializeAccessKey handles the specific initialization of the access key. func (w *accessKeyConf) initializeAccessKey() (*ec.PrivateKey, error) { privateKey, err := ec.PrivateKeyFromWif(w.AccessKeyString) if err != nil { - return nil, errors.Wrap(err, "failed to decode access key") + keyBytes, err := hex.DecodeString(w.AccessKeyString) + if err != nil { + return nil, errors.Wrap(err, "failed to decode access key") + } + + privateKey, _ = ec.PrivateKeyFromBytes(keyBytes) + if privateKey == nil { + return nil, errors.New("failed to decode access key") + } } return privateKey, nil