@@ -7,10 +7,8 @@ import (
7
7
. "github.com/ViRb3/wgcf/cmd/shared"
8
8
"github.com/ViRb3/wgcf/config"
9
9
"github.com/ViRb3/wgcf/util"
10
- "github.com/ViRb3/wgcf/wireguard"
11
10
"github.com/pkg/errors"
12
11
"github.com/spf13/cobra"
13
- "github.com/spf13/viper"
14
12
)
15
13
16
14
var deviceName string
@@ -82,17 +80,8 @@ func ensureLicenseKeyUpToDate(ctx *config.Context, thisDevice *cloudflare.Device
82
80
}
83
81
84
82
func updateLicenseKey (ctx * config.Context ) (* cloudflare.Account , * cloudflare.Device , error ) {
85
- newPrivateKey , err := wireguard .NewPrivateKey ()
86
- if err != nil {
87
- return nil , nil , err
88
- }
89
- newPublicKey := newPrivateKey .Public ()
90
- if _ , _ , err := cloudflare .UpdateLicenseKey (ctx , newPublicKey .String ()); err != nil {
91
- return nil , nil , err
92
- }
93
83
94
- viper .Set (config .PrivateKey , newPrivateKey .String ())
95
- if err := viper .WriteConfig (); err != nil {
84
+ if _ , err := cloudflare .UpdateLicenseKey (ctx ); err != nil {
96
85
return nil , nil , err
97
86
}
98
87
@@ -108,9 +97,6 @@ func updateLicenseKey(ctx *config.Context) (*cloudflare.Account, *cloudflare.Dev
108
97
if account .License != ctx .LicenseKey {
109
98
return nil , nil , errors .New ("failed to update license key" )
110
99
}
111
- if thisDevice .Key != newPublicKey .String () {
112
- return nil , nil , errors .New ("failed to update public key" )
113
- }
114
100
115
101
return account , thisDevice , nil
116
102
}
0 commit comments