mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-09-03 23:57:27 -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"
|
"github.com/rwinkhart/rcw/wrappers"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Daemonize = true
|
||||||
|
|
||||||
// RCWDArgument reads the passphrase from stdin and caches it via an RCW daemon.
|
// RCWDArgument reads the passphrase from stdin and caches it via an RCW daemon.
|
||||||
func RCWDArgument() {
|
func RCWDArgument() {
|
||||||
passphrase := back.ReadFromStdin()
|
passphrase := back.ReadFromStdin()
|
||||||
@@ -59,7 +61,7 @@ func EncryptBytes(decBytes []byte) []byte {
|
|||||||
// launchRCWDProcess launches an RCW daemon to cache a passphrase.
|
// launchRCWDProcess launches an RCW daemon to cache a passphrase.
|
||||||
// If the daemon is not already running, it returns the passphrase (otherwise returns nil).
|
// If the daemon is not already running, it returns the passphrase (otherwise returns nil).
|
||||||
func launchRCWDProcess() []byte {
|
func launchRCWDProcess() []byte {
|
||||||
if daemon.IsOpen() {
|
if Daemonize && daemon.IsOpen() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var passphrase []byte
|
var passphrase []byte
|
||||||
@@ -71,9 +73,12 @@ func launchRCWDProcess() []byte {
|
|||||||
}
|
}
|
||||||
fmt.Println(back.AnsiError + "Incorrect passphrase" + back.AnsiReset)
|
fmt.Println(back.AnsiError + "Incorrect passphrase" + back.AnsiReset)
|
||||||
}
|
}
|
||||||
cmd := exec.Command(os.Args[0], "startrcwd")
|
|
||||||
back.WriteToStdin(cmd, string(passphrase))
|
if Daemonize {
|
||||||
cmd.Start()
|
cmd := exec.Command(os.Args[0], "startrcwd")
|
||||||
|
back.WriteToStdin(cmd, string(passphrase))
|
||||||
|
cmd.Start()
|
||||||
|
}
|
||||||
|
|
||||||
return passphrase
|
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)
|
- `termux`: Allows creating an Android binary that can interact with the Termux clipboard (for Android)
|
||||||
|
|
||||||
## Required Global Variable Manipulation
|
## 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
|
## 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()`.
|
- `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