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

Pupose of comparePeerDIDs in Example 4 #79

Closed lovesh closed 5 years ago

lovesh commented 5 years ago

In which scenarios will the code in comparePeerDIDs be used? It compares only prefix. Is it meant to be used in cases where it needs to be checked that numalgo or encalgo of 2 DIDs are compatible? Nitpick: The example takes first 12 characters which will give incorrect results when numalgo or encalgo take more than 1 digit. Better to use regex.

dhh1128 commented 5 years ago

It doesn't compare only prefix. It compares the prefix first, case-sensitively. If the prefixes are equal, then it compares the remainder, NOT case-sensitively. This function would be used to test two peer DIDs for equality or to sort peer DIDs with proper regard for case sensitivity.

The spec only allows numalgo and encalgo to use 1 digit. I don't think we want to allow more than 16 different numeric algorithms or more than 16 encoding algorithms. This would have several other downstream consequences besides the need for a regex, including variable-length DIDs and the need to introduce a delimiter between the two algo numbers.

dhh1128 commented 5 years ago

This issue has not received new comment for a while. I'm assuming that the previous answer was satisfactory. Please reopen if that's not the case.