Files
HackBrowserData/internal/browser/chromium/vault.go
T
Roger bbd353f314 refactor: run every command on the pipeline (#665)
dump, dumpkeys, archive, restore, and list now run on the app stages, so cmd's old path goes away.
archive writes manifest.json and restore reads it, falling back to today's layout for older archives.
Windows and macOS smoke matched today's output apart from the planned changes.
2026-10-29 14:15:59 +08:00

46 lines
1.0 KiB
Go

package chromium
import (
"fmt"
"github.com/moond4rk/hackbrowserdata/internal/browser"
)
// A keys.json vault names its on-disk format by kind, so a reader without the browser in its table still picks the
// forks' own files.
const (
kindChromium = "chromium"
kindYandex = "chromium-yandex"
kindOpera = "chromium-opera"
)
// kinds holds the forks of overrides; every other Chromium browser is kindChromium.
var kinds = map[string]string{
"yandex": kindYandex,
"opera": kindOpera,
"opera-gx": kindOpera,
"vought": kindOpera,
}
// VaultKind is def's kind in keys.json.
func VaultKind(def browser.Def) string {
if kind, ok := kinds[def.ID]; ok {
return kind
}
return kindChromium
}
// FormatID is the Def.ID whose extractors read a vault of kind; a plain Chromium vault keeps its own id.
func FormatID(kind, id string) (string, error) {
switch kind {
case kindChromium:
return id, nil
case kindYandex:
return "yandex", nil
case kindOpera:
return "opera", nil
default:
return "", fmt.Errorf("unknown engine kind %q", kind)
}
}