hide error messages in non-debug mode
This commit is contained in:
parent
3c6920df6b
commit
4c43773989
16
main.go
16
main.go
|
@ -9,13 +9,20 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
// "strings"
|
||||
"syscall"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
var debug bool = false
|
||||
|
||||
func checkErr(err error) {
|
||||
if err != nil {
|
||||
if debug {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +133,14 @@ func main() {
|
|||
secretfn := fn + ".hdn"
|
||||
data2file(secretfn,secret)
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue