| 1 | package iface |
| 2 | |
| 3 | import ( |
| 4 | "github.com/libp2p/go-libp2p/core/peer" |
| 5 | mbase "github.com/multiformats/go-multibase" |
| 6 | ) |
| 7 | |
| 8 | func FormatKeyID(id peer.ID) string { |
| 9 | if s, err := peer.ToCid(id).StringOfBase(mbase.Base36); err != nil { |
| 10 | panic(err) |
| 11 | } else { |
| 12 | return s |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | // FormatKey formats the given IPNS key in a canonical way. |
| 17 | func FormatKey(key Key) string { |
| 18 | return FormatKeyID(key.ID()) |
| 19 | } |