-
Notifications
You must be signed in to change notification settings - Fork 19
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
include base64url example #30
Comments
@mcmanus yes, there is also the bit about not having the https://github.com/chantra/doh-proxy/blob/master/dohproxy/utils.py import base64
def doh_b64_encode(s):
"""Base 64 urlsafe encode and remove padding.
input: bytes
output: str
"""
return base64.urlsafe_b64encode(s).decode('utf-8').rstrip('=')
def doh_b64_decode(s):
"""Base 64 urlsafe decode, add padding as needed.
input: str
output: bytes
"""
padding = '=' * (-len(s)%4)
return base64.urlsafe_b64decode(s + padding) and I think it is correct :) Would an example implementation in a language be worth adding to the examples? It may be more straightforward to read than examples. https://docs.python.org/3/library/base64.html#base64.urlsafe_b64encode documentation says:
This may be worth highlighting as what base64url is too. |
This is complicated by the fact that some people want the encoding of responses to GET to be media-type-specific. |
I think you mean GET request body parameters (not responses - which are always in bodies and not encoded) |
Yes, I meant body parameters. |
Please stop calling the parameter |
note that the current encoded url in the github copy is wrong as it wasn't updated when the dns id changed to 0. I'll fix that as part of making a base 64 example. |
I've seen an implementation report that confused base64 and base64url; they noted that the examples didn't include one where the distinction was important
The text was updated successfully, but these errors were encountered: