kubo/core/coreiface/idfmt.go
Marten Seemann 46577b15b7 chore: update go-libp2p to v0.23.4
This commit was moved from ipfs/interface-go-ipfs-core@96e9f23333

This commit was moved from ipfs/boxo@90ca296f80
2022-12-09 13:46:13 +01:00

20 lines
387 B
Go

package iface
import (
"github.com/libp2p/go-libp2p/core/peer"
mbase "github.com/multiformats/go-multibase"
)
func FormatKeyID(id peer.ID) string {
if s, err := peer.ToCid(id).StringOfBase(mbase.Base36); err != nil {
panic(err)
} else {
return s
}
}
// FormatKey formats the given IPNS key in a canonical way.
func FormatKey(key Key) string {
return FormatKeyID(key.ID())
}