Switch to dependence on github.com/rwinkhart/libmutton

This commit is contained in:
2024-08-08 17:24:48 -04:00
parent 57378c521a
commit a23ae4a4b9
11 changed files with 114 additions and 110 deletions
+5 -5
View File
@@ -5,21 +5,21 @@ import (
"os"
"strings"
"github.com/rwinkhart/MUTN/src/backend"
"github.com/rwinkhart/libmutton/core"
)
// AddEntry creates a new entry at targetLocation by taking user input via CLI prompts
// entryType: 0 = standard (password), 1 = auto-generated password, 2 = note
func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) {
// ensure target location does not already exist
_, isAccessible := backend.TargetIsFile(targetLocation, false, 0)
_, isAccessible := core.TargetIsFile(targetLocation, false, 0)
if isAccessible {
fmt.Println(backend.AnsiError + "Target location already exists" + backend.AnsiReset)
fmt.Println(core.AnsiError + "Target location already exists" + core.AnsiReset)
os.Exit(1)
}
// ensure target containing directory exists and is a directory (not a file)
backend.TargetIsFile(targetLocation[:strings.LastIndex(targetLocation, "/")], true, 1)
core.TargetIsFile(targetLocation[:strings.LastIndex(targetLocation, "/")], true, 1)
var unencryptedEntry []string
@@ -31,7 +31,7 @@ func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) {
if entryType == 0 {
password = inputHidden("Password:")
} else {
password = backend.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:")