Documentation
¶
Overview ¶
Package app runs the pipeline: Validate, Discover, NewPlan, Execute, and Report.
Index ¶
- func Archive(ctx context.Context, discovery Discovery, options Options, archivePath string) (int, error)
- func DumpKeys(ctx context.Context, discovery Discovery, options Options) (masterkey.Dump, error)
- func Report(writer io.Writer, summary Summary) error
- type Discovery
- type Extraction
- type Flags
- type Options
- type Outcome
- type Plan
- type RestoreFlags
- type Result
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Archive ¶
func Archive(ctx context.Context, discovery Discovery, options Options, archivePath string) (int, error)
Archive returns how many files and directories it captured.
Types ¶
type Discovery ¶
type Discovery struct {
Dirs []browser.UserDataDir
Failed []Result
}
Discovery holds an error result per browser whose data could not be read, so it is reported, not taken as absence.
func RestoreDiscovery ¶
func RestoreDiscovery( root string, dump masterkey.Dump, options Options, ) (Discovery, map[browser.UserDataDirID]masterkey.Set, error)
RestoreDiscovery rebuilds the user data dirs under root, and their keys, from the dump: each vault names a subdirectory of root, or root is one browser's User Data.
type Extraction ¶
type Extraction struct {
UserDataDirID browser.UserDataDirID
Profile string // Profile.Name; "" in a result about a whole user data dir
Category category.Category // zero in a result about a whole user data dir
}
Extraction is plain data, looked up again when it runs, so a Plan prints as it is and compares with DeepEqual.
type Options ¶
type Options struct {
Browser string // "all" or one Browser.Name
Categories []category.Category
Format export.Format
Dir string
Zip bool
ProfilePath string
Home string
// KeychainPassword runs when the keychain first opens; "" leaves it locked, and nil, as list has it, silently.
KeychainPassword func(ctx context.Context) (string, error)
// Keys are a dump's keys by user data dir; nil retrieves every dir's keys from this machine.
Keys map[browser.UserDataDirID]masterkey.Set
}
func ListOptions ¶
ListOptions is what list reads: every browser and category, with the keychain left locked, so counting never prompts.
func Validate ¶
Validate checks every flag before any browser or secret is touched, so a bad flag fails fast.
func ValidateArchive ¶
ValidateArchive takes no keychain password: an archive copies files and reads no secret.
func ValidateKeys ¶
func ValidateRestore ¶
func ValidateRestore(flags RestoreFlags) (Options, masterkey.Dump, error)
ValidateRestore checks restore's flags and reads its keys before any data is opened. A restore's browsers are the dump's vaults, not this OS's table, so -b is checked against them.
type Outcome ¶
type Outcome int
Outcome is how one extraction ended. It starts at 1, so a result whose outcome was never set does not read as ok.
type Plan ¶
type Plan struct {
Dirs []browser.UserDataDir
Files []snapshot.File
Extractions []Extraction
Skipped []Result
}
Plan lists extractions in output order, each file to capture once, and the requested extractions that cannot run.
type RestoreFlags ¶
type RestoreFlags struct {
Keys string // a keys.json path, or "-" for stdin
DataDir string
DataZip string
Browser string
Categories string
Format string
Dir string
Zip bool
}
RestoreFlags are restore's command-line values as cobra parsed them.
type Result ¶
type Result struct {
Extraction
Outcome Outcome
Count int // records emitted
Failed int // record-level problems reported
Err error // set when Outcome is OutcomeError
}
Result is one extraction's outcome, or a failure of a whole user data dir when Profile and Category are empty.