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/json: marshaller does not provide Base64Url support #14804

Open
cyberphone opened this Issue Mar 13, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@cyberphone

cyberphone commented Mar 13, 2016

  1. Go version: 5.3
  2. Operating system: Windows 8.1 64-bit
  3. What did you do?
    https://play.golang.org/p/k1Wgec8cVB
  4. What did you expect to see?
    I had hoped that there would be a field option allowing you to override the default encoding because Base64Url is nowadays the preferred format in standards including IETF's JOSE
  5. What did you see instead?
    No such option :-)
@OneOfOne

This comment has been minimized.

Contributor

OneOfOne commented Mar 13, 2016

What's wrong with doing it client side instead of making the json encoder do mime sniffing on the data?

img.src = 'data:image/png;base64,' + data.Blob;
@cyberphone

This comment has been minimized.

cyberphone commented Mar 13, 2016

@OneOfOne There's nothing wrong with sniffing in a browser scenario but I'm targeting another class of applications where there is no room for such measures: https://cyberphone.github.io/openkeystore/resources/docs/jsonsignatures.html

Yes, an option must also work for unmarshalling.

@OneOfOne

This comment has been minimized.

Contributor

OneOfOne commented Mar 13, 2016

It's rather trivial to implement your own type for that though.

https://play.golang.org/p/FYFtvrdWnq

@cyberphone

This comment has been minimized.

cyberphone commented Mar 13, 2016

@OneOfOne Indeed I could but you should consider this issue related to a bunch of issues which makes the current Marshaller/Unmarshaller close to useless in my context:
#14750
#14749
#14135

@bradfitz bradfitz changed the title from JSON marshaller does not provide Base64Url support to encoding/json: marshaller does not provide Base64Url support Apr 9, 2016

@bradfitz bradfitz added this to the Unplanned milestone Apr 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment