Plaintext/SECIO protobuf schema inconsistency for public keys

Hello guys!

At first, a little intro.

Plaintext’s Exchange proto message uses PublicKey message for manipulations around the key, not its byte representation after marshaling:

// from Plaintext spec
message Exchange {
  optional bytes id = 1;
  optional PublicKey pubkey = 2;
}

SECIO’s Propose message operates with the same public key in the form of bytes sequence (marshaled PublicKey message bytes are included into Propose message, whereas the field pubkey just could be typed as PublicKey like in Plaintext):

// from SECIO spec
message Propose {
  optional bytes rand = 1;
  optional bytes pubkey = 2;
  optional string exchanges = 3;
  optional string ciphers = 4;
  optional string hashes = 5;
}

The question is - what was the reason to do so? This is confusing a bit :slight_smile:

1 Like

I believe this is just a result of the secio spec being older. The plaintext and peer-id specs were written to account for passing along the key type as well as the key, to better support multiple keys. For secio, the key type has to be inferred from the data. Secio should ideally be passing the same PublicKey format.

1 Like