You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have functions for parsing from []byte to key and marshaling key to PEM in the keygen package.
// ParsePrivateKey parses a PEM encoded private key.funcParsePrivateKey(buf []byte) (key hotstuff.PrivateKey, errerror)
// ParsePublicKey parses a PEM encoded public keyfuncParsePublicKey(buf []byte) (key hotstuff.PublicKey, errerror)
// PrivateKeyToPEM encodes the private key in PEM format.funcPrivateKeyToPEM(key hotstuff.PrivateKey) ([]byte, error)
// PublicKeyToPEM encodes the public key in PEM format.funcPublicKeyToPEM(key hotstuff.PublicKey) ([]byte, error)
However, these belong in their respective packages {ecdsa, eddsa, bls12}, since we must add code to these methods whenever we add a new crypto scheme and expose parsing details outside the package, which could be kept internal to the specific package.
That is, we should add these to the different crypto packages:
hotstuff.{Private|Public}Key should require key types to provide a MarshalToPEM() ([]byte, error) method.
We have functions for parsing from
[]byte
to key and marshaling key to PEM in thekeygen
package.However, these belong in their respective packages
{ecdsa, eddsa, bls12}
, since we must add code to these methods whenever we add a new crypto scheme and expose parsing details outside the package, which could be kept internal to the specific package.That is, we should add these to the different crypto packages:
hotstuff.{Private|Public}Key
should require key types to provide aMarshalToPEM() ([]byte, error)
method.ParsePublicKey(buf []byte) (key hotstuff.PublicKey, err error)
ParsePrivateKey(buf []byte) (key hotstuff.PrivateKey, err error)
Have I've overlooked something that makes this approach less desirable?
The text was updated successfully, but these errors were encountered: