mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-05 16:47:20 -04:00
Bump libmutton and support new SSH identity file passphrase entry
This commit is contained in:
@@ -5,7 +5,7 @@ go 1.23.4
|
|||||||
require (
|
require (
|
||||||
github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514
|
github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514
|
||||||
github.com/charmbracelet/glamour v0.7.0
|
github.com/charmbracelet/glamour v0.7.0
|
||||||
github.com/rwinkhart/libmutton v0.2.5-0.20241221012916-619e4220a60f
|
github.com/rwinkhart/libmutton v0.2.5-0.20241228200917-a4a39a3a995d
|
||||||
golang.org/x/term v0.27.0
|
golang.org/x/term v0.27.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
|||||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
github.com/rwinkhart/convertroman v0.2.0 h1:otUm939eXT77q/Lr31mJtMwVWEw0RjEUB71gO65h9OM=
|
github.com/rwinkhart/convertroman v0.2.0 h1:otUm939eXT77q/Lr31mJtMwVWEw0RjEUB71gO65h9OM=
|
||||||
github.com/rwinkhart/convertroman v0.2.0/go.mod h1:Af6HqvX0EIM4Y3HcnNXbbRey1dLasGB7WU0+3Cowgmw=
|
github.com/rwinkhart/convertroman v0.2.0/go.mod h1:Af6HqvX0EIM4Y3HcnNXbbRey1dLasGB7WU0+3Cowgmw=
|
||||||
github.com/rwinkhart/libmutton v0.2.5-0.20241221012916-619e4220a60f h1:5wWhTS6vS1ozb/j31eSLK32kK0ntAooJSlWNnvpRL2A=
|
github.com/rwinkhart/libmutton v0.2.5-0.20241228200917-a4a39a3a995d h1:o9fIg0X3BsGUnVQuQ7SqEDHkCCPFTZIxrrjC2sWmdxc=
|
||||||
github.com/rwinkhart/libmutton v0.2.5-0.20241221012916-619e4220a60f/go.mod h1:PdB+cyRsd3F4Uwxx8EJCRraJTwbvvrynY9iQVr/V+Wg=
|
github.com/rwinkhart/libmutton v0.2.5-0.20241228200917-a4a39a3a995d/go.mod h1:RLpxGyaNGqMgzRf7Qo4q4sBPnUH6Rjt8B6SE5Rp8gXM=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ func main() {
|
|||||||
case "clipclear":
|
case "clipclear":
|
||||||
core.ClipClearArgument()
|
core.ClipClearArgument()
|
||||||
case "sync":
|
case "sync":
|
||||||
sync.RunJob(true)
|
cli.RunJobWrapper(true)
|
||||||
case "init":
|
case "init":
|
||||||
cli.TempInitCli()
|
cli.TempInitCli()
|
||||||
case "tweak":
|
case "tweak":
|
||||||
|
|||||||
+2
-2
@@ -29,12 +29,12 @@ func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) {
|
|||||||
// determine whether to generate the password
|
// determine whether to generate the password
|
||||||
var password string
|
var password string
|
||||||
if entryType == 0 {
|
if entryType == 0 {
|
||||||
password = inputHidden("Password:")
|
password = string(inputHidden("Password:"))
|
||||||
} else {
|
} else {
|
||||||
password = core.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2, false)
|
password = core.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
totp := inputHidden("TOTP secret:")
|
totp := string(inputHidden("TOTP secret:"))
|
||||||
url := input("URL:")
|
url := input("URL:")
|
||||||
if inputBinary("Add a note to this entry?") {
|
if inputBinary("Add a note to this entry?") {
|
||||||
note, _ := editNote([]string{})
|
note, _ := editNote([]string{})
|
||||||
|
|||||||
+2
-2
@@ -29,11 +29,11 @@ func EditEntryField(targetLocation string, hideSecrets bool, field int) {
|
|||||||
// edit the field
|
// edit the field
|
||||||
switch field {
|
switch field {
|
||||||
case 0:
|
case 0:
|
||||||
unencryptedEntry[field] = inputHidden("Password:")
|
unencryptedEntry[field] = string(inputHidden("Password:"))
|
||||||
case 1:
|
case 1:
|
||||||
unencryptedEntry[field] = input("Username:")
|
unencryptedEntry[field] = input("Username:")
|
||||||
case 2:
|
case 2:
|
||||||
unencryptedEntry[field] = inputHidden("TOTP secret:")
|
unencryptedEntry[field] = string(inputHidden("TOTP secret:"))
|
||||||
case 3:
|
case 3:
|
||||||
unencryptedEntry[field] = input("URL:")
|
unencryptedEntry[field] = input("URL:")
|
||||||
case 4: // edit notes fields
|
case 4: // edit notes fields
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/rwinkhart/libmutton/core"
|
"github.com/rwinkhart/libmutton/core"
|
||||||
"github.com/rwinkhart/libmutton/sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const ansiShownPassword = "\033[38;5;10m"
|
const ansiShownPassword = "\033[38;5;10m"
|
||||||
@@ -63,7 +62,7 @@ func EntryReader(decryptedEntry []string, hideSecrets, syncEnabled bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if syncEnabled {
|
if syncEnabled {
|
||||||
sync.RunJob(false)
|
RunJobWrapper(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rwinkhart/libmutton/core"
|
"github.com/rwinkhart/libmutton/core"
|
||||||
|
"github.com/rwinkhart/libmutton/sync"
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,13 +19,12 @@ func input(prompt string) string {
|
|||||||
return strings.TrimRight(userInput, "\n\r ") // remove trailing newlines, carriage returns, and spaces
|
return strings.TrimRight(userInput, "\n\r ") // remove trailing newlines, carriage returns, and spaces
|
||||||
}
|
}
|
||||||
|
|
||||||
// inputHidden prompts the user for input and returns the input as a string, hiding the input from the terminal.
|
// inputHidden prompts the user for input and returns the input as a byte array, hiding the input from the terminal.
|
||||||
func inputHidden(prompt string) string {
|
func inputHidden(prompt string) []byte {
|
||||||
fmt.Print("\n" + prompt + " ")
|
fmt.Print("\n" + prompt + " ")
|
||||||
byteInput, _ := term.ReadPassword(int(os.Stdin.Fd()))
|
byteInput, _ := term.ReadPassword(int(os.Stdin.Fd()))
|
||||||
password := string(byteInput)
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
return password
|
return byteInput
|
||||||
}
|
}
|
||||||
|
|
||||||
// inputInt prompts the user for input and returns the input as an integer.
|
// inputInt prompts the user for input and returns the input as an integer.
|
||||||
@@ -82,3 +82,9 @@ func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets
|
|||||||
func expandPathWithHome(path string) string {
|
func expandPathWithHome(path string) string {
|
||||||
return strings.Replace(path, "~", core.Home, 1)
|
return strings.Replace(path, "~", core.Home, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RunJobWrapper is a wrapper for sync.RunJob that sets the passphrase input function to inputHidden.
|
||||||
|
func RunJobWrapper(manualSync bool) {
|
||||||
|
core.PassphraseInputFunction = inputHidden
|
||||||
|
sync.RunJob(manualSync)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user