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)
|
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) {
|
func (w *gethWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) {
|
||||||
return w.whisper.AddSymKeyDirect(key)
|
return w.whisper.AddSymKeyDirect(key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,12 +178,6 @@ func (w *nimbusWhisperWrapper) DeleteKeyPair(key string) bool {
|
||||||
}).(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) {
|
func (w *nimbusWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) {
|
||||||
retVal := w.routineQueue.Send(func(c chan<- interface{}) {
|
retVal := w.routineQueue.Send(func(c chan<- interface{}) {
|
||||||
keyC := C.CBytes(key)
|
keyC := C.CBytes(key)
|
||||||
|
|
|
@ -53,9 +53,6 @@ type Whisper interface {
|
||||||
AddKeyPair(key *ecdsa.PrivateKey) (string, error)
|
AddKeyPair(key *ecdsa.PrivateKey) (string, error)
|
||||||
// DeleteKeyPair deletes the specified key if it exists.
|
// DeleteKeyPair deletes the specified key if it exists.
|
||||||
DeleteKeyPair(key string) bool
|
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)
|
AddSymKeyDirect(key []byte) (string, error)
|
||||||
AddSymKeyFromPassword(password string) (string, error)
|
AddSymKeyFromPassword(password string) (string, error)
|
||||||
DeleteSymKey(id string) bool
|
DeleteSymKey(id string) bool
|
||||||
|
|
|
@ -91,13 +91,15 @@ type ShhExtSuite struct {
|
||||||
|
|
||||||
nodes []*node.Node
|
nodes []*node.Node
|
||||||
services []*Service
|
services []*Service
|
||||||
whisper []types.Whisper
|
whisperWrapper []types.Whisper
|
||||||
|
whisper []*whisper.Whisper
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShhExtSuite) SetupTest() {
|
func (s *ShhExtSuite) SetupTest() {
|
||||||
s.nodes = make([]*node.Node, 2)
|
s.nodes = make([]*node.Node, 2)
|
||||||
s.services = make([]*Service, 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")
|
directory, err := ioutil.TempDir("", "status-go-testing")
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
@ -115,7 +117,8 @@ func (s *ShhExtSuite) SetupTest() {
|
||||||
}
|
}
|
||||||
stack, err := node.New(cfg)
|
stack, err := node.New(cfg)
|
||||||
s.NoError(err)
|
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()
|
privateKey, err := crypto.GenerateKey()
|
||||||
s.NoError(err)
|
s.NoError(err)
|
||||||
|
@ -123,7 +126,7 @@ func (s *ShhExtSuite) SetupTest() {
|
||||||
s.NoError(err)
|
s.NoError(err)
|
||||||
|
|
||||||
s.NoError(stack.Register(func(n *node.ServiceContext) (node.Service, error) {
|
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{
|
config := params.ShhextConfig{
|
||||||
|
@ -135,7 +138,7 @@ func (s *ShhExtSuite) SetupTest() {
|
||||||
}
|
}
|
||||||
db, err := leveldb.Open(storage.NewMemStorage(), nil)
|
db, err := leveldb.Open(storage.NewMemStorage(), nil)
|
||||||
s.Require().NoError(err)
|
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)
|
s.services[i] = New(nodeWrapper, nil, nil, db, config)
|
||||||
|
|
||||||
tmpdir, err := ioutil.TempDir("", "test-shhext-service")
|
tmpdir, err := ioutil.TempDir("", "test-shhext-service")
|
||||||
|
@ -170,7 +173,7 @@ func (s *ShhExtSuite) TestInitProtocol() {
|
||||||
shh := gethbridge.NewGethWhisperWrapper(whisper.New(nil))
|
shh := gethbridge.NewGethWhisperWrapper(whisper.New(nil))
|
||||||
privateKey, err := crypto.GenerateKey()
|
privateKey, err := crypto.GenerateKey()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
err = shh.SelectKeyPair(privateKey)
|
err = gethbridge.GetGethWhisperFrom(shh).SelectKeyPair(privateKey)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
nodeWrapper := &testNodeWrapper{w: shh}
|
nodeWrapper := &testNodeWrapper{w: shh}
|
||||||
|
@ -298,7 +301,7 @@ func (s *ShhExtSuite) TestRequestMessagesSuccess() {
|
||||||
shh := gethbridge.NewGethWhisperWrapper(whisper.New(nil))
|
shh := gethbridge.NewGethWhisperWrapper(whisper.New(nil))
|
||||||
privateKey, err := crypto.GenerateKey()
|
privateKey, err := crypto.GenerateKey()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
err = shh.SelectKeyPair(privateKey)
|
err = gethbridge.GetGethWhisperFrom(shh).SelectKeyPair(privateKey)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
aNode, err := node.New(&node.Config{
|
aNode, err := node.New(&node.Config{
|
||||||
P2P: p2p.Config{
|
P2P: p2p.Config{
|
||||||
|
|
|
@ -90,12 +90,6 @@ func (w *gethWhisperWrapper) DeleteKeyPair(key string) bool {
|
||||||
return w.whisper.DeleteKeyPair(key)
|
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) {
|
func (w *gethWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) {
|
||||||
return w.whisper.AddSymKeyDirect(key)
|
return w.whisper.AddSymKeyDirect(key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,6 @@ type Whisper interface {
|
||||||
AddKeyPair(key *ecdsa.PrivateKey) (string, error)
|
AddKeyPair(key *ecdsa.PrivateKey) (string, error)
|
||||||
// DeleteKeyPair deletes the specified key if it exists.
|
// DeleteKeyPair deletes the specified key if it exists.
|
||||||
DeleteKeyPair(key string) bool
|
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)
|
AddSymKeyDirect(key []byte) (string, error)
|
||||||
AddSymKeyFromPassword(password string) (string, error)
|
AddSymKeyFromPassword(password string) (string, error)
|
||||||
DeleteSymKey(id string) bool
|
DeleteSymKey(id string) bool
|
||||||
|
|
Loading…
Reference in New Issue