Documentation
¶
Overview ¶
Package masterkey retrieves Chromium master keys (per-platform retrievers + a cross-host Dump format). Firefox and Safari own their own key paths and don't route through here.
Index ¶
Constants ¶
const DumpVersion = "2"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainRetriever ¶
type ChainRetriever struct {
// contains filtered or unexported fields
}
ChainRetriever tries retrievers in order, first success wins (macOS V10: gcoredump→password→security).
func (*ChainRetriever) RetrieveKey ¶
func (c *ChainRetriever) RetrieveKey(hints Hints) ([]byte, error)
type DBusRetriever ¶
type DBusRetriever struct{}
DBusRetriever queries GNOME Keyring / KDE Wallet via D-Bus Secret Service.
func (*DBusRetriever) RetrieveKey ¶
func (r *DBusRetriever) RetrieveKey(hints Hints) ([]byte, error)
type Dump ¶
type Dump struct {
Version string `json:"version"`
CreatedAt time.Time `json:"created_at"`
Host Host `json:"host"`
Vaults []Vault `json:"vaults"`
}
Dump is the portable, cross-host container for Chromium master keys — produce it on one host to decrypt copied profile data on another without DPAPI / ABE / Keychain / D-Bus.
type Hints ¶
type Hints struct {
KeychainLabel string // macOS Keychain account / Linux D-Bus Secret Service label
WindowsABEKey string // Windows ABE browser key (e.g. "chrome"); "" → ABE not applicable
LocalStatePath string // path to (temp-copied) Local State JSON; only used on Windows
}
Hints bundles inputs for Retriever; each retriever reads only the field that applies to it.
type Host ¶
type Host struct {
OS string `json:"os"`
Arch string `json:"arch"`
Hostname string `json:"hostname,omitempty"`
User string `json:"user,omitempty"`
}
Host OS / Arch always set; Hostname / User best-effort (empty on syscall failure).
type MasterKeys ¶
type MasterKeys struct {
V10 []byte `json:"v10,omitempty"`
V11 []byte `json:"v11,omitempty"`
V20 []byte `json:"v20,omitempty"`
}
MasterKeys holds one key per cipher tier; a profile can mix tiers (Win v10+v20, Linux v10+v11), so each is populated independently. A nil tier = that cipher version can't be decrypted.
func NewMasterKeys ¶
func NewMasterKeys(r Retrievers, hints Hints) (MasterKeys, error)
NewMasterKeys fetches each non-nil tier and joins per-tier errors. A retriever returning (nil, nil) means "tier not applicable" and contributes no key. Never logs — the caller decides severity.
func (MasterKeys) HasAny ¶
func (k MasterKeys) HasAny() bool
type PosixRetriever ¶
type PosixRetriever struct{}
PosixRetriever derives Chromium's kV10Key via PBKDF2 over the hardcoded "peanuts" password — the deterministic v10 key used when no keyring exists (headless/Docker/CI). Mirrors PosixKeyProvider.
func (*PosixRetriever) RetrieveKey ¶
func (r *PosixRetriever) RetrieveKey(_ Hints) ([]byte, error)
type Retriever ¶
Retriever obtains a Chromium master key from one platform source (DPAPI, Keychain, D-Bus, …).
type Retrievers ¶
Retrievers is the per-tier retriever configuration; unused slots are nil.
func DefaultRetrievers ¶
func DefaultRetrievers() Retrievers
DefaultRetrievers wires the Linux tiers, one per prefix Chromium emits: v10 = PBKDF2("peanuts") (kV10Key, no keyring); v11 = PBKDF2(keyring secret) (kV11Key, via D-Bus). A profile can carry both if the host moved between headless and keyring sessions, so both run independently.
type StaticRetriever ¶
type StaticRetriever struct {
// contains filtered or unexported fields
}
StaticRetriever returns pre-supplied key bytes (from a Dump) instead of platform retrieval, ignoring Hints. An empty key returns (nil, nil) — the "tier not applicable" signal NewMasterKeys expects.
func NewStaticRetriever ¶
func NewStaticRetriever(key []byte) *StaticRetriever
NewStaticRetriever wraps key bytes; a nil/empty key yields a retriever that reports the tier unavailable.
func (*StaticRetriever) RetrieveKey ¶
func (p *StaticRetriever) RetrieveKey(_ Hints) ([]byte, error)
type Vault ¶
type Vault struct {
Browser string `json:"browser"`
Kind string `json:"kind"`
UserDataDir string `json:"user_data_dir"`
Profiles []string `json:"profiles"`
Keys MasterKeys `json:"keys"`
}
Vault groups profiles sharing master keys (master keys are per-installation, not per-profile). Browser is the lookup key (e.g. "chrome"); Kind is the engine ("chromium"|"chromium-yandex"| "chromium-opera") so a consumer can rebuild the engine without the local browser table.