Files
NanoKVM-MIRROR/server/utils/encrypt.go
wj-xiao 6eb4a4ea62 update version to 2.1.6
feat: support downloading image from online URL
feat: add keyboard shortcut Ctrl+Alt+Del
fix: fix the CSRF issue
perf: add an option to configure custom ICE servers
perf: removed unnecessary modifications to DNS configuration
perf: add an SSH enable/disable toggle in the web UI
perf: add a Tailscale enable/disable toggle in the web UI
perf: download Tailscale installation package from the official source
perf: automatic enable/disable GOMEMLIMIT on tailscale start/stop
perf: add JWT configuration
perf: implement secure password storage using bcrypt hashing
perf: implement integrity checks for online updates
refactor: refactor HDMI module and remove the dependency libmaixcam_lib.so
refactor: web terminal use pty instead of SSH
refactor: move Tailscale APIs from the network module to the extensions module
2025-02-14 14:18:13 +08:00

31 lines
624 B
Go

package utils
import (
"net/url"
"github.com/mervick/aes-everywhere/go/aes256"
log "github.com/sirupsen/logrus"
)
// SecretKey is only used to prevent the data from being transmitted in plaintext.
const SecretKey = "nanokvm-sipeed-2024"
func Decrypt(ciphertext string) (string, error) {
if ciphertext == "" {
return "", nil
}
decrypt := aes256.Decrypt(ciphertext, SecretKey)
return decrypt, nil
}
func DecodeDecrypt(data string) (string, error) {
ciphertext, err := url.QueryUnescape(data)
if err != nil {
log.Errorf("decode ciphertext failed: %s", err)
return "", err
}
return Decrypt(ciphertext)
}