mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-08-27 20:36:29 -04:00
Make running RCW as a daemon optional
This commit is contained in:
+9
-4
@@ -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
|
||||
}
|
||||
|
||||
+2
-1
@@ -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()`.
|
||||
|
||||
Reference in New Issue
Block a user