You've already forked img-proxy-url-generator
This commit is contained in:
@@ -9,14 +9,14 @@ import (
|
||||
|
||||
func (g *Generator) generateSignature(path string) string {
|
||||
var signature string
|
||||
if len(g.config.keyBin) == 0 || len(g.config.saltBin) == 0 {
|
||||
if len(g.keyBin) == 0 || len(g.salt) == 0 {
|
||||
signature = "insecure"
|
||||
|
||||
printer.NewPrinter().LogWarning("Insecure url generated. Provide salt and key to sign and secure url.")
|
||||
|
||||
} else {
|
||||
mac := hmac.New(sha256.New, g.config.keyBin)
|
||||
mac.Write(g.config.saltBin)
|
||||
mac := hmac.New(sha256.New, g.keyBin)
|
||||
mac.Write(g.salt)
|
||||
mac.Write([]byte(path))
|
||||
signature = base64.RawURLEncoding.EncodeToString(mac.Sum(nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user