Port to latest libmutton development version & begin migration from GPG to RCW

This commit is contained in:
2025-05-04 18:07:02 -04:00
parent b366d1e13e
commit a144b2769d
9 changed files with 56 additions and 44 deletions
+17 -1
View File
@@ -8,9 +8,24 @@ import (
"github.com/rwinkhart/libmutton/core"
"github.com/rwinkhart/libmutton/sync"
"github.com/rwinkhart/rcw/wrappers"
"golang.org/x/term"
)
// GetRCWPassphrase retrieves the RCW passphrase from the user.
// TODO attempt to retrieve from RCW daemon
func GetRCWPassphrase() []byte {
for {
passphrase := inputHidden("RCW Passphrase:")
err := wrappers.RunSanityCheck(core.ConfigDir+"/sanity.rcw", passphrase)
if err != nil {
fmt.Println(core.AnsiError + "Failed to encrypt - " + err.Error() + core.AnsiReset)
continue
}
return passphrase
}
}
// input prompts the user for input and returns the input as a string.
func input(prompt string) string {
fmt.Print("\n" + prompt + " ")
@@ -85,7 +100,8 @@ func inputPasswordGen() string {
func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets bool) {
if core.EntryIsNotEmpty(unencryptedEntry) {
// write the entry to the target location
core.WriteEntry(targetLocation, unencryptedEntry)
joinedUnencryptedEntry := strings.Join(unencryptedEntry, "\n")
core.WriteEntry(targetLocation, []byte(joinedUnencryptedEntry), GetRCWPassphrase())
// preview the entry
fmt.Println(AnsiBold + "\nEntry Preview:" + core.AnsiReset)
EntryReader(unencryptedEntry, hideSecrets, true)