Closed kastolars closed 5 years ago
via #306, this issue was resolved
Changes on the WIP regarding publickey.Encode()
and publickey.Decode()
for error handling look good to me and the changes throughout the project to account for these changes make sense to me.
The GenerateNRandomKeys()
on line 80 in privatekey.go
, the line currently is x509Encoded, _ := x509.MarshalECPrivateKey(p)
but the function x509.MarshalECPrivateKey()
returns an error that is not handled. I think this should be changed to handle the error it returns but I'm not entirely sure. Aside from this, all tests pass.
@ramirez915 Do we use that function anywhere? The GenerateNRandomKeys
I pulled from dev to check and did not find the GenerateNRandomKeys
used anywhere in the project besides in privatekey_test.go file
I created a card regarding GenerateNRandomKeys
in the backlog. Since GenerateNRandomKeys
is not currently used anywhere in the project besides in privatekey_test.go the handling for the x509.MarshalECPrivateKey()
can be ignored for now.
Currently the encoding & decoding functions in the
keys
package are simply ignoring errors within the function body instead of returning them if they are faulty. If a conversion fails we should know about it and handle it gracefully instead of panicking.This may cause some tests in the project overall to fail because of their current usage.
Example of area where an error needs to be handled: https://github.com/SIGBlockchain/project_aurum/blob/dev/internal/publickey/publickey.go#L23
privatekey
andpublickey
package functions handle errors if possibleprivatekey
andpublickey
package tests passprivatekey
andpublickey
functions in repo refactored to handle errors