fix: need to export Encoder for test cases
This commit is contained in:
parent
e6034b9aae
commit
026a7dc10e
|
@ -95,7 +95,7 @@ func (c EncryptedCID) MarshalJSON() ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Delegate to the MarshalJSON method of the encoder
|
// Delegate to the MarshalJSON method of the Encoder
|
||||||
return json.Marshal(str)
|
return json.Marshal(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ type Encoder interface {
|
||||||
|
|
||||||
type multibaseImpl struct {
|
type multibaseImpl struct {
|
||||||
Multibase
|
Multibase
|
||||||
encoder Encoder
|
Encoder Encoder
|
||||||
}
|
}
|
||||||
|
|
||||||
type Multibase interface {
|
type Multibase interface {
|
||||||
|
@ -31,7 +31,7 @@ type Multibase interface {
|
||||||
var _ Multibase = (*multibaseImpl)(nil)
|
var _ Multibase = (*multibaseImpl)(nil)
|
||||||
|
|
||||||
func NewMultibase(encoder Encoder) Multibase {
|
func NewMultibase(encoder Encoder) Multibase {
|
||||||
return &multibaseImpl{encoder: encoder}
|
return &multibaseImpl{Encoder: encoder}
|
||||||
}
|
}
|
||||||
|
|
||||||
func MultibaseDecodeString(data string) (bytes []byte, err error) {
|
func MultibaseDecodeString(data string) (bytes []byte, err error) {
|
||||||
|
@ -52,19 +52,19 @@ func MultibaseDecodeString(data string) (bytes []byte, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *multibaseImpl) ToHex() (string, error) {
|
func (m *multibaseImpl) ToHex() (string, error) {
|
||||||
return bases.ToHex(m.encoder.ToBytes())
|
return bases.ToHex(m.Encoder.ToBytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *multibaseImpl) ToBase32() (string, error) {
|
func (m *multibaseImpl) ToBase32() (string, error) {
|
||||||
return bases.ToBase32(m.encoder.ToBytes())
|
return bases.ToBase32(m.Encoder.ToBytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *multibaseImpl) ToBase64Url() (string, error) {
|
func (m *multibaseImpl) ToBase64Url() (string, error) {
|
||||||
return bases.ToBase64Url(m.encoder.ToBytes())
|
return bases.ToBase64Url(m.Encoder.ToBytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *multibaseImpl) ToBase58() (string, error) {
|
func (m *multibaseImpl) ToBase58() (string, error) {
|
||||||
return bases.ToBase58BTC(m.encoder.ToBytes())
|
return bases.ToBase58BTC(m.Encoder.ToBytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *multibaseImpl) ToString() (string, error) {
|
func (m *multibaseImpl) ToString() (string, error) {
|
||||||
|
|
Loading…
Reference in New Issue