2019-06-02 08:47:19 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2019-06-05 06:40:06 +00:00
|
|
|
"fmt"
|
|
|
|
|
2019-06-02 08:47:19 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
2019-07-11 06:05:59 +00:00
|
|
|
"github.com/mitchell/selfpass/sp/types"
|
2019-06-02 08:47:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func makeDecryptCfg(repo types.ConfigRepo) *cobra.Command {
|
|
|
|
decryptCfg := &cobra.Command{
|
|
|
|
Use: "decrypt-cfg",
|
|
|
|
Short: "Decrypt your config file",
|
|
|
|
Long: "Decrypt your config file, so you can access your private key, host, and certs.",
|
|
|
|
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
_, _, err := repo.OpenConfig()
|
|
|
|
check(err)
|
|
|
|
|
2019-06-05 06:40:06 +00:00
|
|
|
check(repo.DecryptConfig())
|
|
|
|
|
2019-07-11 06:05:59 +00:00
|
|
|
fmt.Println("Config decrypted. It will automatically encrypt next run of sp.")
|
2019-06-02 08:47:19 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return decryptCfg
|
|
|
|
}
|