mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-25 19:17:48 +02:00
b468c5d0dc
* feat(keys): add --keys flag to dump for cross-host decryption Consumer side of the cross-host key workflow (pairs with #599). ApplyDump wires StaticProviders from a dump.json into matching browsers, so dump --keys f.json -p /copied/data decrypts without native retrievers. * fix(keys): guard --keys against misuse + hint Safari Without -p, dumped keys would be applied to local profile data and decrypt to garbage; -b all hits the same path because pickFromConfigs ignores -p when name == "all". Require both. * chore(keys): address PR #600 Copilot review - example: add -b chrome (without it, --keys + default -b all errors out) - use %q for keysPath in error wrap, matching surrounding style
24 lines
902 B
Go
24 lines
902 B
Go
package keyretriever
|
|
|
|
// StaticProvider returns pre-supplied master-key bytes; used by cross-host workflows where keys come
|
|
// from a Dump rather than platform-native retrieval. RetrieveKey ignores Hints and returns the stored
|
|
// bytes verbatim; an empty StaticProvider returns (nil, nil), the "not applicable" signal accepted
|
|
// by NewMasterKeys when a tier was not present in the source Dump.
|
|
type StaticProvider struct {
|
|
key []byte
|
|
}
|
|
|
|
// NewStaticProvider wraps key bytes as a KeyRetriever. A nil/empty key produces a provider that
|
|
// reports the tier as unavailable (nil, nil) rather than returning a zero-length key.
|
|
func NewStaticProvider(key []byte) *StaticProvider {
|
|
return &StaticProvider{key: key}
|
|
}
|
|
|
|
// RetrieveKey returns the stored key bytes, ignoring Hints.
|
|
func (p *StaticProvider) RetrieveKey(_ Hints) ([]byte, error) {
|
|
if len(p.key) == 0 {
|
|
return nil, nil
|
|
}
|
|
return p.key, nil
|
|
}
|