Refactor and remove sqlite and replace with MySQL
This commit is contained in:
7
internal/helpers/session/encoding.go
Normal file
7
internal/helpers/session/encoding.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package helpers
|
||||
|
||||
import "encoding/base64"
|
||||
|
||||
func EncodeKey(b []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(b)
|
||||
}
|
||||
20
internal/helpers/session/loader.go
Normal file
20
internal/helpers/session/loader.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
)
|
||||
|
||||
func LoadKeyFromFile(path string) ([]byte, error) {
|
||||
key, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bytes.TrimSpace(key), nil
|
||||
}
|
||||
|
||||
func ZeroBytes(b []byte) {
|
||||
for i := range b {
|
||||
b[i] = 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user