diff --git a/clip/copy_MAC.go b/clip/copy_MAC.go index 5d7d18a..47ee3be 100644 --- a/clip/copy_MAC.go +++ b/clip/copy_MAC.go @@ -18,7 +18,7 @@ func CopyString(clearClipboardAutomatically bool, copySubject string) error { return errors.New("unable to copy to clipboard: " + err.Error()) } if clearClipboardAutomatically { - LaunchClipClearProcess(copySubject) + LaunchClearProcess(copySubject) } return nil } diff --git a/clip/copy_TERMUX.go b/clip/copy_TERMUX.go index c54c217..9a60f37 100644 --- a/clip/copy_TERMUX.go +++ b/clip/copy_TERMUX.go @@ -18,7 +18,7 @@ func CopyString(clearClipboardAutomatically bool, copySubject string) error { return errors.New("unable to copy to clipboard: " + err.Error()) } if clearClipboardAutomatically { - LaunchClipClearProcess(copySubject) + LaunchClearProcess(copySubject) } return nil } diff --git a/clip/copy_UNIX.go b/clip/copy_UNIX.go index d550236..5deee8e 100644 --- a/clip/copy_UNIX.go +++ b/clip/copy_UNIX.go @@ -30,7 +30,7 @@ func CopyString(clearClipboardAutomatically bool, copySubject string) error { return errors.New("unable to copy to clipboard: " + err.Error()) } if clearClipboardAutomatically { - LaunchClipClearProcess(copySubject) + LaunchClearProcess(copySubject) } return nil } diff --git a/clip/copy_WIN.go b/clip/copy_WIN.go index 6bdbeb7..995bc7f 100644 --- a/clip/copy_WIN.go +++ b/clip/copy_WIN.go @@ -17,7 +17,7 @@ func CopyString(clearClipboardAutomatically bool, copySubject string) error { return errors.New("unable to copy to clipboard: " + err.Error()) } if clearClipboardAutomatically { - LaunchClipClearProcess(copySubject) + LaunchClearProcess(copySubject) } return nil } diff --git a/clip/launchClipClearProcessCLI_GENERIC.go b/clip/launchClipClearProcessCLI_GENERIC.go index cdb8d8c..d6ece12 100644 --- a/clip/launchClipClearProcessCLI_GENERIC.go +++ b/clip/launchClipClearProcessCLI_GENERIC.go @@ -10,9 +10,9 @@ import ( "github.com/rwinkhart/libmutton/global" ) -// LaunchClipClearProcess launches the timed clipboard clearing process. +// LaunchClearProcess launches the timed clipboard clearing process. // For non-interactive CLI implementations, an entirely separate process is created for this purpose. -func LaunchClipClearProcess(copySubject string) { +func LaunchClearProcess(copySubject string) { cmd := exec.Command(os.Args[0], "clipclear") cmd.SysProcAttr = global.GetSysProcAttr() _ = back.WriteToStdin(cmd, copySubject) diff --git a/clip/launchClipClearProcessGUI_GENERIC.go b/clip/launchClipClearProcessGUI_GENERIC.go index ada7022..85564f5 100644 --- a/clip/launchClipClearProcessGUI_GENERIC.go +++ b/clip/launchClipClearProcessGUI_GENERIC.go @@ -2,9 +2,9 @@ package clip -// LaunchClipClearProcess launches the timed clipboard clearing process. +// LaunchClearProcess launches the timed clipboard clearing process. // For interactive GUI/TUI implementations, the clipboard clearing process is launched as a goroutine. // copySubject can be omitted to clear the clipboard immediately and unconditionally. -func LaunchClipClearProcess(copySubject string) { - go ClipClearProcess(copySubject) +func LaunchClearProcess(copySubject string) { + go ClearProcess(copySubject) } diff --git a/global/1globals.go b/global/1globals.go index d3fcca5..c15e32c 100644 --- a/global/1globals.go +++ b/global/1globals.go @@ -1,9 +1,7 @@ package global -type ByteInputFetcher func(prompt string) []byte - var ( - GetPassword ByteInputFetcher // Clients should set this to a function that fetches hidden input from the user + GetPassword func(prompt string) []byte // Clients should set this to a function that fetches hidden input from the user RootLength = len(EntryRoot) ) diff --git a/wiki/breaking.md b/wiki/breaking.md index 1e74569..f8fa074 100644 --- a/wiki/breaking.md +++ b/wiki/breaking.md @@ -1,7 +1,2 @@ ## Planned Breaking Changes Leading up to the v1.0.0 release, breaking changes are both expected and planned. These changes are expected to require manual intervention from the end-user, and thus MUTN/libmutton should not be used prior to v1.0.0 if this is not acceptable. - -These changes include, but may expand beyond the following: - -- Password aging data will be stored for each entry (to remind the user when it is time to change passwords) - - Will be included in entry names or in external file (to prevent needing to decrypt entries to access this information) diff --git a/wiki/developers.md b/wiki/developers.md index 448e0e5..6c7e17a 100644 --- a/wiki/developers.md +++ b/wiki/developers.md @@ -7,7 +7,7 @@ libmutton was designed to be usable as a library for building other compatible p Custom build tags can (and sometimes must) be used to achieve desired results. These are as follows: -- `interactive`: If making an interactive interface (GUI/TUI/interactive CLI), you probably need to use this build tag. Without it, your entire program will exit after any given operation is completed. This behavior is only desired for non-interactive CLI implementations, such as MUTN. Currently, most errors will result in the program exiting **even with this build tag**. Specific types of errors (such as config parsing/SSH dialing errors) have been made exempt from this behavior. +- `interactive`: If making an interactive interface (GUI/TUI/interactive CLI), you probably need to use this build tag. Without it, your entire program will exit after any given operation is completed. This behavior is only desired for non-interactive CLI implementations, such as MUTN. - `wsl`: Allows creating a Linux binary that can interact with the Windows clipboard (for WSL) - `termux`: Allows creating an Android binary that can interact with the Termux clipboard (for Android) @@ -17,34 +17,19 @@ These are as follows: - `crypt.RetryPassword`, true by default, determines whether the crypt package should verify user-typed passwords and re-prompt if needed. Turn this off to handle this uniquely in the client. ## 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 `clip.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 `clip.ClearArgument()`. - `startrcwd`: Should be accepted by all libmutton implementations making use of the RCW daemon to cache passwords. Please accept a `startrcwd` argument that calls `crypt.RCWDArgument()`. ## Mobile Clipboard Management In an effort to reduce dependencies not needed in most environments, libmutton no longer provides clipboard management for mobile platforms (except for Termux). This should be handled by your GUI toolkit/framework. ## Configuration -libmutton-based password manager clients should all share the same INI configuration file. +libmutton-based password manager clients should all share the same JSON configuration file. -On UNIX-like systems, this is located at `~/.config/libmutton/libmutton.ini`. On Windows, it is located at `~\AppData\Local\libmutton\config\libmutton.ini`. +On UNIX-like systems, this is located at `~/.config/libmutton/libmuttoncfg.json`. On Windows, it is located at `~\AppData\Local\libmutton\config\libmuttoncfg.json`. + +If creating a third-party client that requires extra configuration to be stored, please use the `ThirdParty` map in the `cfg.ConfigT` type (as used by `cfg.WriteConfig()`) to save your application-specific configuration. -### Base `libmutton.ini` Layout -The current base layout of `libmutton.ini` will change leading up to release v1.0.0. As of right now, the specification is as follows: -``` -[LIBMUTTON] -sshUser = -sshIP = -sshPort = -sshKey = -sshKeyProtected = -sshEntryRoot = -sshIsWindows = -``` -If creating a third-party client that requires extra configuration to be stored, please use the same file and create a new INI section for your application-specific configuration, e.g.: -``` -[THIRD-PARTY-CLIENT-NAME] -configKey = -``` This ensures that a user can use multiple client applications with the same configuration while avoiding conflicts. ## Entry Format diff --git a/wiki/migration.md b/wiki/migration.md index 2b13557..712e5dc 100644 --- a/wiki/migration.md +++ b/wiki/migration.md @@ -1,11 +1,8 @@ ## Migrating From Other Password Managers **Important Notice**: The libmutton entry format is not final and has two [breaking changes planned prior to release v1.0.0](https://github.com/rwinkhart/libmutton/blob/main/wiki/breaking.md). This guide will be updated accordingly. ### pass -#### libmutton < v0.4.0 -libmutton-based password managers (prior to v0.4.0) use GnuPG encryption and an entry format similar to that of [pass](https://www.passwordstore.org/). Because of this, any entries in `pass` format can simply be dropped into `~/.local/share/libmutton`. -#### libmutton >= v0.4.0 -Current libmutton-based password managers use a custom, embedded cryptography agent ([RCW](https://github.com/rwinkhart/rcw)). The layout of the entries themselves has not changed, so gpg-encrypted entries (from `pass` or older libmutton releases) can simply be decrypted and re-encrypted with RCW. A [conversion program](https://github.com/rwinkhart/sshyp-labs/releases/tag/v2.0.0) has been published for this purpose. +Current libmutton-based password managers use a custom, embedded cryptography agent ([RCW](https://github.com/rwinkhart/rcw)). GPG-encrypted entries (from `pass` or libmutton releases prior to v0.4.0) can simply be decrypted and re-encrypted with RCW. A [conversion program](https://github.com/rwinkhart/sshyp-labs/releases/tag/v2.0.0) has been published for this purpose. ### sshyp -`sshyp`, though also `pass`-compatible, makes some changes to the entry format that take effect once the entry has been imported. The changes made by `sshyp` are not compatible with libmutton, and as such `sshyp` entries must be converted before they can be used. A script for exporting to libmutton (prior to v0.4.0) has been published to the `sshyp` extension store. Simply run `sshyp tweak`, go to the "extension management" menu, and download the "export-to-libmutton" extension. After doing this, the `sshyp export` command can be used to export entries in libmutton format. If migrating into libmutton v0.4.0 or later, a second [conversion program](https://github.com/rwinkhart/sshyp-labs/releases/tag/v2.0.0) will be needed to re-encrypt the exported `sshyp` entries. +`sshyp`, though also `pass`-compatible, makes some changes to the entry format that take effect once the entry has been imported. The changes made by `sshyp` are not compatible with libmutton, and as such `sshyp` entries must be converted before they can be used. A script for exporting to libmutton (prior to v0.4.0) has been published to the `sshyp` extension store. Simply run `sshyp tweak`, go to the "extension management" menu, and download the "export-to-libmutton" extension. After doing this, the `sshyp export` command can be used to export entries in libmutton v0.3.X format. If migrating into libmutton v0.4.0 or later, a second [conversion program](https://github.com/rwinkhart/sshyp-labs/releases/tag/v2.0.0) will be needed to re-encrypt the exported `sshyp` entries. ### Other The formats for many other password managers can be converted to the `pass` format with community scripts. Some of these scripts are listed [here](https://www.passwordstore.org/#migration). Once converted, entries can be dropped into `~/.local/share/libmutton`. If migrating into libmutton v0.4.0 or later, a second [conversion program](https://github.com/rwinkhart/sshyp-labs/releases/tag/v2.0.0) will be needed to re-encrypt the converted entries.