refactor: rename keys package to masterkey

"keys" was too generic — it collided with the keys local var, the keys.MasterKeys field, and the CLI keys subcommand. Folds in PickOptions→DiscoverOptions and browser/ comment cleanup.
This commit is contained in:
moonD4rk
2026-06-01 15:41:40 +08:00
parent c951d7ac16
commit 75b15c6fc4
44 changed files with 210 additions and 262 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/moond4rk/hackbrowserdata/crypto"
"github.com/moond4rk/hackbrowserdata/keys"
"github.com/moond4rk/hackbrowserdata/masterkey"
)
// encryptWithDPAPI encrypts data using Windows DPAPI (CryptProtectData).
@@ -64,7 +64,7 @@ func TestDecryptValue_V10_Windows(t *testing.T) {
// v10 format on Windows: "v10" + nonce(12) + encrypted
ciphertext := append([]byte("v10"), append(nonce, gcmEncrypted...)...)
got, err := decryptValue(keys.MasterKeys{V10: testAESKey}, ciphertext)
got, err := decryptValue(masterkey.MasterKeys{V10: testAESKey}, ciphertext)
require.NoError(t, err)
assert.Equal(t, plaintext, got)
}
@@ -78,7 +78,7 @@ func TestDecryptValue_DPAPI_Windows(t *testing.T) {
require.NotEmpty(t, encrypted)
// No v10/v20 prefix → decryptValue routes to DPAPI path; no per-tier key needed.
got, err := decryptValue(keys.MasterKeys{}, encrypted)
got, err := decryptValue(masterkey.MasterKeys{}, encrypted)
require.NoError(t, err)
assert.Equal(t, plaintext, got)
}