Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

pss: Distill whisper elements in pss to a custom fallback crypto #1731

Merged
merged 13 commits into from
Sep 12, 2019
4 changes: 2 additions & 2 deletions pss/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ func (pssapi *API) BaseAddr() (PssAddress, error) {
// Retrieves the node's public key in hex form
func (pssapi *API) GetPublicKey() (keybytes hexutil.Bytes) {
key := pssapi.Pss.PublicKey()
keybytes = pssapi.Pss.Crypto.FromECDSAPub(key)
keybytes = pssapi.Pss.Crypto.SerializePublicKey(key)
return keybytes
}

// Set Public key to associate with a particular Pss peer
func (pssapi *API) SetPeerPublicKey(pubkey hexutil.Bytes, topic Topic, addr PssAddress) error {
pk, err := pssapi.Pss.Crypto.UnmarshalPubkey(pubkey)
pk, err := pssapi.Pss.Crypto.UnmarshalPublicKey(pubkey)
if err != nil {
return fmt.Errorf("Cannot unmarshal pubkey: %x", pubkey)
}
Expand Down
12 changes: 2 additions & 10 deletions pss/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"time"

"github.com/ethereum/go-ethereum/common/hexutil"
ethCrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
Expand All @@ -48,7 +49,6 @@ type protoCtrl struct {
var (
debugdebugflag = flag.Bool("vv", false, "veryverbose")
debugflag = flag.Bool("v", false, "verbose")
cryptoUtils pss.CryptoUtils
// custom logging
psslogmain log.Logger
pssprotocols map[string]*protoCtrl
Expand Down Expand Up @@ -76,8 +76,6 @@ func init() {
h := log.CallerFileHandler(hf)
log.Root().SetHandler(h)

cryptoUtils = pss.NewCryptoUtils()

pssprotocols = make(map[string]*protoCtrl)
}

Expand Down Expand Up @@ -245,13 +243,7 @@ func newServices() adapters.Services {
}
return adapters.Services{
"pss": func(ctx *adapters.ServiceContext) (node.Service, error) {
ctxlocal, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
keys, err := cryptoUtils.NewKeyPair(ctxlocal)
if err != nil {
return nil, err
}
privkey, err := cryptoUtils.GetPrivateKey(keys)
privkey, err := ethCrypto.GenerateKey()
if err != nil {
return nil, err
}
Expand Down
104 changes: 0 additions & 104 deletions pss/crypto.go

This file was deleted.

Loading