feat: add MultihashFromBytes
This commit is contained in:
parent
c95a953ca2
commit
5a6c322524
|
@ -41,6 +41,10 @@ func (m *Multihash) HashBytes() []byte {
|
||||||
return m.fullBytes[1:]
|
return m.fullBytes[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MultihashFromBytes(bytes []byte, kind types.HashType) *Multihash {
|
||||||
|
return NewMultihash(append([]byte{byte(kind)}, bytes...))
|
||||||
|
}
|
||||||
|
|
||||||
func MultihashFromBase64Url(hash string) (*Multihash, error) {
|
func MultihashFromBase64Url(hash string) (*Multihash, error) {
|
||||||
encoder, _ := multibase.EncoderByName("base64url")
|
encoder, _ := multibase.EncoderByName("base64url")
|
||||||
encoding, err := getEncoding(hash)
|
encoding, err := getEncoding(hash)
|
||||||
|
|
Loading…
Reference in New Issue