Commit 36ab7ddd authored by Felipe Andrade's avatar Felipe Andrade

replace base64 encoding for params with sha256 hash

parent 2745b6cc
......@@ -2,8 +2,9 @@ package proxyd
import (
"context"
"encoding/base64"
"crypto/sha256"
"encoding/json"
"fmt"
"strings"
"sync"
......@@ -21,8 +22,10 @@ type StaticMethodHandler struct {
}
func (e *StaticMethodHandler) key(req *RPCReq) string {
// signature is a cache-friendly base64-encoded string with json.RawMessage param contents
signature := base64.StdEncoding.EncodeToString(req.Params)
// signature is the hashed json.RawMessage param contents
h := sha256.New()
h.Write(req.Params)
signature := fmt.Sprintf("%x", h.Sum(nil))
return strings.Join([]string{"cache", req.Method, signature}, ":")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment