mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
This commit was moved from ipfs/interface-go-ipfs-core@96e9f23333 This commit was moved from ipfs/boxo@90ca296f80
20 lines
387 B
Go
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())
|
|
}
|