crypt API changes
This commit is contained in:
@@ -153,7 +153,7 @@ func PutIdentityCookie(w http.ResponseWriter, r *http.Request, identity *auth.Id
|
|||||||
|
|
||||||
httpCookie := &http.Cookie{
|
httpCookie := &http.Cookie{
|
||||||
Name: config.IDENTITY_COOKIE_NAME,
|
Name: config.IDENTITY_COOKIE_NAME,
|
||||||
Value: security.EncodeBase58(string(identityData)),
|
Value: security.EncodeBase58(identityData),
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
Secure: r.URL.Scheme == "https",
|
Secure: r.URL.Scheme == "https",
|
||||||
Path: "/",
|
Path: "/",
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ func PutSessionCookie(w http.ResponseWriter, r *http.Request, session map[string
|
|||||||
|
|
||||||
httpCookie := &http.Cookie{
|
httpCookie := &http.Cookie{
|
||||||
Name: config.SESSION_COOKIE_NAME,
|
Name: config.SESSION_COOKIE_NAME,
|
||||||
Value: security.EncodeBase58(string(sessionData)),
|
Value: security.EncodeBase58(sessionData),
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
Secure: r.URL.Scheme == "https",
|
Secure: r.URL.Scheme == "https",
|
||||||
Path: "/",
|
Path: "/",
|
||||||
|
|||||||
@@ -24,21 +24,21 @@ import (
|
|||||||
// Encoding Wrappers
|
// Encoding Wrappers
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
func EncodeBase64(in string) string {
|
func EncodeBase64(in []byte) string {
|
||||||
return base64.StdEncoding.EncodeToString([]byte(in))
|
return base64.StdEncoding.EncodeToString(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DecodeBase64(in string) string {
|
func DecodeBase64(in string) []byte {
|
||||||
out, _ := base64.RawStdEncoding.DecodeString(in)
|
out, _ := base64.RawStdEncoding.DecodeString(in)
|
||||||
return string(out)
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func EncodeBase58(in string) string {
|
func EncodeBase58(in []byte) string {
|
||||||
return base58.Encode([]byte(in))
|
return base58.Encode(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DecodeBase58(in string) string {
|
func DecodeBase58(in string) []byte {
|
||||||
return string(base58.Decode(in))
|
return base58.Decode(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user