Home

go-spectre @main - refs - log -
-
https://git.jolheiser.com/go-spectre.git
Go implementation for spectre/masterpassword
tree log patch
add flag to get secret from file Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQHLtn9F2wJM4AEjswnDHRLON4OC+4Gukddb1BgGUiNzUjbv6yp0iWrWXsuhr8/3Tds asVdBugvcgta4psG9dlQ8= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
1 month ago
1 changed files, 10 additions(+), 0 deletions(-)
M cmd/spectre/main.go -> cmd/spectre/main.go
diff --git a/cmd/spectre/main.go b/cmd/spectre/main.go
index e457293d61c5920c88d728cdcce953a785a51a3b..25bffd4c39bd4c0be8b3a77113dcae31f7c02888 100644
--- a/cmd/spectre/main.go
+++ b/cmd/spectre/main.go
@@ -28,6 +28,8 @@ 	usernameFlag := fs.String("username", "", "username")
 	fs.StringVar(usernameFlag, "u", *usernameFlag, "--username")
 	secretFlag := fs.String("secret", "", "secret")
 	fs.StringVar(secretFlag, "s", *secretFlag, "--secret")
+	secretFileFlag := fs.String("secret-file", "", "Path to a file containing --secret")
+	fs.StringVar(secretFileFlag, "f", *secretFileFlag, "--secret-file")
 	counterFlag := fs.Int("counter", 1, "counter")
 	fs.IntVar(counterFlag, "c", *counterFlag, "--counter")
 	baseFlag := fs.String("base", "com.lyndir.masterpassword", "scoper base")
@@ -56,6 +58,14 @@ 	}
 
 	if templateFlag == "" {
 		templateFlag = scopeFlag.DefaultTemplate()
+	}
+
+	if *secretFileFlag != "" {
+		secret, err := os.ReadFile(*secretFileFlag)
+		if err != nil {
+			return "", err
+		}
+		*secretFlag = strings.TrimSpace(string(secret))
 	}
 
 	if *usernameFlag == "" || *secretFlag == "" || fs.NArg() < 1 {