diff --git a/crypt/rcw.go b/crypt/rcw.go index 9587023..2f83c1a 100644 --- a/crypt/rcw.go +++ b/crypt/rcw.go @@ -12,6 +12,8 @@ import ( "github.com/rwinkhart/rcw/wrappers" ) +var Daemonize = true + // RCWDArgument reads the passphrase from stdin and caches it via an RCW daemon. func RCWDArgument() { passphrase := back.ReadFromStdin() @@ -59,7 +61,7 @@ func EncryptBytes(decBytes []byte) []byte { // launchRCWDProcess launches an RCW daemon to cache a passphrase. // If the daemon is not already running, it returns the passphrase (otherwise returns nil). func launchRCWDProcess() []byte { - if daemon.IsOpen() { + if Daemonize && daemon.IsOpen() { return nil } var passphrase []byte @@ -71,9 +73,12 @@ func launchRCWDProcess() []byte { } fmt.Println(back.AnsiError + "Incorrect passphrase" + back.AnsiReset) } - cmd := exec.Command(os.Args[0], "startrcwd") - back.WriteToStdin(cmd, string(passphrase)) - cmd.Start() + + if Daemonize { + cmd := exec.Command(os.Args[0], "startrcwd") + back.WriteToStdin(cmd, string(passphrase)) + cmd.Start() + } return passphrase } diff --git a/wiki/developers.md b/wiki/developers.md index 220ffc4..df5ffa2 100644 --- a/wiki/developers.md +++ b/wiki/developers.md @@ -16,7 +16,8 @@ These are as follows: - `termux`: Allows creating an Android binary that can interact with the Termux clipboard (for Android) ## Required Global Variable Manipulation -libmutton provides a `global.GetPassphrase` global variable that all clients must set. This approach allows for different types of clients (CLI, GUI, TUI) to prompt for the passphrase in the most appropriate way. +- `global.GetPassphrase` must be set to allow for different types of clients (CLI, GUI, TUI) to prompt for the passphrase in the most appropriate way. +- `crypt.Daemonize`, true by default, determines whether to make use of the RCW daemon for passphrase caching. This may be best to disable for interactive clients. ## Required Arguments - `clipclear`: Should be accepted by all non-interactive CLI libmutton implementations (not required for interactive GUI/TUI implementations). In order to clear the clipboard on a timer, non-interactive libmutton-based password managers call another instance of their executable with the `clipclear` argument (e.g. `mutn clipclear`) with the intended clipboard contents provided via STDIN. If after 30 seconds the clipboard contents have not changed, they are cleared. Please accept a `clipclear` argument that calls `core.ClipClearArgument()`.