Skip to content

Commit

Permalink
Merge pull request #30 from theflyingcodr/enhancement/bk_envelope
Browse files Browse the repository at this point in the history
Enhancement/bk envelope
  • Loading branch information
mergify[bot] authored Aug 19, 2021
2 parents 8c5383d + 8c78345 commit 0672fda
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 79 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ todo.md
dist

# Coverage
coverage.txt
coverage.txt

/vendor
61 changes: 16 additions & 45 deletions definitions.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package minercraft

import (
"crypto/sha256"
"encoding/json"
"strings"

"github.com/bitcoinschema/go-bitcoin"
"github.com/libsv/go-bk/envelope"
)

// Miner is a configuration per miner, including connection url, auth token, etc
Expand All @@ -18,59 +16,32 @@ type Miner struct {

// JSONEnvelope is a standard response from the Merchant API requests
//
// Standard for serializing a JSON document in order to have consistency when ECDSA signing the document.
// Any changes to a document being signed and verified, however minor they may be, will cause the signature
// verification to fail since the document will be converted into a string before being
// (hashed and then) signed. With JSON documents, the format permits changes to be made without
// compromising the validity of the format (e.g. extra spaces, carriage returns, etc.).
// This type wraps the go-bk JSONEnvelope which performs validation of the
// signatures (if we have any) and will return true / false if valid.
//
// This spec describes a technique to ensure consistency of the data being signed by encapsulating the
// JSON data as a string in parent JSON object. That way, however the JSON is marshaled,
// the first element in the parent JSON, the payload, would remain the same and be
// signed/verified the way it is.
//
// Specs: https://github.com/bitcoin-sv-specs/brfc-misc/tree/master/jsonenvelope
// We wrap this so we can append some additional miner info and a validated
// helper property to indicate if the envelope is or isn't valid.
// Consumers can also independently validate the envelope.
type JSONEnvelope struct {
Miner *Miner `json:"miner"` // Custom field for our internal Miner configuration
Validated bool `json:"validated"` // Custom field if the signature has been validated
Payload string `json:"payload"`
Signature string `json:"signature"`
PublicKey string `json:"publicKey"`
Encoding string `json:"encoding"`
MimeType string `json:"mimetype"`
envelope.JSONEnvelope
}

// process will take the raw payload and process into a struct
// while also validating the signature vs payload
// process will take the raw payload bytes, unmarshall into a JSONEnvelope
// and validate the signature vs payload.
func (p *JSONEnvelope) process(miner *Miner, bodyContents []byte) error {

// Set the miner on the response
p.Miner = miner

// Unmarshal the response
var err error
if err = json.Unmarshal(bodyContents, &p); err != nil {
if err := json.Unmarshal(bodyContents, &p); err != nil {
return err
}

// Do we have a payload?
if len(p.Payload) > 0 {

// Remove all escaped slashes from payload envelope
// Also needed for signature validation since it was signed before escaping
p.Payload = strings.Replace(p.Payload, "\\", "", -1)
}

// Verify using DER format
p.Validated, err = validateSignature(p.Signature, p.PublicKey, p.Payload)
return err
}

// validateSignature will check the data against the pubkey + signature
func validateSignature(signature, pubKey, data string) (bool, error) {
// Only if we have a signature and pubkey
if len(signature) > 0 && len(pubKey) > 0 {
return bitcoin.VerifyMessageDER(sha256.Sum256([]byte(data)), pubKey, signature)
// verify JSONEnvelope
val, err := p.IsValid()
if err != nil {
return err
}
return false, nil
p.Validated = val
return nil
}
87 changes: 87 additions & 0 deletions definitions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package minercraft

import (
"encoding/json"
"testing"

"github.com/libsv/go-bk/envelope"
"github.com/stretchr/testify/assert"
)

func Test_JSONEnvelope_process(t *testing.T) {
t.Parallel()
tests := map[string]struct {
env envelope.JSONEnvelope
exp *JSONEnvelope
err error
}{
"JSONEnvelope with no sig should map correctly": {
env: envelope.JSONEnvelope{
Payload: "{\"index\":7\"}",
MimeType: "application/json",
},
exp: &JSONEnvelope{
Miner: nil,
Validated: true,
JSONEnvelope: envelope.JSONEnvelope{
Payload: "{\"index\":7\"}",
MimeType: "application/json",
},
},
err: nil,
}, "JSONEnvelope with sig should map correctly and set validated to true": {
env: envelope.JSONEnvelope{
Payload: `{\"Test\":\"abc123\",\"Name\":\"4567890\",\"Thing\":\"%$oddchars££$-\"}`,
Signature: strToPtr("3045022100b2b3000353b1acaf6e0190a44fc26b0b43830e5aa8d1232813c928d003697c010220294796e63da19d238b29f9cb17e2f31f728ef77a41bfd0f5e355f99f347ff4bf"),
PublicKey: strToPtr("0394890eeb9888e68cb953d56c598ab0aaa6789e20522cc8b937353694799d7ab1"),
Encoding: "UTF-8",
MimeType: "application/json",
},
exp: &JSONEnvelope{
Miner: nil,
Validated: true,
JSONEnvelope: envelope.JSONEnvelope{
Payload: `{\"Test\":\"abc123\",\"Name\":\"4567890\",\"Thing\":\"%$oddchars££$-\"}`,
Signature: strToPtr("3045022100b2b3000353b1acaf6e0190a44fc26b0b43830e5aa8d1232813c928d003697c010220294796e63da19d238b29f9cb17e2f31f728ef77a41bfd0f5e355f99f347ff4bf"),
PublicKey: strToPtr("0394890eeb9888e68cb953d56c598ab0aaa6789e20522cc8b937353694799d7ab1"),
Encoding: "UTF-8",
MimeType: "application/json",
},
},
err: nil,
}, "JSONEnvelope with modified payload should map correctly and set validated to false": {
env: envelope.JSONEnvelope{
Payload: `{\"Test\":\"abc124\",\"Name\":\"4567890\",\"Thing\":\"%$oddchars££$-\"}`,
Signature: strToPtr("3045022100b2b3000353b1acaf6e0190a44fc26b0b43830e5aa8d1232813c928d003697c010220294796e63da19d238b29f9cb17e2f31f728ef77a41bfd0f5e355f99f347ff4bf"),
PublicKey: strToPtr("0394890eeb9888e68cb953d56c598ab0aaa6789e20522cc8b937353694799d7ab1"),
Encoding: "UTF-8",
MimeType: "application/json",
},
exp: &JSONEnvelope{
Miner: nil,
Validated: false,
JSONEnvelope: envelope.JSONEnvelope{
Payload: `{\"Test\":\"abc124\",\"Name\":\"4567890\",\"Thing\":\"%$oddchars££$-\"}`,
Signature: strToPtr("3045022100b2b3000353b1acaf6e0190a44fc26b0b43830e5aa8d1232813c928d003697c010220294796e63da19d238b29f9cb17e2f31f728ef77a41bfd0f5e355f99f347ff4bf"),
PublicKey: strToPtr("0394890eeb9888e68cb953d56c598ab0aaa6789e20522cc8b937353694799d7ab1"),
Encoding: "UTF-8",
MimeType: "application/json",
},
},
err: nil,
},
}
for name, test := range tests {
t.Run(name, func(t *testing.T) {
bb, err := json.Marshal(test.env)
assert.NoError(t, err)
env := &JSONEnvelope{}
assert.NoError(t, env.process(nil, bb))
assert.Equal(t, test.exp, env)
})
}
}

func strToPtr(s string) *string {
return &s
}
4 changes: 2 additions & 2 deletions fee_quote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ func TestClient_FeeQuote(t *testing.T) {

// Check returned values
assert.Equal(t, true, response.Validated)
assert.Equal(t, feeTestSignature, response.Signature)
assert.Equal(t, feeTestPublicKey, response.PublicKey)
assert.Equal(t, feeTestSignature, *response.Signature)
assert.Equal(t, feeTestPublicKey, *response.PublicKey)
assert.Equal(t, testEncoding, response.Encoding)
assert.Equal(t, testMimeType, response.MimeType)
})
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ module github.com/tonicpow/go-minercraft
go 1.15

require (
github.com/bitcoinschema/go-bitcoin v0.3.18
github.com/bitcoinschema/go-bitcoin v0.3.17 // indirect
github.com/gojektech/heimdall/v6 v6.1.0
github.com/gojektech/valkyrie v0.0.0-20190210220504-8f62c1e7ba45 // indirect
github.com/libsv/go-bt v1.0.0
github.com/libsv/go-bk v0.1.3
github.com/libsv/go-bt v1.0.0-beta
github.com/pkg/errors v0.9.1 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.7.0
go.uber.org/goleak v1.1.10
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
36 changes: 13 additions & 23 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/DataDog/datadog-go v3.7.1+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/afex/hystrix-go v0.0.0-20180209013831-27fae8d30f1a/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/bitcoinschema/go-bitcoin v0.3.18 h1:yZUm+Qen29bcyREdCIdb4I2Mj/zsJRvDZPex95VwHlo=
github.com/bitcoinschema/go-bitcoin v0.3.18/go.mod h1:qugS0wUE6RKcO05lKnmSyfSwhDbuhztgh3i3UetadDs=
github.com/bitcoinschema/go-bitcoin v0.3.17 h1:zyByOoInoqTxypToiND4xmx8itGcU801m9xrJ5nYd9I=
github.com/bitcoinschema/go-bitcoin v0.3.17/go.mod h1:3XL+F4hXuiJjpdIn/KpruivmfyRDOfexsx3coXexymg=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 h1:2yTIV9u7H0BhRDGXH5xrAwAz7XibWJtX2dNezMeNsUo=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173/go.mod h1:BZ1UcC9+tmcDEcdVXgpt13hMczwJxWzpAn68wNs7zRA=
github.com/bitcoinsv/bsvlog v0.0.0-20181216181007-cb81b076bf2e h1:6f+gRvaPE/4h0g39dqTNPr9/P4mikw0aB+dhiExaWN8=
Expand All @@ -19,13 +19,13 @@ github.com/gojektech/valkyrie v0.0.0-20190210220504-8f62c1e7ba45 h1:MO2DsGCZz8ph
github.com/gojektech/valkyrie v0.0.0-20190210220504-8f62c1e7ba45/go.mod h1:tDYRk1s5Pms6XJjj5m2PxAzmQvaDU8GqDf1u6x7yxKw=
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/libsv/go-bt v1.0.0 h1:Ss08pxPwLP6ztm15QEyjLFLX372Z6OKHS5bsqO6PiIs=
github.com/libsv/go-bt v1.0.0/go.mod h1:AfXoLFYEbY/TvCq/84xTce2xGjPUuC5imokHmcykF2k=
github.com/libsv/go-bk v0.1.3 h1:yhcoB9mOHReM1CeeGEPHpeQH5O2YpSHdpeSfKn6qaxs=
github.com/libsv/go-bk v0.1.3/go.mod h1:xbDkeFFpP0uyFaPLnP6TwaLpAsHaslZ0LftTdWlB6HI=
github.com/libsv/go-bt v1.0.0-beta h1:Sh/ACr0y/uTI41qS+3yo9jMl5VUDIa+euWdk33c4OJg=
github.com/libsv/go-bt v1.0.0-beta/go.mod h1:AfXoLFYEbY/TvCq/84xTce2xGjPUuC5imokHmcykF2k=
github.com/mattn/goveralls v0.0.6/go.mod h1:h8b4ow6FxSPMQHF6o2ve3qsclnffZjYTNEKmLesRwqw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand All @@ -45,38 +45,31 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand All @@ -88,16 +81,13 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200530233709-52effbd89c51 h1:Wec8/IO8hAraBf0it7/dPQYOslIrgM938wZYNkLnOYc=
golang.org/x/tools v0.0.0-20200530233709-52effbd89c51/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
4 changes: 2 additions & 2 deletions query_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func TestClient_QueryTransaction(t *testing.T) {

// Check returned values
assert.Equal(t, true, response.Validated)
assert.Equal(t, queryTestSignature, response.Signature)
assert.Equal(t, queryTestPublicKey, response.PublicKey)
assert.Equal(t, queryTestSignature, *response.Signature)
assert.Equal(t, queryTestPublicKey, *response.PublicKey)
assert.Equal(t, testEncoding, response.Encoding)
assert.Equal(t, testMimeType, response.MimeType)
})
Expand Down
4 changes: 2 additions & 2 deletions submit_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func TestClient_SubmitTransaction(t *testing.T) {

// Check returned values
assert.Equal(t, true, response.Validated)
assert.Equal(t, submitTestSignature, response.Signature)
assert.Equal(t, submitTestPublicKey, response.PublicKey)
assert.Equal(t, submitTestSignature, *response.Signature)
assert.Equal(t, submitTestPublicKey, *response.PublicKey)
assert.Equal(t, testEncoding, response.Encoding)
assert.Equal(t, testMimeType, response.MimeType)
})
Expand Down

0 comments on commit 0672fda

Please sign in to comment.