From 8c22ff1ef6839b7299e0eda2b084918264d210f6 Mon Sep 17 00:00:00 2001 From: Scott Fleckenstein Date: Wed, 14 Sep 2016 11:33:04 -0700 Subject: [PATCH 1/5] rename `request` to `authored` for easier comprehension --- .../handlers/request_handler_auth.go | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/github.com/stellar/gateway/compliance/handlers/request_handler_auth.go b/src/github.com/stellar/gateway/compliance/handlers/request_handler_auth.go index 2345e01..7f3d749 100644 --- a/src/github.com/stellar/gateway/compliance/handlers/request_handler_auth.go +++ b/src/github.com/stellar/gateway/compliance/handlers/request_handler_auth.go @@ -6,13 +6,14 @@ import ( "encoding/base64" "encoding/hex" "encoding/json" - log "github.com/Sirupsen/logrus" "io/ioutil" "net/http" "net/url" "strings" "time" + log "github.com/Sirupsen/logrus" + "github.com/stellar/gateway/db/entities" "github.com/stellar/gateway/protocols" "github.com/stellar/gateway/protocols/compliance" @@ -26,10 +27,10 @@ import ( // HandlerAuth implements authorize endpoint func (rh *RequestHandler) HandlerAuth(c web.C, w http.ResponseWriter, r *http.Request) { - request := &compliance.AuthRequest{} - request.FromRequest(r) + authreq := &compliance.AuthRequest{} + authreq.FromRequest(r) - err := request.Validate() + err := authreq.Validate() if err != nil { errorResponse := err.(*protocols.ErrorResponse) log.WithFields(errorResponse.LogData).Error(errorResponse.Error()) @@ -38,9 +39,9 @@ func (rh *RequestHandler) HandlerAuth(c web.C, w http.ResponseWriter, r *http.Re } var authData compliance.AuthData - err = json.Unmarshal([]byte(request.Data), &authData) + err = json.Unmarshal([]byte(authreq.Data), &authData) if err != nil { - errorResponse := protocols.NewInvalidParameterError("data", request.Data) + errorResponse := protocols.NewInvalidParameterError("data", authreq.Data) log.WithFields(errorResponse.LogData).Warn(errorResponse.Error()) server.Write(w, errorResponse) return @@ -61,21 +62,21 @@ func (rh *RequestHandler) HandlerAuth(c web.C, w http.ResponseWriter, r *http.Re } // Verify signature - signatureBytes, err := base64.StdEncoding.DecodeString(request.Signature) + signatureBytes, err := base64.StdEncoding.DecodeString(authreq.Signature) if err != nil { - errorResponse := protocols.NewInvalidParameterError("sig", request.Signature) + errorResponse := protocols.NewInvalidParameterError("sig", authreq.Signature) log.WithFields(errorResponse.LogData).Warn("Error decoding signature") server.Write(w, errorResponse) return } - err = rh.SignatureSignerVerifier.Verify(senderStellarToml.SigningKey, []byte(request.Data), signatureBytes) + err = rh.SignatureSignerVerifier.Verify(senderStellarToml.SigningKey, []byte(authreq.Data), signatureBytes) if err != nil { log.WithFields(log.Fields{ "signing_key": senderStellarToml.SigningKey, - "data": request.Data, - "sig": request.Signature, + "data": authreq.Data, + "sig": authreq.Signature, }).Warn("Invalid signature") - errorResponse := protocols.NewInvalidParameterError("sig", request.Signature) + errorResponse := protocols.NewInvalidParameterError("sig", authreq.Signature) server.Write(w, errorResponse) return } @@ -351,7 +352,7 @@ func (rh *RequestHandler) HandlerAuth(c web.C, w http.ResponseWriter, r *http.Re Memo: base64.StdEncoding.EncodeToString(memoBytes[:]), TransactionXdr: authData.Tx, AuthorizedAt: time.Now(), - Data: request.Data, + Data: authreq.Data, } err = rh.EntityManager.Persist(authorizedTransaction) if err != nil { From 8e38de38b4657c2d10ecda38abc7d8d6ec4ac30f Mon Sep 17 00:00:00 2001 From: Scott Fleckenstein Date: Fri, 16 Sep 2016 08:32:06 -0700 Subject: [PATCH 2/5] Fix missing column from postgres schema --- src/github.com/stellar/gateway/db/drivers/postgres/bindata.go | 4 ++-- .../db/drivers/postgres/migrations_gateway/01_init.sql | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/github.com/stellar/gateway/db/drivers/postgres/bindata.go b/src/github.com/stellar/gateway/db/drivers/postgres/bindata.go index 336d1aa..f0bc384 100644 --- a/src/github.com/stellar/gateway/db/drivers/postgres/bindata.go +++ b/src/github.com/stellar/gateway/db/drivers/postgres/bindata.go @@ -69,7 +69,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _migrations_gateway01_initSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x92\x41\x4f\xfb\x30\x0c\xc5\xef\xf9\x14\x3e\x6e\xfa\xff\x27\x01\xd2\xb8\xec\x54\x58\x90\x26\xca\x36\x4a\x7b\xd8\xa9\xca\x12\xab\x44\xb4\x49\x95\xb8\x65\x7c\x7b\x52\x24\x58\x1b\x0d\x8e\xd1\xef\xc5\xf6\x7b\xf6\x62\x01\xff\x1a\x5d\x39\x41\x08\x45\xcb\xee\x33\x9e\xe4\x1c\xf2\xe4\x2e\xe5\x90\xa1\x44\xdd\xa3\xda\x8b\x8f\x06\x0d\xc1\x8c\x01\x68\x05\x47\x5d\x79\x74\x5a\xd4\xff\xc3\xdb\xb6\x18\xfe\x6a\x6b\xca\x40\x7a\xe1\xe4\xab\x70\xb3\x9b\xe5\x72\x0e\xc5\x76\xf3\x5c\x70\xd8\xee\x72\xd8\x16\x69\x3a\x88\x5b\x67\x25\x7a\x8f\xaa\x14\x04\xa4\x1b\xf4\x24\x9a\x76\x2a\x11\x95\x36\x55\x49\xf6\x0d\xcd\xb4\xde\x58\x15\xfe\x51\xe7\x7f\xe7\xfb\x6c\xf3\x94\x64\x07\x78\xe4\x07\x98\x69\x35\x67\xf3\x15\x9b\x7a\x7b\x09\x86\x72\x27\x8c\x17\x72\x98\xfe\xdb\xdb\xd9\x58\xd4\xe2\xfa\x2a\x9a\xc0\x76\x4e\xe2\x0f\x5e\xde\x46\xb8\x3b\x36\x9a\xe8\x2f\xa7\xbe\x93\x12\x51\xc5\x92\x35\x7f\x48\x8a\xf4\x2c\xab\x51\x55\xe8\x86\xd0\x75\x58\x41\x4c\xd1\xf4\x58\x87\x1d\x94\x27\xe5\x80\xf0\x44\x93\x16\x0e\x7d\x57\xd3\x17\x9b\x44\x15\x57\xb9\x18\xd7\xf8\x32\xd6\xf6\xdd\xb0\x75\xb6\xdb\x5f\xbe\x8c\xd5\x98\x45\xc9\xae\xd8\x67\x00\x00\x00\xff\xff\x37\x1b\x93\xa7\x63\x02\x00\x00") +var _migrations_gateway01_initSql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x92\x41\x4f\xc3\x30\x0c\x85\xef\xf9\x15\x3e\x6e\x82\x49\x80\xd8\x2e\x3b\x15\x16\xa4\x89\xb2\x8d\xd2\x1e\x76\xaa\xb2\xc4\x2a\x11\x6d\x52\x25\xee\x18\xff\x9e\x0c\x09\xd6\x86\xc1\x31\xfa\x5e\x6c\x3f\x3f\x4f\x26\x70\xd1\xe8\xca\x09\x42\x28\x5a\x76\x9f\xf1\x24\xe7\x90\x27\x77\x29\x87\x0c\x25\xea\x3d\xaa\x8d\xf8\x68\xd0\x10\x8c\x18\x80\x56\xb0\xd3\x95\x47\xa7\x45\x7d\x19\xde\xb6\xc5\xf0\x57\x5b\x53\x06\xb2\x17\x4e\xbe\x0a\x37\xba\x99\x4e\xc7\x50\xac\x96\xcf\x05\x87\xd5\x3a\x87\x55\x91\xa6\x47\x71\xeb\xac\x44\xef\x51\x95\x82\x80\x74\x83\x9e\x44\xd3\x0e\x25\xa2\xd2\xa6\x2a\xc9\xbe\xa1\x19\xd6\xeb\xab\xc2\x3f\xea\xfc\xdf\x7c\x93\x2d\x9f\x92\x6c\x0b\x8f\x7c\x0b\x23\xad\xc6\x6c\x3c\x67\x43\x6f\x2f\xc1\x50\xee\x84\xf1\x42\x1e\xa7\xff\xf6\x76\x32\x46\x27\xd8\xb7\x36\xbb\xed\x75\x82\xdf\xa3\x5c\x5f\x45\x93\xda\xce\x49\xfc\xc1\xd3\x59\x84\xbb\x5d\xa3\x89\xfe\xdb\x88\xef\xa4\x44\x54\xb1\x64\xc1\x1f\x92\x22\x3d\xc9\x6a\x54\x15\xba\x63\x38\x3a\x44\x15\x53\x34\x7b\xac\x43\x56\xe5\x41\x39\x20\x3c\xd0\xa0\x85\x43\xdf\xd5\xf4\xc5\x06\x2b\x8d\xab\x9c\x5d\x6b\xff\x82\x16\xf6\xdd\xb0\x45\xb6\xde\x9c\xbf\xa0\x79\x9f\x45\x09\xcc\xd9\x67\x00\x00\x00\xff\xff\x4d\x61\x55\x6b\x8b\x02\x00\x00") func migrations_gateway01_initSqlBytes() ([]byte, error) { return bindataRead( @@ -84,7 +84,7 @@ func migrations_gateway01_initSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations_gateway/01_init.sql", size: 611, mode: os.FileMode(420), modTime: time.Unix(1472166336, 0)} + info := bindataFileInfo{name: "migrations_gateway/01_init.sql", size: 651, mode: os.FileMode(420), modTime: time.Unix(1473881382, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/src/github.com/stellar/gateway/db/drivers/postgres/migrations_gateway/01_init.sql b/src/github.com/stellar/gateway/db/drivers/postgres/migrations_gateway/01_init.sql index a342d0d..2b090ae 100644 --- a/src/github.com/stellar/gateway/db/drivers/postgres/migrations_gateway/01_init.sql +++ b/src/github.com/stellar/gateway/db/drivers/postgres/migrations_gateway/01_init.sql @@ -10,6 +10,7 @@ CREATE TABLE ReceivedPayment ( CREATE TABLE SentTransaction ( id serial, + transaction_id varchar(64) NOT NULL, status varchar(10) NOT NULL, source varchar(56) NOT NULL, submitted_at timestamp NOT NULL, From 3b916dc80b2e6910eb433eb2f15bf4e864c43307 Mon Sep 17 00:00:00 2001 From: Scott Fleckenstein Date: Mon, 3 Oct 2016 15:19:41 -0700 Subject: [PATCH 3/5] fix escaping in federation client --- .../stellar/gateway/protocols/federation/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/github.com/stellar/gateway/protocols/federation/main.go b/src/github.com/stellar/gateway/protocols/federation/main.go index cd5bf7f..1da6e05 100644 --- a/src/github.com/stellar/gateway/protocols/federation/main.go +++ b/src/github.com/stellar/gateway/protocols/federation/main.go @@ -5,6 +5,7 @@ import ( "errors" "io/ioutil" "net/http" + "net/url" "strconv" "strings" @@ -54,7 +55,11 @@ func (r *Resolver) GetDestination(federationURL, address string) (response Respo return } - resp, err := http.Get(federationURL + "?type=name&q=" + address) + qstr := url.Values{} + qstr.Add("type", "name") + qstr.Add("q", address) + + resp, err := http.Get(federationURL + "?" + qstr.Encode()) if err != nil { return } From 9e251b6c75c2170310ac79eeefa837efd7778777 Mon Sep 17 00:00:00 2001 From: Scott Fleckenstein Date: Mon, 3 Oct 2016 15:20:43 -0700 Subject: [PATCH 4/5] Use the federation memo for the "route" value in the memo protocol --- .../gateway/compliance/handlers/request_handler_send.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go b/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go index 46f81bf..5898e00 100644 --- a/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go +++ b/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go @@ -5,10 +5,10 @@ import ( "crypto/sha256" "encoding/base64" "encoding/json" - log "github.com/Sirupsen/logrus" "io/ioutil" "net/http" + log "github.com/Sirupsen/logrus" "github.com/stellar/gateway/protocols" "github.com/stellar/gateway/protocols/compliance" "github.com/stellar/gateway/protocols/memo" @@ -143,7 +143,7 @@ func (rh *RequestHandler) HandlerSend(c web.C, w http.ResponseWriter, r *http.Re memoPreimage := &memo.Memo{ Transaction: memo.Transaction{ SenderInfo: senderInfo, - Route: request.Destination, + Route: destinationObject.Memo, Extra: request.ExtraMemo, }, } @@ -182,7 +182,6 @@ func (rh *RequestHandler) HandlerSend(c web.C, w http.ResponseWriter, r *http.Re server.Write(w, protocols.InternalServerError) return } - sig, err := rh.SignatureSignerVerifier.Sign(rh.Config.Keys.SigningSeed, data) if err != nil { log.Error("Error signing authData") From af06932994363148202ca867bc7968de2b041bcb Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Tue, 4 Oct 2016 17:09:17 +0200 Subject: [PATCH 5/5] Fix tests --- .../handlers/request_handler_send_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/github.com/stellar/gateway/compliance/handlers/request_handler_send_test.go b/src/github.com/stellar/gateway/compliance/handlers/request_handler_send_test.go index 0b3238d..f894f73 100644 --- a/src/github.com/stellar/gateway/compliance/handlers/request_handler_send_test.go +++ b/src/github.com/stellar/gateway/compliance/handlers/request_handler_send_test.go @@ -126,12 +126,14 @@ func TestRequestHandlerSend(t *testing.T) { "bob*stellar.org", ).Return(federation.Response{ AccountID: "GAMVF7G4GJC4A7JMFJWLUAEIBFQD5RT3DCB5DC5TJDEKQBBACQ4JZVEE", + MemoType: "text", + Memo: "bob", }, stellartoml.StellarToml{ AuthServer: authServer, }, nil).Once() - transactionXdr := "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANGzcuG2Z4WMLeEJJfEHFImaPhGJrZklOKsbdZFw+6kIwAAAAEAAAAAAAAAAQAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAFVU0QAAAAAABlS/NwyRcB9LCpsugCICWA+xnsYg9GLs0jIqAQgFDicAAAAAAvrwgAAAAAA" - data := "{\"sender\":\"alice*stellar.org\",\"need_info\":false,\"tx\":\"" + transactionXdr + "\",\"memo\":\"{\\n \\\"transaction\\\": {\\n \\\"sender_info\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"Alice Doe\\\\\\\"}\\\",\\n \\\"route\\\": \\\"bob*stellar.org\\\",\\n \\\"extra\\\": \\\"hello world\\\",\\n \\\"note\\\": \\\"\\\"\\n },\\n \\\"operations\\\": null\\n}\"}" + transactionXdr := "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANLw6drH5OZQsQFOcJZvFBrx8zFYFlryZWs/9cwBTVH5QAAAAEAAAAAAAAAAQAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAFVU0QAAAAAABlS/NwyRcB9LCpsugCICWA+xnsYg9GLs0jIqAQgFDicAAAAAAvrwgAAAAAA" + data := "{\"sender\":\"alice*stellar.org\",\"need_info\":false,\"tx\":\"" + transactionXdr + "\",\"memo\":\"{\\n \\\"transaction\\\": {\\n \\\"sender_info\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"Alice Doe\\\\\\\"}\\\",\\n \\\"route\\\": \\\"bob\\\",\\n \\\"extra\\\": \\\"hello world\\\",\\n \\\"note\\\": \\\"\\\"\\n },\\n \\\"operations\\\": null\\n}\"}" sig := "YeMlOYWNysyGBfsAe40z9dGgpRsKSQrqFIGAEsyJQ8osnXlLPynvJ2WQDGcBq2n5AA96YZdABhQz5ymqvxfQDw==" authResponse := compliance.AuthResponse{ @@ -171,7 +173,7 @@ func TestRequestHandlerSend(t *testing.T) { "info_status": "ok", "tx_status": "ok" }, - "transaction_xdr": "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANGzcuG2Z4WMLeEJJfEHFImaPhGJrZklOKsbdZFw+6kIwAAAAEAAAAAAAAAAQAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAFVU0QAAAAAABlS/NwyRcB9LCpsugCICWA+xnsYg9GLs0jIqAQgFDicAAAAAAvrwgAAAAAA" + "transaction_xdr": "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANLw6drH5OZQsQFOcJZvFBrx8zFYFlryZWs/9cwBTVH5QAAAAEAAAAAAAAAAQAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAFVU0QAAAAAABlS/NwyRcB9LCpsugCICWA+xnsYg9GLs0jIqAQgFDicAAAAAAvrwgAAAAAA" }`) assert.Equal(t, expected, test.StringToJSONMap(responseString)) }) @@ -195,12 +197,14 @@ func TestRequestHandlerSend(t *testing.T) { "bob*stellar.org", ).Return(federation.Response{ AccountID: "GAMVF7G4GJC4A7JMFJWLUAEIBFQD5RT3DCB5DC5TJDEKQBBACQ4JZVEE", + MemoType: "text", + Memo: "bob", }, stellartoml.StellarToml{ AuthServer: authServer, }, nil).Once() - transactionXdr := "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANGzcuG2Z4WMLeEJJfEHFImaPhGJrZklOKsbdZFw+6kIwAAAAEAAAAAAAAAAgAAAAFVU0QAAAAAAEbpO2riZmlZMkHuBxUBYAAas3hWyo9VL1IOdnfXAVFBAAAAADuaygAAAAAAGVL83DJFwH0sKmy6AIgJYD7GexiD0YuzSMioBCAUOJwAAAABVVNEAAAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAAL68IAAAAAAgAAAAAAAAABRVVSAAAAAAALt4SwWfv1PIJvDRMenW0zu91YxZbphRFLA4O+gbAaigAAAAA=" - data := "{\"sender\":\"alice*stellar.org\",\"need_info\":false,\"tx\":\"" + transactionXdr + "\",\"memo\":\"{\\n \\\"transaction\\\": {\\n \\\"sender_info\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"Alice Doe\\\\\\\"}\\\",\\n \\\"route\\\": \\\"bob*stellar.org\\\",\\n \\\"extra\\\": \\\"hello world\\\",\\n \\\"note\\\": \\\"\\\"\\n },\\n \\\"operations\\\": null\\n}\"}" + transactionXdr := "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANLw6drH5OZQsQFOcJZvFBrx8zFYFlryZWs/9cwBTVH5QAAAAEAAAAAAAAAAgAAAAFVU0QAAAAAAEbpO2riZmlZMkHuBxUBYAAas3hWyo9VL1IOdnfXAVFBAAAAADuaygAAAAAAGVL83DJFwH0sKmy6AIgJYD7GexiD0YuzSMioBCAUOJwAAAABVVNEAAAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAAL68IAAAAAAgAAAAAAAAABRVVSAAAAAAALt4SwWfv1PIJvDRMenW0zu91YxZbphRFLA4O+gbAaigAAAAA=" + data := "{\"sender\":\"alice*stellar.org\",\"need_info\":false,\"tx\":\"" + transactionXdr + "\",\"memo\":\"{\\n \\\"transaction\\\": {\\n \\\"sender_info\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"Alice Doe\\\\\\\"}\\\",\\n \\\"route\\\": \\\"bob\\\",\\n \\\"extra\\\": \\\"hello world\\\",\\n \\\"note\\\": \\\"\\\"\\n },\\n \\\"operations\\\": null\\n}\"}" sig := "ACamNqa0dF8gf97URhFVKWSD7fmvZKc5At+8dCLM5ySR0HsHySF3G2WuwYP2nKjeqjKmu3U9Z3+u1P10w1KBCA==" authResponse := compliance.AuthResponse{ @@ -240,7 +244,7 @@ func TestRequestHandlerSend(t *testing.T) { "info_status": "ok", "tx_status": "ok" }, - "transaction_xdr": "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANGzcuG2Z4WMLeEJJfEHFImaPhGJrZklOKsbdZFw+6kIwAAAAEAAAAAAAAAAgAAAAFVU0QAAAAAAEbpO2riZmlZMkHuBxUBYAAas3hWyo9VL1IOdnfXAVFBAAAAADuaygAAAAAAGVL83DJFwH0sKmy6AIgJYD7GexiD0YuzSMioBCAUOJwAAAABVVNEAAAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAAL68IAAAAAAgAAAAAAAAABRVVSAAAAAAALt4SwWfv1PIJvDRMenW0zu91YxZbphRFLA4O+gbAaigAAAAA=" + "transaction_xdr": "AAAAAC3/58Z9rycNLmF6voWX9VmDETFVGhFoWf66mcMuir/DAAAAZAAAAAAAAAAAAAAAAAAAAANLw6drH5OZQsQFOcJZvFBrx8zFYFlryZWs/9cwBTVH5QAAAAEAAAAAAAAAAgAAAAFVU0QAAAAAAEbpO2riZmlZMkHuBxUBYAAas3hWyo9VL1IOdnfXAVFBAAAAADuaygAAAAAAGVL83DJFwH0sKmy6AIgJYD7GexiD0YuzSMioBCAUOJwAAAABVVNEAAAAAAAZUvzcMkXAfSwqbLoAiAlgPsZ7GIPRi7NIyKgEIBQ4nAAAAAAL68IAAAAAAgAAAAAAAAABRVVSAAAAAAALt4SwWfv1PIJvDRMenW0zu91YxZbphRFLA4O+gbAaigAAAAA=" }`) assert.Equal(t, expected, test.StringToJSONMap(responseString)) })