mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
fix(keychain): clearer message for unsupported v2 keychain (#699)
macOS 26.4+ v2 keychains cannot be unlocked by password; drop the upstream WithKey advice the CLI has no flag for.
This commit is contained in:
1 parent
806277e460
commit
8d1ff7355b
1 file changed
+6
@@ -17,6 +17,9 @@ var ErrLocked = errors.New("login keychain is locked")
|
||||
|
||||
var errNotFound = errors.New("not found in login keychain")
|
||||
|
||||
// errPasswordUnsupported replaces keychainbreaker's advice to pass a key with WithKey, which the CLI has no flag for.
|
||||
var errPasswordUnsupported = errors.New("a password cannot unlock this keychain format (macOS 26.4 and later)")
|
||||
|
||||
type Keychain struct {
|
||||
path string
|
||||
password PasswordFunc
|
||||
@@ -120,6 +123,9 @@ func (k *Keychain) unlock(ctx context.Context) error {
|
||||
return ErrLocked
|
||||
}
|
||||
if err := k.opened.TryUnlock(keychainbreaker.WithPassword(password)); err != nil {
|
||||
if errors.Is(err, keychainbreaker.ErrUnsupportedBlobVersion) {
|
||||
err = errPasswordUnsupported
|
||||
}
|
||||
return fmt.Errorf("%w: %w", ErrLocked, err)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user