w3c-ccg / did-method-web

DRAFT: did:web Decentralized Identifier Method Specification
https://w3c-ccg.github.io/did-method-web/
Other
32 stars 17 forks source link

Encoding of tilde (`~`) #67

Open letmaik opened 2 years ago

letmaik commented 2 years ago

~ is a safe character in URLs and doesn't have to be encoded, see also https://datatracker.ietf.org/doc/html/rfc3986#section-2.3:

unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"

In DIDs, ~ is not allowed:

idchar = ALPHA / DIGIT / "." / "-" / "_" / pct-encoded

The did:web spec doesn't say much about encoding of the path, only:

Directories and subdirectories MAY optionally be included, delimited by colons rather than slashes.

Being more precise here avoids ambiguities and potentially forging invalid DIDs.

There are roughly two options:

dmitrizagidulin commented 1 year ago

@letmaik - ooh, great point about the ~ character. I agree with you that we need to be precise in the spec. Given that URLs with ~s are fairly common (or, used to be), I think we should define an encoding.