Skip to content

Commit 86a7471

Browse files
committed
refactor: remove unused err message
1 parent e9bbe16 commit 86a7471

3 files changed

Lines changed: 5 additions & 22 deletions

File tree

internal/browser/chromium/chromium_darwin.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
)
1818

1919
var (
20-
ErrWrongSecurityCommand = errors.New("macOS wrong security command")
21-
ErrCouldNotFindInKeychain = errors.New("macOS could not find in keychain")
20+
errWrongSecurityCommand = errors.New("wrong security command")
21+
errCouldNotFindInKeychain = errors.New("could not be find in keychain")
2222
)
2323

2424
func (c *chromium) GetMasterKey() ([]byte, error) {
@@ -39,19 +39,19 @@ func (c *chromium) GetMasterKey() ([]byte, error) {
3939
}
4040
if stderr.Len() > 0 {
4141
if strings.Contains(stderr.String(), "could not be found") {
42-
return nil, ErrCouldNotFindInKeychain
42+
return nil, errCouldNotFindInKeychain
4343
}
4444
return nil, errors.New(stderr.String())
4545
}
4646
chromeSecret := bytes.TrimSpace(stdout.Bytes())
4747
if chromeSecret == nil {
48-
return nil, ErrWrongSecurityCommand
48+
return nil, errWrongSecurityCommand
4949
}
5050
chromeSalt := []byte("saltysalt")
5151
// @https://source.chromium.org/chromium/chromium/src/+/master:components/os_crypt/os_crypt_mac.mm;l=157
5252
key := pbkdf2.Key(chromeSecret, chromeSalt, 1003, 16, sha1.New)
5353
if key == nil {
54-
return nil, ErrWrongSecurityCommand
54+
return nil, errWrongSecurityCommand
5555
}
5656
c.masterKey = key
5757
log.Infof("%s initialized master key success", c.name)

internal/decrypter/decrypter_darwin.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
package decrypter
22

3-
import (
4-
"errors"
5-
)
6-
7-
var (
8-
errSecurityKeyIsEmpty = errors.New("input [security find-generic-password -wa 'Chrome'] in terminal")
9-
)
10-
113
func Chromium(key, encryptPass []byte) ([]byte, error) {
124
if len(encryptPass) <= 3 {
135
return nil, errPasswordIsEmpty
146
}
15-
if len(key) == 0 {
16-
return nil, errSecurityKeyIsEmpty
17-
}
187

198
iv := []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}
209
return aes128CBCDecrypt(key, iv, encryptPass[3:])

internal/decrypter/decrypter_windows.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ func Chromium(key, encryptPass []byte) ([]byte, error) {
1111
if len(encryptPass) < 3 {
1212
return nil, errPasswordIsEmpty
1313
}
14-
if len(key) == 0 {
15-
return nil, errSecurityKeyIsEmpty
16-
}
1714

1815
return aesGCMDecrypt(encryptPass[15:], key, encryptPass[3:15])
1916
}
@@ -22,9 +19,6 @@ func ChromiumForYandex(key, encryptPass []byte) ([]byte, error) {
2219
if len(encryptPass) < 3 {
2320
return nil, errPasswordIsEmpty
2421
}
25-
if len(key) == 0 {
26-
return nil, errSecurityKeyIsEmpty
27-
}
2822
// remove Prefix 'v10'
2923
// gcmBlockSize = 16
3024
// gcmTagSize = 16

0 commit comments

Comments
 (0)