feat: add interactive terminal password prompt for keychain unlock (#558)

* feat(darwin): add interactive terminal password prompt for keychain unlock (#556)
* test: add unit tests for keyretriever and address review feedback

- Add errStorageNotFound sentinel error for precise error matching
- Non-TTY TerminalPasswordRetriever returns nil silently (review #558)
- Add darwin tests: findStorageKey, empty password, non-TTY skip
- Add linux tests: FallbackRetriever peanuts key, DefaultRetriever chain

* fix: add nolint:unused for errStorageNotFound on Windows, clean up error message

errStorageNotFound is only used on darwin/linux; Windows lint flagged it
as unused. Also simplify error format to avoid "storage" duplication.

* fix: add nolint:unused for errStorageNotFound, simplify error message

errStorageNotFound is only referenced on darwin and linux; Windows lint
flags it as unused. Also remove redundant "storage" prefix from the
error format string.
This commit is contained in:
Roger
2026-04-06 01:27:13 +08:00
committed by GitHub
parent 4c3dd9704f
commit ccc8643d86
8 changed files with 181 additions and 27 deletions
+3 -2
View File
@@ -8,10 +8,12 @@ require (
github.com/otiai10/copy v1.14.1
github.com/ppacher/go-dbus-keyring v1.0.1
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.11.1
github.com/syndtr/goleveldb v1.0.0
github.com/tidwall/gjson v1.18.0
golang.org/x/sys v0.27.0
golang.org/x/sys v0.30.0
golang.org/x/term v0.29.0
modernc.org/sqlite v1.31.1
)
@@ -27,7 +29,6 @@ require (
github.com/otiai10/mint v1.6.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
golang.org/x/sync v0.8.0 // indirect