chromepaths

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package chromepaths centralizes the on-disk Chrome profile paths agentcookie reads and writes. Supports macOS and Linux.

v0.7 scope: Default profile only. v0.8+ discovers extra profiles (Profile N, Guest Profile, agent user-data-dirs) via Discover().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChromeProfileRoot added in v1.0.0

func ChromeProfileRoot() string

ChromeProfileRoot returns the user's Chrome user-data-dir on the current OS. On macOS: ~/Library/Application Support/Google/Chrome On Linux: ~/.config/google-chrome

func CookiesDB

func CookiesDB() string

CookiesDB returns the SQLite path for the Default profile's cookies. Checks Network/Cookies first (Chrome 96+), then falls back to Cookies.

func DefaultProfileDir

func DefaultProfileDir() string

DefaultProfileDir returns the path to the Default profile dir.

func IndexedDBDir

func IndexedDBDir() string

IndexedDBDir returns the dir holding the Default profile's IndexedDB stores (one subdir per origin).

func LocalStorageLevelDB

func LocalStorageLevelDB() string

LocalStorageLevelDB returns the dir holding the Default profile's localStorage LevelDB.

func MacChromeProfileRoot deprecated

func MacChromeProfileRoot() string

MacChromeProfileRoot returns the user's Chrome user-data-dir on macOS:

~/Library/Application Support/Google/Chrome

Deprecated: Use ChromeProfileRoot() which is OS-aware.

func SidecarCookiesDB

func SidecarCookiesDB() string

SidecarCookiesDB returns the agentcookie bridge sidecar path. PP CLIs read from this file (or honor the AGENTCOOKIE_PLAIN_COOKIES env var pointing at it) to get cookies without Keychain access. Plaintext values, Chrome-shaped schema. Default location is ~/.agentcookie/cookies-plain.db, mode 0600.

Types

type DiscoverResult added in v1.0.0

type DiscoverResult struct {
	// Stores is the list of usable cookie stores found.
	Stores []Store

	// Skipped is the list of profile directories found but not usable.
	Skipped []SkippedStore
}

DiscoverResult holds the outcome of a discovery pass.

func Discover added in v1.0.0

func Discover() DiscoverResult

Discover scans known Chrome user-data-dirs and returns all usable cookie stores. A store is usable if a Cookies file exists at either <profile>/Cookies or <profile>/Network/Cookies. Local State is NOT required (matches real-world agent Chromes that lack it).

The result includes both Stores (usable) and Skipped (found but not usable, with reasons), so doctor/status can report skip reasons.

func DiscoverForConfig added in v1.0.0

func DiscoverForConfig(profileDir string) DiscoverResult

DiscoverForConfig returns stores that match the optional config constraints. If profileDir is non-empty, it's treated as an explicit user-data-dir to include in discovery. If profileDir contains profile subdirectories (Default, Profile N), those are scanned the same way Discover scans standard roots. Otherwise, profileDir itself is probed as a profile.

type SkippedStore added in v1.0.0

type SkippedStore struct {
	Root    string
	Profile string
	Reason  string
}

SkippedStore is a profile directory that was found but cannot be used, along with the reason it was skipped.

type Store added in v1.0.0

type Store struct {
	// Root is the user-data-dir containing this profile (e.g.
	// ~/Library/Application Support/Google/Chrome).
	Root string

	// Profile is the profile directory name (e.g. "Default", "Profile 1").
	Profile string

	// CookiesPath is the resolved path to the Cookies SQLite file.
	// Either Root/Profile/Cookies or Root/Profile/Network/Cookies.
	CookiesPath string

	// IsDefault is true when this is the historical Default profile in
	// the OS-standard Chrome root. Distinguishes "the" profile agentcookie
	// v0.7 read from extra profiles.
	IsDefault bool

	// Browser identifies which browser this store belongs to (e.g.
	// "chrome", "chromium", "brave", "edge").
	Browser string
}

Store represents a discovered Chrome cookie store that may be readable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL