Remove base64-arraybuffer

This commit is contained in:
Ken-Håvard Lieng 2018-10-10 21:23:42 +02:00
parent afc80650e7
commit ec03db4db6
8 changed files with 32 additions and 33 deletions

View file

@ -178,8 +178,8 @@ type SearchResult struct {
}
type ClientCert struct {
Cert []byte
Key []byte
Cert string
Key string
}
type FetchMessages struct {

View file

@ -2938,19 +2938,9 @@ func easyjson42239ddeDecodeGithubComKhliengDispatchServer26(in *jlexer.Lexer, ou
}
switch key {
case "cert":
if in.IsNull() {
in.Skip()
out.Cert = nil
} else {
out.Cert = in.Bytes()
}
out.Cert = string(in.String())
case "key":
if in.IsNull() {
in.Skip()
out.Key = nil
} else {
out.Key = in.Bytes()
}
out.Key = string(in.String())
default:
in.SkipRecursive()
}
@ -2965,7 +2955,7 @@ func easyjson42239ddeEncodeGithubComKhliengDispatchServer26(out *jwriter.Writer,
out.RawByte('{')
first := true
_ = first
if len(in.Cert) != 0 {
if in.Cert != "" {
const prefix string = ",\"cert\":"
if first {
first = false
@ -2973,9 +2963,9 @@ func easyjson42239ddeEncodeGithubComKhliengDispatchServer26(out *jwriter.Writer,
} else {
out.RawString(prefix)
}
out.Base64Bytes(in.Cert)
out.String(string(in.Cert))
}
if len(in.Key) != 0 {
if in.Key != "" {
const prefix string = ",\"key\":"
if first {
first = false
@ -2983,7 +2973,7 @@ func easyjson42239ddeEncodeGithubComKhliengDispatchServer26(out *jwriter.Writer,
} else {
out.RawString(prefix)
}
out.Base64Bytes(in.Key)
out.String(string(in.Key))
}
out.RawByte('}')
}

View file

@ -249,7 +249,7 @@ func (h *wsHandler) cert(b []byte) {
var data ClientCert
data.UnmarshalJSON(b)
err := h.state.user.SetCertificate(data.Cert, data.Key)
err := h.state.user.SetCertificate([]byte(data.Cert), []byte(data.Key))
if err != nil {
h.state.sendJSON("cert_fail", Error{Message: err.Error()})
return