profile

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package profile keeps a browser profile's auth state (cookies + per-origin localStorage) canonical on the local machine and checks it in and out of an otherwise-ephemeral remote browser seed over CDP.

A named profile is a cuttle seed. Its storage_state.json lives under $XDG_DATA_HOME/cuttle/profiles/<name>/. On session start the state is injected into the fresh remote seed; during and at the end of the session it is extracted back and written atomically, so a crash loses at most one checkpoint interval of cookie deltas. "Resides locally" is true at rest; a live session necessarily holds the cookies on the remote to act as the user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CandidateOrigins added in v0.7.0

func CandidateOrigins(st *cdp.StorageState) []string

CandidateOrigins is the set of origins a checkin re-reads localStorage from: origins already recorded in the state, plus https origins derived from cookie domains, so a fresh login's localStorage is captured even before its origin is first recorded. localStorage is origin-scoped, so unknown origins cannot be discovered without visiting them. Exported so the serve daemon derives the same origin set when it extracts a seed's state over its own loopback CDP. Nil-safe.

func CarryForward added in v0.7.0

func CarryForward(prior, st *cdp.StorageState, failed []string) *cdp.StorageState

CarryForward re-attaches prior localStorage for origins that failed to load this pass, so an unconditional overwrite never drops persisted state on a transient per-origin blip. It is the in-memory core of carryForwardLocalStorage (which loads prior from disk first); the serve daemon calls it directly with the prior snapshot it already holds. A nil prior carries nothing forward.

func DataDir

func DataDir(name string) string

DataDir is $XDG_DATA_HOME/cuttle/profiles/<name>, falling back to ~/.local/share.

func HasState added in v0.8.0

func HasState(st *cdp.StorageState) bool

HasState reports whether a storage_state carries anything worth restoring (any cookie or origin). An empty state is a brand-new profile, not a login to push.

func ListLocal added in v0.8.0

func ListLocal() []string

ListLocal returns every profile name that has a saved storage_state on disk, so `up` can restore each into a box that lacks it. Best-effort: an unreadable or missing store yields no names rather than an error. Reserved/invalid directory names are skipped.

func LoadLocal added in v0.8.0

func LoadLocal(name string) (*cdp.StorageState, error)

LoadLocal reads a profile's local canonical storage_state. A missing file yields an empty state (not an error), so a brand-new profile reads clean. It is the read side of the local-canonical restore: `up` loads each profile's state to seed the daemon of a fresh/recreated box.

func SaveState added in v0.7.0

func SaveState(name string, st *cdp.StorageState) error

SaveState writes a profile's storage_state.json to its local canonical dir. It is the entry point for the CLI's local-canonical pull (down captures a running seed's state into the local store) and validates the name against the seed grammar (reserved names rejected) so a stray key never lands in the store.

func ValidName

func ValidName(name string) bool

ValidName reports whether name is a legal profile name. A profile name is a cuttle seed, so it shares the seed grammar (fingerprint.ValidSeed).

Types

This section is empty.

Jump to

Keyboard shortcuts

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