mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-15 07:58:15 +08:00
32 lines
534 B
Go
32 lines
534 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ipfs/go-ipfs/namesys"
|
|
tu "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil"
|
|
)
|
|
|
|
func TestKeyTranslation(t *testing.T) {
|
|
pid := tu.RandPeerIDFatal(t)
|
|
a, b := namesys.IpnsKeysForID(pid)
|
|
|
|
pkk, err := escapeDhtKey("/pk/" + pid.Pretty())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
ipnsk, err := escapeDhtKey("/ipns/" + pid.Pretty())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if pkk != a {
|
|
t.Fatal("keys didnt match!")
|
|
}
|
|
|
|
if ipnsk != b {
|
|
t.Fatal("keys didnt match!")
|
|
}
|
|
}
|