Closed lovesh closed 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.
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.
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 thatnumalgo
orencalgo
of 2 DIDs are compatible? Nitpick: The example takes first 12 characters which will give incorrect results whennumalgo
orencalgo
take more than 1 digit. Better to use regex.