iroha icon indicating copy to clipboard operation
iroha copied to clipboard

Representation of key pair in configuration files

Open mversic opened this issue 2 years ago • 4 comments

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.

mversic avatar Apr 21 '22 22:04 mversic

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

s8sato avatar Apr 24 '22 14:04 s8sato

#3240

dmitrivenger avatar Jun 21 '23 08:06 dmitrivenger

@0x009922 is this still actual?

mversic avatar Mar 27 '24 07:03 mversic

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).

0x009922 avatar Mar 27 '24 07:03 0x009922