mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-22 10:57:42 +08:00
Reverts the changes that allowed small keys (ed25519 keys) to be inlined. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
35 lines
650 B
Go
35 lines
650 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ipfs/go-ipfs/namesys"
|
|
|
|
ipns "gx/ipfs/QmPrt2JqvtFcgMBmYBjtZ5jFzq6HoFXy8PTwLb2Dpm2cGf/go-ipns"
|
|
tu "gx/ipfs/QmPuhRE325DR8ChNcFtgd6F1eANCHy1oohXZPpYop4xsK6/go-testutil"
|
|
)
|
|
|
|
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!")
|
|
}
|
|
}
|