storj/multinode/nodes
Clement Sam 7e5025cac0 {storagenode,multinode/nodes}: use multinodeauth.Secret instead of []byte for APISecret
When enconding structs into JSON, byte slices are marshalled as base64
encoded string using the base64.StdEncoding.Encode():
ea9c3fd42d/src/encoding/json/encode.go (L833-L861)

We, however, expect API Secrets to be encoded as base64URL, so when
an marshalled secret (with byte slice type) is added to the multinode
dashboard, it fails with `illegal base64 data at input byte XX`.

This change changes the type of APISecret field in the
multinode/nodes.Nodes struct to use multinodeauth.Secret type instead
of []byte.
multinodeauth.Secret is extended with custom MarshalJSON and
UnmarshalJSON methods which implement the json.Marshaler and
json.Unmarshaler interfaces, respectively.

Resolves https://github.com/storj/storj/issues/4949

Change-Id: Ib14b5f49ceaac109620c25d7ff83be865c698343
2022-08-23 11:04:04 +00:00
..
nodes_test.go {storagenode,multinode/nodes}: use multinodeauth.Secret instead of []byte for APISecret 2022-08-23 11:04:04 +00:00
nodes.go {storagenode,multinode/nodes}: use multinodeauth.Secret instead of []byte for APISecret 2022-08-23 11:04:04 +00:00
service.go {storagenode,multinode/nodes}: use multinodeauth.Secret instead of []byte for APISecret 2022-08-23 11:04:04 +00:00