mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-07 03:07:56 +08:00
refactor(crypto): simplify to local encryption only (remove KMS)
## 🎯 簡化方案(社區友好) ### 移除雲端 KMS - ❌ 刪除 crypto/aliyun_kms.go - ❌ 不包含 GCP KMS - ✅ 僅保留本地 AES-256-GCM 加密 ### 更新 SQLite 驅動 - ✅ modernc.org/sqlite(純 Go,無 CGO) - ✅ 與上游保持一致 ## 📦 保留核心功能 ✅ crypto/encryption.go - RSA + AES 加密 ✅ crypto/secure_storage.go - 數據庫加密層 ✅ api/crypto_handler.go - API 端點 ✅ web/src/lib/crypto.ts - 前端加密 ✅ scripts/migrate_encryption.go - 數據遷移 ## 🚀 部署方式 ```bash # 僅需一個環境變量 export NOFX_MASTER_KEY=$(openssl rand -base64 32) go run main.go ``` ## ✅ 優點 - ✅ 零雲服務依賴 - ✅ 簡單易部署 - ✅ 適合社區用戶 - ✅ 保持核心安全功能
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"nofx/crypto"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -38,7 +38,7 @@ func main() {
|
||||
}
|
||||
|
||||
// 3. 打開數據庫
|
||||
db, err := sql.Open("sqlite3", dbPath)
|
||||
db, err := sql.Open("sqlite", dbPath)
|
||||
if err != nil {
|
||||
log.Fatalf("❌ 打開數據庫失敗: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user