openssi / peer-did-method-spec

A spec for the did:peer DID method.
https://dhh1128.github.io/peer-did-method-spec/index.html
Apache License 2.0
30 stars 17 forks source link

Canonicalized Transfer #96

Closed TelegramSam closed 4 years ago

TelegramSam commented 5 years ago

In order to validate signatures and peer did identifiers, the documents must be transferred in a canonicalized format. If we just pass the structure inside a DIDComm message, different parsers will present different bytestreams.

Two options I see:

  1. pass as a serialized string inside of the DIDComm message. The json will end up being escaped (which is fine), and the value will have to be parsed after the original parse of the message. This might be easy to confuse and screw up.
  2. B64 (or similar) encode the string for transmission. This method suffers from being opaque but is less likely to be screwed up because of how obvious it is. There is also a byte inflation hit for that encoding.

Thoughts

dhh1128 commented 5 years ago

I think, on balance, that the b64 encoding is the right answer. This fits with other parts of what's already in the spec, as for example the change member of a delta (https://openssi.github.io/peer-did-method-spec/#example-5-delta-structure).

dhh1128 commented 5 years ago

@kdenhartog or @swcurran or @tplooker , what do you think?

kdenhartog commented 5 years ago

I'm in favor of option 2. While it has the downsides that @TelegramSam mentioned, I believe that it keeps us close to how ION is handling this. I need to find the documentation that describes this, but in the DIF chat @csuwildcat described that this is the format used in some situations with ION to pass an unanchored DID Doc.

dhh1128 commented 4 years ago

This issue will be addressed by using initial-state as a DID parameter. Thus, the general need is being tracked in https://github.com/decentralized-identity/peer-did-method-spec/issues/1. It's not exactly described the same way, but it gets at the same requirement. Closing the issue in this superseded repo.