diff --git a/go.mod b/go.mod index ce6b13e..7c71e76 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.25.6 require ( github.com/charmbracelet/glamour v0.7.0 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 ) diff --git a/go.sum b/go.sum index 4be2ed6..73c35b1 100644 --- a/go.sum +++ b/go.sum @@ -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-winio v0.1.0 h1:b72agLW+dETGmhR3VbcbwnStfgKfc5AfgJOXBJDkaHg= 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.20260124190333-b963ccf33e54/go.mod h1:4/Ry5uDUaWTdNqVR/URhqM6NveB3dFfxCmO+LyisBcQ= +github.com/rwinkhart/libmutton v0.4.3-0.20260124203434-cb3a554676ff h1:dCxXlKGeTr4EYH+6ps6VC6LMDXlAAuDpyEHMUPCSZEw= +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/go.mod h1:LLHG7YshHEpbpJJP+Il9nx2dnGj5O3VGE32rWmflj0c= github.com/rwinkhart/rcw v0.2.4 h1:FrRSsl+ui1WLmDwqjLSROtFPKqSeGLEfF2SPENt4qP0= diff --git a/mutn.go b/mutn.go index b5c3501..69b4dcc 100644 --- a/mutn.go +++ b/mutn.go @@ -204,7 +204,7 @@ func main() { other.PrintError("Initialization failed: "+err.Error(), 0) } 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 { case 1: newCfg := &config.CfgT{} @@ -230,13 +230,17 @@ func main() { other.PrintError("Failed to age entries: "+err.Error(), 1) } case 4: + verifyEntries(front.InputHidden("RCW Password:")) + case 5: oldPassword := confirmRCWPassword("old") newPassword := confirmRCWPassword("new") fmt.Print("\nRe-encrypting entries...\nPlease wait; do not force close this process.\n\n") if err := core.EntryRefresh(oldPassword, newPassword, false); err != nil { 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": cli.HelpCopy() @@ -273,3 +277,13 @@ func confirmRCWPassword(lowercasePrefix string) []byte { func getTextEditorInput() string { 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") +} diff --git a/packaging/main.sh b/packaging/main.sh index 558ce8a..f1ced1a 100755 --- a/packaging/main.sh +++ b/packaging/main.sh @@ -3,7 +3,7 @@ # get version number from cli package cd .. 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 cd ./packaging diff --git a/packaging/resources/apkbuild-source-stable-optimized.sh b/packaging/resources/apkbuild-source-stable-optimized.sh index fdf9c2b..4c8328a 100644 --- a/packaging/resources/apkbuild-source-stable-optimized.sh +++ b/packaging/resources/apkbuild-source-stable-optimized.sh @@ -41,7 +41,7 @@ build() { esac # 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() { diff --git a/packaging/resources/pkgbuild-git-stable-optimized.sh b/packaging/resources/pkgbuild-git-stable-optimized.sh index ed265a4..fdd3bab 100644 --- a/packaging/resources/pkgbuild-git-stable-optimized.sh +++ b/packaging/resources/pkgbuild-git-stable-optimized.sh @@ -45,7 +45,7 @@ build() { esac # 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() { diff --git a/packaging/resources/release-binaries.sh b/packaging/resources/release-binaries.sh index 55cd822..559d18a 100644 --- a/packaging/resources/release-binaries.sh +++ b/packaging/resources/release-binaries.sh @@ -10,9 +10,9 @@ create_release_binaries() { printf '\nGenerating release binaries...\n' 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 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.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.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 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 }