Implement entry verification in tweak menu+after entry refresh; disable CGO across the board

This commit is contained in:
2026-01-24 15:58:45 -05:00
parent 8e59d81fff
commit 926eb1f176
7 changed files with 25 additions and 11 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ go 1.25.6
require ( require (
github.com/charmbracelet/glamour v0.7.0 github.com/charmbracelet/glamour v0.7.0
github.com/rwinkhart/go-boilerplate v0.2.2 github.com/rwinkhart/go-boilerplate v0.2.2
github.com/rwinkhart/libmutton v0.4.3-0.20260124190333-b963ccf33e54 github.com/rwinkhart/libmutton v0.4.3-0.20260124203434-cb3a554676ff
golang.org/x/term v0.39.0 golang.org/x/term v0.39.0
) )
+2 -2
View File
@@ -50,8 +50,8 @@ github.com/rwinkhart/go-highlite v0.1.1 h1:9TxbRhYVfD/3YaEgNk1BtEiZ0t8/5mxDUZqNM
github.com/rwinkhart/go-highlite v0.1.1/go.mod h1:mWLMtCWcyV0BG4NeyPyAUGMjPvI0ds6vXmUq89QwBFA= github.com/rwinkhart/go-highlite v0.1.1/go.mod h1:mWLMtCWcyV0BG4NeyPyAUGMjPvI0ds6vXmUq89QwBFA=
github.com/rwinkhart/go-winio v0.1.0 h1:b72agLW+dETGmhR3VbcbwnStfgKfc5AfgJOXBJDkaHg= github.com/rwinkhart/go-winio v0.1.0 h1:b72agLW+dETGmhR3VbcbwnStfgKfc5AfgJOXBJDkaHg=
github.com/rwinkhart/go-winio v0.1.0/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= github.com/rwinkhart/go-winio v0.1.0/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0=
github.com/rwinkhart/libmutton v0.4.3-0.20260124190333-b963ccf33e54 h1:04PtrDqnj6NrrhY5Uu21wc/N3n9lio+WCD6+55xbaIo= github.com/rwinkhart/libmutton v0.4.3-0.20260124203434-cb3a554676ff h1:dCxXlKGeTr4EYH+6ps6VC6LMDXlAAuDpyEHMUPCSZEw=
github.com/rwinkhart/libmutton v0.4.3-0.20260124190333-b963ccf33e54/go.mod h1:4/Ry5uDUaWTdNqVR/URhqM6NveB3dFfxCmO+LyisBcQ= github.com/rwinkhart/libmutton v0.4.3-0.20260124203434-cb3a554676ff/go.mod h1:4/Ry5uDUaWTdNqVR/URhqM6NveB3dFfxCmO+LyisBcQ=
github.com/rwinkhart/peercred-mini v0.1.2 h1:4cGWDbv0whvLeVvbUdx84V/9p+2fS+DEXgrA1KxlRFo= github.com/rwinkhart/peercred-mini v0.1.2 h1:4cGWDbv0whvLeVvbUdx84V/9p+2fS+DEXgrA1KxlRFo=
github.com/rwinkhart/peercred-mini v0.1.2/go.mod h1:LLHG7YshHEpbpJJP+Il9nx2dnGj5O3VGE32rWmflj0c= github.com/rwinkhart/peercred-mini v0.1.2/go.mod h1:LLHG7YshHEpbpJJP+Il9nx2dnGj5O3VGE32rWmflj0c=
github.com/rwinkhart/rcw v0.2.4 h1:FrRSsl+ui1WLmDwqjLSROtFPKqSeGLEfF2SPENt4qP0= github.com/rwinkhart/rcw v0.2.4 h1:FrRSsl+ui1WLmDwqjLSROtFPKqSeGLEfF2SPENt4qP0=
+16 -2
View File
@@ -204,7 +204,7 @@ func main() {
other.PrintError("Initialization failed: "+err.Error(), 0) other.PrintError("Initialization failed: "+err.Error(), 0)
} }
case "tweak": case "tweak":
choice := front.InputMenuGen("Action:", []string{"Set text editor", "Change device ID", "Age all entries", "Change master password/Optimize entries"}) choice := front.InputMenuGen("Action:", []string{"Set text editor", "Change device ID", "Age all entries", "Verify all entries", "Change master password/Optimize entries"})
switch choice { switch choice {
case 1: case 1:
newCfg := &config.CfgT{} newCfg := &config.CfgT{}
@@ -230,13 +230,17 @@ func main() {
other.PrintError("Failed to age entries: "+err.Error(), 1) other.PrintError("Failed to age entries: "+err.Error(), 1)
} }
case 4: case 4:
verifyEntries(front.InputHidden("RCW Password:"))
case 5:
oldPassword := confirmRCWPassword("old") oldPassword := confirmRCWPassword("old")
newPassword := confirmRCWPassword("new") newPassword := confirmRCWPassword("new")
fmt.Print("\nRe-encrypting entries...\nPlease wait; do not force close this process.\n\n") fmt.Print("\nRe-encrypting entries...\nPlease wait; do not force close this process.\n\n")
if err := core.EntryRefresh(oldPassword, newPassword, false); err != nil { if err := core.EntryRefresh(oldPassword, newPassword, false); err != nil {
other.PrintError("Re-encryption failed: "+err.Error(), global.ErrorEncryption) other.PrintError("Re-encryption failed: "+err.Error(), global.ErrorEncryption)
} }
fmt.Println("\nRe-encryption complete.") if front.InputBinary("\nRe-encryption complete. Verify new entries (recommended)?") {
verifyEntries(newPassword)
}
} }
case "copy": case "copy":
cli.HelpCopy() cli.HelpCopy()
@@ -273,3 +277,13 @@ func confirmRCWPassword(lowercasePrefix string) []byte {
func getTextEditorInput() string { func getTextEditorInput() string {
return cmp.Or(front.Input("Text editor (leave blank for $EDITOR, falls back to \""+cli.FallbackEditor+"\"):"), os.Getenv("EDITOR"), cli.FallbackEditor) return cmp.Or(front.Input("Text editor (leave blank for $EDITOR, falls back to \""+cli.FallbackEditor+"\"):"), os.Getenv("EDITOR"), cli.FallbackEditor)
} }
// verifyEntries attempts to verify all entries using the provided RCW password.
func verifyEntries(rcwPassword []byte) {
fmt.Println("Verification in progress; please wait...")
err := core.VerifyEntries(rcwPassword)
if err != nil {
other.PrintError("Verification failed: "+err.Error(), global.ErrorDecryption)
}
fmt.Println("Verification successful")
}
+1 -1
View File
@@ -3,7 +3,7 @@
# get version number from cli package # get version number from cli package
cd .. cd ..
printf 'package main\nimport (\n"fmt"\n"github.com/rwinkhart/MUTN/src/cli"\n)\nfunc main() {\nfmt.Println(cli.MUTNVersion)\n}' > ./version.go printf 'package main\nimport (\n"fmt"\n"github.com/rwinkhart/MUTN/src/cli"\n)\nfunc main() {\nfmt.Println(cli.MUTNVersion)\n}' > ./version.go
version=$(go run -ldflags="-s -w" -tags noMarkdown ./version.go) version=$(go run -ldflags="-s -w" ./version.go)
rm ./version.go rm ./version.go
cd ./packaging cd ./packaging
@@ -41,7 +41,7 @@ build() {
esac esac
# compile binary # compile binary
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go CGO_ENABLED=0 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
} }
package() { package() {
@@ -45,7 +45,7 @@ build() {
esac esac
# compile binary # compile binary
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go CGO_ENABLED=0 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
} }
package() { package() {
+3 -3
View File
@@ -10,9 +10,9 @@ create_release_binaries() {
printf '\nGenerating release binaries...\n' printf '\nGenerating release binaries...\n'
cd .. cd ..
GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=linux GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go GOOS=linux CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=linux GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go GOOS=linux CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=windows GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go GOOS=windows CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
cd ./packaging cd ./packaging
} }