File tree Expand file tree Collapse file tree 2 files changed +2
-18
lines changed Expand file tree Collapse file tree 2 files changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -194,24 +194,6 @@ func (msg *receivedMessage) validateAndParse() error {
194
194
return nil
195
195
}
196
196
197
- // sigToPubKey returns the public key associated to the message's signature.
198
- // should only be called if message has been signed
199
- func (msg * receivedMessage ) sigToPubKey () * ecdsa.PublicKey {
200
- defer func () { recover () }() // in case of invalid signature
201
-
202
- signedBytes := msg .Raw
203
- if isMessageSigned (msg .Raw [0 ]) {
204
- sz := len (msg .Raw ) - signatureLength
205
- signedBytes = msg .Raw [:sz ]
206
- }
207
- pub , err := msg .crypto .sigToPub (signedBytes , msg .Signature )
208
- if err != nil {
209
- log .Error ("failed to recover public key from signature" , "err" , err )
210
- return nil
211
- }
212
- return pub
213
- }
214
-
215
197
func newReceivedMessage (decrypted []byte , salt []byte , crypto * defaultCryptoBackend ) * receivedMessage {
216
198
return & receivedMessage {
217
199
Raw : decrypted ,
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ func NewUtils() Utils {
41
41
}
42
42
}
43
43
44
+ // Generates a new private key right away. It is not stored for later retrieval.
44
45
func (utils * utils ) GenerateKey () (* ecdsa.PrivateKey , error ) {
45
46
return ethCrypto .GenerateKey ()
46
47
}
@@ -74,6 +75,7 @@ func (utils *utils) NewKeyPair() (string, error) {
74
75
return id , nil
75
76
}
76
77
78
+ // GetPrivateKey return a PrivateKey previously generated in NewKeyPair by id
77
79
func (utils * utils ) GetPrivateKey (id string ) (* ecdsa.PrivateKey , error ) {
78
80
utils .keyMu .RLock ()
79
81
defer utils .keyMu .RUnlock ()
You can’t perform that action at this time.
0 commit comments