Open letmaik opened 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:
@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.
~
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:In DIDs,
~
is not allowed:The did:web spec doesn't say much about encoding of the path, only:
Being more precise here avoids ambiguities and potentially forging invalid DIDs.
There are roughly two options:
~
~
is encoded (and potentially decoded), while not accidently double-encoding the other characters that may already be percent-encoded