decentralized-identity / peer-did-method-spec

A rich DID method that has no blockchain dependencies. The verifiable data registry is a synchronization protocol between peers.
https://decentralized-identity.github.io/peer-did-method-spec/index.html
Apache License 2.0
27 stars 17 forks source link

Problem with regex #46

Closed brianorwhatever closed 1 year ago

brianorwhatever commented 1 year ago

The regex used doesn't seem to pass for all valid dids

^did:peer:(([01](z)([1-9a-km-zA-HJ-NP-Z]{46,47}))|(2((\.[AEVID](z)([1-9a-km-zA-HJ-NP-Z]{46,47}))+(\.(S)[0-9a-zA-Z=]*)?)))$

See here https://regex101.com/r/NSAniA/1 where there is 2 dids but only 1 is matching

It looks like the {46,47} might not account for all key sizes. Changing these to {44,47} appears to properly match

brianorwhatever commented 1 year ago

hmm 44, 47 didn't work either so I changed it to a * in my implementation

brianorwhatever commented 1 year ago

I think this was a bug in my multibase implementations. now that I have that fixed all of the dids I've tried pass the regex. closing until I see this again but I think the regex is fine as it is