Documentation
¶
Overview ¶
Package browserauth borrows a live browser session by extracting specific cookies for a domain from the user's installed browsers. It is the reusable "borrow-the-browser-session" primitive (the same shape slackctl uses for xoxc/xoxd): configure an Extractor with a domain and the set of cookie names you need, and Extract returns them plus the source browser/profile they came from. The browser-reading itself is behind a seam, so callers (and tests) can inject cookies without ever touching a real browser store.
This package is deliberately self-contained and org-agnostic — a future cookie-auth CLI can import it and only change Domain / RequiredCookieNames.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Extractor ¶
type Extractor struct {
// Domain is the cookie domain suffix to match, e.g. ".linkedin.com".
Domain string
// Browsers optionally restricts extraction to these browser names (case-insensitive:
// "chrome", "brave", "firefox", "chromium", "edge"). Empty means "any browser".
Browsers []string
// RequiredCookieNames are the cookies that MUST all be present from a single source for a
// successful extraction (e.g. []string{"li_at", "JSESSIONID"}).
RequiredCookieNames []string
// contains filtered or unexported fields
}
Extractor pulls a required set of cookies for one domain out of the browser stores.
func (*Extractor) Extract ¶
Extract returns the required cookies as a name→value map plus a human-readable source ("chrome (Default)"). It succeeds only when a SINGLE source (one browser+profile) supplies every RequiredCookieName — mixing cookies from two sessions would produce an invalid pair. An error names exactly what was missing so the user knows to log in / pick another browser.
func (*Extractor) WithFinder ¶
WithFinder overrides the cookie source (tests inject a fake so they never read a real browser).