Remove `SelectKeyPair` from `eth-nodes/types`
This commit is contained in:
parent
655031616c
commit
41a6502340
|
@ -90,12 +90,6 @@ func (w *gethWhisperWrapper) DeleteKeyPair(key string) bool {
|
|||
return w.whisper.DeleteKeyPair(key)
|
||||
}
|
||||
|
||||
// SelectKeyPair adds cryptographic identity, and makes sure
|
||||
// that it is the only private key known to the node.
|
||||
func (w *gethWhisperWrapper) SelectKeyPair(key *ecdsa.PrivateKey) error {
|
||||
return w.whisper.SelectKeyPair(key)
|
||||
}
|
||||
|
||||
func (w *gethWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) {
|
||||
return w.whisper.AddSymKeyDirect(key)
|
||||
}
|
||||
|
|
|
@ -178,12 +178,6 @@ func (w *nimbusWhisperWrapper) DeleteKeyPair(key string) bool {
|
|||
}).(bool)
|
||||
}
|
||||
|
||||
// SelectKeyPair adds cryptographic identity, and makes sure
|
||||
// that it is the only private key known to the node.
|
||||
func (w *nimbusWhisperWrapper) SelectKeyPair(key *ecdsa.PrivateKey) error {
|
||||
return errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (w *nimbusWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) {
|
||||
retVal := w.routineQueue.Send(func(c chan<- interface{}) {
|
||||
keyC := C.CBytes(key)
|
||||
|
|
|
@ -53,9 +53,6 @@ type Whisper interface {
|
|||
AddKeyPair(key *ecdsa.PrivateKey) (string, error)
|
||||
// DeleteKeyPair deletes the specified key if it exists.
|
||||
DeleteKeyPair(key string) bool
|
||||
// SelectKeyPair adds cryptographic identity, and makes sure
|
||||
// that it is the only private key known to the node.
|
||||
SelectKeyPair(key *ecdsa.PrivateKey) error
|
||||
AddSymKeyDirect(key []byte) (string, error)
|
||||
AddSymKeyFromPassword(password string) (string, error)
|
||||
DeleteSymKey(id string) bool
|
||||
|
|
|
@ -89,15 +89,17 @@ func TestShhExtSuite(t *testing.T) {
|
|||
type ShhExtSuite struct {
|
||||
suite.Suite
|
||||
|
||||
nodes []*node.Node
|
||||
services []*Service
|
||||
whisper []types.Whisper
|
||||
nodes []*node.Node
|
||||
services []*Service
|
||||
whisperWrapper []types.Whisper
|
||||
whisper []*whisper.Whisper
|
||||
}
|
||||
|
||||
func (s *ShhExtSuite) SetupTest() {
|
||||
s.nodes = make([]*node.Node, 2)
|
||||
s.services = make([]*Service, 2)
|
||||
s.whisper = make([]types.Whisper, 2)
|
||||
s.whisper = make([]*whisper.Whisper, 2)
|
||||
s.whisperWrapper = make([]types.Whisper, 2)
|
||||
|
||||
directory, err := ioutil.TempDir("", "status-go-testing")
|
||||
s.Require().NoError(err)
|
||||
|
@ -115,7 +117,8 @@ func (s *ShhExtSuite) SetupTest() {
|
|||
}
|
||||
stack, err := node.New(cfg)
|
||||
s.NoError(err)
|
||||
s.whisper[i] = gethbridge.NewGethWhisperWrapper(whisper.New(nil))
|
||||
s.whisper[i] = whisper.New(nil)
|
||||
s.whisperWrapper[i] = gethbridge.NewGethWhisperWrapper(s.whisper[i])
|
||||
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.NoError(err)
|
||||
|
@ -123,7 +126,7 @@ func (s *ShhExtSuite) SetupTest() {
|
|||
s.NoError(err)
|
||||
|
||||
s.NoError(stack.Register(func(n *node.ServiceContext) (node.Service, error) {
|
||||
return gethbridge.GetGethWhisperFrom(s.whisper[i]), nil
|
||||
return gethbridge.GetGethWhisperFrom(s.whisperWrapper[i]), nil
|
||||
}))
|
||||
|
||||
config := params.ShhextConfig{
|
||||
|
@ -135,7 +138,7 @@ func (s *ShhExtSuite) SetupTest() {
|
|||
}
|
||||
db, err := leveldb.Open(storage.NewMemStorage(), nil)
|
||||
s.Require().NoError(err)
|
||||
nodeWrapper := &testNodeWrapper{w: s.whisper[i]}
|
||||
nodeWrapper := &testNodeWrapper{w: s.whisperWrapper[i]}
|
||||
s.services[i] = New(nodeWrapper, nil, nil, db, config)
|
||||
|
||||
tmpdir, err := ioutil.TempDir("", "test-shhext-service")
|
||||
|
@ -170,7 +173,7 @@ func (s *ShhExtSuite) TestInitProtocol() {
|
|||
shh := gethbridge.NewGethWhisperWrapper(whisper.New(nil))
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
err = shh.SelectKeyPair(privateKey)
|
||||
err = gethbridge.GetGethWhisperFrom(shh).SelectKeyPair(privateKey)
|
||||
s.Require().NoError(err)
|
||||
|
||||
nodeWrapper := &testNodeWrapper{w: shh}
|
||||
|
@ -298,7 +301,7 @@ func (s *ShhExtSuite) TestRequestMessagesSuccess() {
|
|||
shh := gethbridge.NewGethWhisperWrapper(whisper.New(nil))
|
||||
privateKey, err := crypto.GenerateKey()
|
||||
s.Require().NoError(err)
|
||||
err = shh.SelectKeyPair(privateKey)
|
||||
err = gethbridge.GetGethWhisperFrom(shh).SelectKeyPair(privateKey)
|
||||
s.Require().NoError(err)
|
||||
aNode, err := node.New(&node.Config{
|
||||
P2P: p2p.Config{
|
||||
|
|
|
@ -90,12 +90,6 @@ func (w *gethWhisperWrapper) DeleteKeyPair(key string) bool {
|
|||
return w.whisper.DeleteKeyPair(key)
|
||||
}
|
||||
|
||||
// SelectKeyPair adds cryptographic identity, and makes sure
|
||||
// that it is the only private key known to the node.
|
||||
func (w *gethWhisperWrapper) SelectKeyPair(key *ecdsa.PrivateKey) error {
|
||||
return w.whisper.SelectKeyPair(key)
|
||||
}
|
||||
|
||||
func (w *gethWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) {
|
||||
return w.whisper.AddSymKeyDirect(key)
|
||||
}
|
||||
|
|
|
@ -53,9 +53,6 @@ type Whisper interface {
|
|||
AddKeyPair(key *ecdsa.PrivateKey) (string, error)
|
||||
// DeleteKeyPair deletes the specified key if it exists.
|
||||
DeleteKeyPair(key string) bool
|
||||
// SelectKeyPair adds cryptographic identity, and makes sure
|
||||
// that it is the only private key known to the node.
|
||||
SelectKeyPair(key *ecdsa.PrivateKey) error
|
||||
AddSymKeyDirect(key []byte) (string, error)
|
||||
AddSymKeyFromPassword(password string) (string, error)
|
||||
DeleteSymKey(id string) bool
|
||||
|
|
Loading…
Reference in New Issue