Skip to content

Commit d97d35d

Browse files
committed
pss: PR ethersphere#1731 comments
1 parent 56f8831 commit d97d35d

File tree

12 files changed

+310
-264
lines changed

12 files changed

+310
-264
lines changed

pss/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ func (pssapi *API) BaseAddr() (PssAddress, error) {
117117
// Retrieves the node's public key in hex form
118118
func (pssapi *API) GetPublicKey() (keybytes hexutil.Bytes) {
119119
key := pssapi.Pss.PublicKey()
120-
keybytes = pssapi.Pss.Crypto.FromECDSAPub(key)
120+
keybytes = pssapi.Pss.Crypto.SerializePublicKey(key)
121121
return keybytes
122122
}
123123

124124
// Set Public key to associate with a particular Pss peer
125125
func (pssapi *API) SetPeerPublicKey(pubkey hexutil.Bytes, topic Topic, addr PssAddress) error {
126-
pk, err := pssapi.Pss.Crypto.UnmarshalPubkey(pubkey)
126+
pk, err := pssapi.Pss.Crypto.UnmarshalPublicKey(pubkey)
127127
if err != nil {
128128
return fmt.Errorf("Cannot unmarshal pubkey: %x", pubkey)
129129
}

pss/client/client_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type protoCtrl struct {
4949
var (
5050
debugdebugflag = flag.Bool("vv", false, "veryverbose")
5151
debugflag = flag.Bool("v", false, "verbose")
52-
cryptoUtils crypto.CryptoUtils
52+
utils crypto.Utils
5353
// custom logging
5454
psslogmain log.Logger
5555
pssprotocols map[string]*protoCtrl
@@ -77,7 +77,7 @@ func init() {
7777
h := log.CallerFileHandler(hf)
7878
log.Root().SetHandler(h)
7979

80-
cryptoUtils = crypto.NewCryptoUtils()
80+
utils = crypto.NewUtils()
8181

8282
pssprotocols = make(map[string]*protoCtrl)
8383
}
@@ -246,13 +246,11 @@ func newServices() adapters.Services {
246246
}
247247
return adapters.Services{
248248
"pss": func(ctx *adapters.ServiceContext) (node.Service, error) {
249-
ctxlocal, cancel := context.WithTimeout(context.Background(), time.Second)
250-
defer cancel()
251-
keys, err := cryptoUtils.NewKeyPair(ctxlocal)
249+
keys, err := utils.NewKeyPair()
252250
if err != nil {
253251
return nil, err
254252
}
255-
privkey, err := cryptoUtils.GetPrivateKey(keys)
253+
privkey, err := utils.GetPrivateKey(keys)
256254
if err != nil {
257255
return nil, err
258256
}

0 commit comments

Comments
 (0)