hide error messages in non-debug mode

This commit is contained in:
ed 2019-12-18 12:27:09 +01:00
parent 3c6920df6b
commit 4c43773989
1 changed files with 16 additions and 2 deletions

18
main.go
View File

@ -9,13 +9,20 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
// "strings"
"syscall" "syscall"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
) )
var debug bool = false
func checkErr(err error) { func checkErr(err error) {
if err != nil { if err != nil {
panic(err.Error()) if debug {
panic(err.Error())
} else {
os.Exit(1)
}
} }
} }
@ -126,7 +133,14 @@ func main() {
secretfn := fn + ".hdn" secretfn := fn + ".hdn"
data2file(secretfn,secret) data2file(secretfn,secret)
case "s": case "s":
fmt.Println("decrypt") fmt.Print("password: ")
pw := readPass()
fmt.Print("\n")
key := keyMkr(pw)
secret := file2data(fn)
datafn := fn + "clear"
data := decrypt(secret, key)
data2file(datafn, data)
} }
/* /*
var passwd string = "ThisAnnPassphrase" var passwd string = "ThisAnnPassphrase"