iroha
iroha copied to clipboard
Representation of key pair in configuration files
It has been mentioned recently that in client::Configuration
/cli::Configuration
/genesis::Configuration
we store public_key
and private_key
as separate variables as in:
pub struct Configuration {
pub public_key: PublicKey,
pub private_key: PrivateKey,
}
when they could be stored as a key pair as in:
pub struct Configuration {
pub key_pair: KeyPair,
}
This is probably related to the deserialization either from config files or env variables. It should be investigated whether this switch can be made and will there be any tolerable consequences for the API of config files or env variables.
One possibility is to stop deserializing to keys from config files or environment variables altogether and configure it only when sign-up (keys generation) or login
#3240
@0x009922 is this still actual?
On the user layer (reading from a file/env), it is still represented by separate public_key
and private_key
fields. However, when the user layer is parsed further, a we construct a KeyPair
and then put it into the type-strong view of the config.
As for what format is good for the config file, I am not sure if nesting these two fields into a key_pair
will make much difference:
public_key = "..."
private_key = { algorithm = "...", payload = "..." }
[key_pair]
public_key = "..."
private_key = { algorithm = "...", payload = "..." }
I'd vote for making things flat if possible (i.e. don't introduce key_pair
nesting).