Added binary codec base58 as well as improving the help for --binary-codec flag (#548)

* Added binary codec `base58` as well as improving the help for `--binary-codec` flag
* Added tests for base58
* Fixed tests

Co-authored-by: Matthieu Vachon <matt@streamingfast.io>
This commit is contained in:
Matthieu Vachon
2022-01-27 23:10:01 -05:00
committed by GitHub
parent ccf901d5c7
commit 5803295174
5 changed files with 12 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ func TestSetBinaryCodec(t *testing.T) {
err error
}{
{input: CodecNone, err: nil},
{input: CodecBase58, err: nil},
{input: CodecBase64, err: nil},
{input: CodecHex, err: nil},
{input: "foobar", err: errors.New("invalid binary codec: foobar")},
@@ -37,6 +38,7 @@ func Test_encodeBinaryData(t *testing.T) {
encoding string
}{
{input: "hello world", expected: "hello world", encoding: CodecNone},
{input: "hello world", expected: "StV1DL6CwTryKyV", encoding: CodecBase58},
{input: "hello world", expected: "aGVsbG8gd29ybGQ=", encoding: CodecBase64},
{input: "hello world", expected: "68656c6c6f20776f726c64", encoding: CodecHex},
}