webapi: base64 encode server signature
This commit is contained in:
parent
5a8bc49c22
commit
c7f8cea4dc
@ -7,7 +7,7 @@ package webapi
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
||||||
"encoding/hex"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
@ -236,7 +236,7 @@ func sendJSONResponse(resp interface{}, c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sig := ed25519.Sign(signPrivKey, dec)
|
sig := ed25519.Sign(signPrivKey, dec)
|
||||||
c.Writer.Header().Set("VSP-Server-Signature", hex.EncodeToString(sig))
|
c.Writer.Header().Set("VSP-Server-Signature", base64.StdEncoding.EncodeToString(sig))
|
||||||
|
|
||||||
c.AbortWithStatusJSON(http.StatusOK, resp)
|
c.AbortWithStatusJSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ func sendErrorWithMsg(msg string, e apiError, c *gin.Context) {
|
|||||||
log.Warnf("Sending error response without signature: %v", err)
|
log.Warnf("Sending error response without signature: %v", err)
|
||||||
} else {
|
} else {
|
||||||
sig := ed25519.Sign(signPrivKey, dec)
|
sig := ed25519.Sign(signPrivKey, dec)
|
||||||
c.Writer.Header().Set("VSP-Server-Signature", hex.EncodeToString(sig))
|
c.Writer.Header().Set("VSP-Server-Signature", base64.StdEncoding.EncodeToString(sig))
|
||||||
}
|
}
|
||||||
|
|
||||||
c.AbortWithStatusJSON(status, resp)
|
c.AbortWithStatusJSON(status, resp)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user