Go: default public key (#16265)

### What problem does this PR solve?

Provider default public key for CLI

### Type of change

- [x] Refactoring

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-06-23 17:43:26 +08:00
committed by GitHub
parent dec2ce4a60
commit e15130534f
5 changed files with 65 additions and 11 deletions

View File

@@ -29,13 +29,13 @@ import (
// EncryptPassword encrypts a password using RSA public key
// This matches the Python implementation in api/utils/crypt.py
func EncryptPassword(password string) (string, error) {
func EncryptPassword(password string, publicKeyPEM []byte) (string, error) {
// Read public key from conf/public.pem
publicKeyPath := filepath.Join(getProjectBaseDirectory(), "conf", "public.pem")
publicKeyPEM, err := os.ReadFile(publicKeyPath)
if err != nil {
return "", fmt.Errorf("failed to read public key: %w", err)
}
//publicKeyPath := filepath.Join(getProjectBaseDirectory(), "conf", "public.pem")
//publicKeyPEM, err := os.ReadFile(publicKeyPath)
//if err != nil {
// return "", fmt.Errorf("failed to read public key: %w", err)
//}
// Parse public key
block, _ := pem.Decode(publicKeyPEM)