Open arnetheduck opened 4 years ago
One option:
Sign:
1 ++ 3
.Verify:
XXX_unrecognized
field.XXX_unrecognized
field.I mean, ideally we would have used envelopes... but this is the least-bad way to deal with this.
For now, the "correct answer" is: encode fields in-order.
For now, the "correct answer" is: encode fields in-order.
this makes sense, but it's more than that: there must be no duplicates, overlong varints etc - it also means that a standard protobuf encoder cannot be used, and therefore the spec must not reference protobuf but rather specify the fields in terms of the underlying encoding.
The message signature specification says that signature happens over protobuf encoded message - unfortunately, protobuf encoding is not deterministic, thus it cannot be used for generating a data stream to sign the message: https://developers.google.com/protocol-buffers/docs/encoding#implications
https://github.com/libp2p/specs/tree/b5135fd89e9b62ab94471de89e50f740a83cb004/pubsub#the-message
A possible solution is to specify the data stream explicitly in
key-value
form where the key and value is encoded according to the wire specification instead: https://developers.google.com/protocol-buffers/docs/encoding#structure - this would allow casual compatibility with what's out there.