feat(restore): cross-platform restore via dump engine rebuild (#606) (#611)

* feat(restore): cross-platform restore via dump engine rebuild (#606)

Restore previously required the dump's origin OS, overlaying keys onto locally-discovered browsers. It now rebuilds Chromium engines from the dump's vaults (v2 adds engine kind), so copied data or an archive zip decrypts on any OS.

* fix(restore): polish help text, drop dead check, dedup dump kinds

pflag treats backticked words in flag usage as the value placeholder,
so --data-zip rendered as "--data-zip archive" in help output.
This commit is contained in:
Roger
2026-06-12 20:53:00 +08:00
committed by GitHub
parent 8d8bd81790
commit bf96ba8c80
11 changed files with 493 additions and 189 deletions
+19
View File
@@ -81,6 +81,25 @@ const (
Safari
)
// String returns the canonical lowercase name of the engine kind; the chromium-family values are
// also the stable wire form carried in a keys dump, so don't change them lightly.
func (k BrowserKind) String() string {
switch k {
case Chromium:
return "chromium"
case ChromiumYandex:
return "chromium-yandex"
case ChromiumOpera:
return "chromium-opera"
case Firefox:
return "firefox"
case Safari:
return "safari"
default:
return "unknown"
}
}
// BrowserConfig holds the declarative configuration for a browser installation.
type BrowserConfig struct {
Key string // lookup key; doubles as the Windows ABE / winutil.Table key when WindowsABE is true
+17
View File
@@ -27,6 +27,23 @@ func TestCategory_String(t *testing.T) {
}
}
func TestBrowserKind_String(t *testing.T) {
tests := []struct {
kind BrowserKind
want string
}{
{Chromium, "chromium"},
{ChromiumYandex, "chromium-yandex"},
{ChromiumOpera, "chromium-opera"},
{Firefox, "firefox"},
{Safari, "safari"},
{BrowserKind(999), "unknown"},
}
for _, tt := range tests {
assert.Equal(t, tt.want, tt.kind.String())
}
}
func TestCategory_IsSensitive(t *testing.T) {
sensitive := []Category{Password, Cookie, CreditCard}
for _, c := range sensitive {