aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--conf/store.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/conf/store.go b/conf/store.go
index 4782aca0..35f0ba7d 100644
--- a/conf/store.go
+++ b/conf/store.go
@@ -100,20 +100,21 @@ func MigrateUnencryptedConfigs(sharingBase int) (int, []error) {
e++
continue
}
- _, err = FromWgQuickWithUnknownEncoding(string(bytes), "input")
+ configName := strings.TrimSuffix(name, configFileUnencryptedSuffix)
+ config, err := FromWgQuickWithUnknownEncoding(string(bytes), configName)
if err != nil {
errs[e] = err
e++
continue
}
- bytes, err = dpapi.Encrypt(bytes, strings.TrimSuffix(name, configFileUnencryptedSuffix))
+ bytes, err = dpapi.Encrypt([]byte(config.ToWgQuick()), name)
if err != nil {
errs[e] = err
e++
continue
}
- dstFile := strings.TrimSuffix(path, configFileUnencryptedSuffix) + configFileSuffix
+ dstFile := configName + configFileSuffix
err = writeEncryptedFile(dstFile, false, bytes)
if err != nil {
errs[e] = err