Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding of tilde (~) #67

Open
letmaik opened this issue Oct 26, 2022 · 1 comment
Open

Encoding of tilde (~) #67

letmaik opened this issue Oct 26, 2022 · 1 comment

Comments

@letmaik
Copy link
Contributor

letmaik commented Oct 26, 2022

~ 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:

  • Avoid the issue and simply forbid paths containing ~
  • Define how ~ is encoded (and potentially decoded), while not accidently double-encoding the other characters that may already be percent-encoded
@dmitrizagidulin
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants