Bump libmutton & support new password generation options; bump other dependencies

This commit is contained in:
2025-04-21 12:19:56 -04:00
parent 8166bfcfbe
commit 34136633d9
5 changed files with 55 additions and 40 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) {
if entryType == 0 {
password = string(inputHidden("Password:"))
} else {
password = core.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2, false)
password = inputPasswordGen()
}
totp := string(inputHidden("TOTP secret:"))
+1 -1
View File
@@ -57,7 +57,7 @@ func GenUpdate(targetLocation string, hideSecrets bool) {
unencryptedEntry := core.GetOldEntryData(targetLocation, 0)
// generate a new password
unencryptedEntry[0] = core.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2, false)
unencryptedEntry[0] = inputPasswordGen()
// write and preview the modified entry
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets)
+16
View File
@@ -64,6 +64,22 @@ func inputMenuGen(prompt string, options []string) int {
return inputInt(prompt, len(options))
}
// inputPasswordGen prompts the user for password generation parameters and returns a generated password as a string.
func inputPasswordGen() string {
passLength := inputInt("Password length:", -1)
passCharset := uint8(inputMenuGen("Password complexity:", []string{"Simple", "Complex", "Ultra Complex (not compatible with many services)"}))
var complexity float64
switch passCharset {
case 1:
complexity = 0 // simple
// 1 indicates string gen for filenames, but since complexity is 0, only the base charset is used
default:
complexity = 0.2 // (ultra) complex
// 2 and 3 indicate complex and ultra complex charsets, respectively
}
return core.StringGen(passLength, complexity, passCharset)
}
// writeEntryCLI writes an entry to targetLocation and previews it (errors if no data is supplied).
func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets bool) {
if core.EntryIsNotEmpty(unencryptedEntry) {