profile

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 14 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 DataDir

func DataDir(name string) string

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

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

type Options

type Options struct {
	Name     string        // profile name == seed
	CDPBase  string        // e.g. http://127.0.0.1:9222
	Remote   bool          // storage = "remote": durable remote dir, no checkout/checkin
	Interval time.Duration // checkpoint interval; 0 uses the default
}

Options configures a profile session.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is a live checkout of a local-canonical profile into a remote seed. For a remote-persistent profile it is an inert handle (the remote dir is durable, so there is nothing to check out or in).

func Checkout

func Checkout(ctx context.Context, opts Options) (*Session, error)

Checkout starts a session: for a local-canonical profile it takes the single-writer lock, injects the local storage_state into the fresh remote seed, and begins periodic checkpoints. For a remote-persistent profile it returns an inert session. The caller MUST Close the returned session (a deferred Close plus a signal-aware context covers Ctrl-C).

func (*Session) Close

func (s *Session) Close() error

Close checks the session in: it stops the checkpoint loop, performs a final extract+save, and releases the lock. Releasing the lock always happens even if the final save fails, so a crashed browser never wedges the profile. Close is idempotent.

Jump to

Keyboard shortcuts

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