1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00
Files
kubo/core/commands/dht_test.go
Steven Allen 352ec3561c add record validation to offline routing
fixes #5115

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2018-06-25 18:14:25 -07:00

35 lines
650 B
Go

package commands
import (
"testing"
"github.com/ipfs/go-ipfs/namesys"
tu "gx/ipfs/QmPdxCaVp4jZ9RbxqZADvKH6kiCR5jHvdR5f2ycjAY6T2a/go-testutil"
ipns "gx/ipfs/Qmb7iqDPPNogT8fJeYoLavoKhnp41tpoMPJ9D5qZVYynNQ/go-ipns"
)
func TestKeyTranslation(t *testing.T) {
pid := tu.RandPeerIDFatal(t)
pkname := namesys.PkKeyForID(pid)
ipnsname := ipns.RecordKey(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 != pkname {
t.Fatal("keys didnt match!")
}
if ipnsk != ipnsname {
t.Fatal("keys didnt match!")
}
}