Skip to main content

Crate snss

Crate snss 

Source
Expand description

snss — a read-only decoder for Chromium/Brave SNSS session files.

The crate is a pure decoder: it reads bytes and returns a typed model. It has no UI, performs no clipboard or launch side effects, and exposes no write path — mutating Brave’s store is structurally impossible through this API.

Milestone 1 (this module) covers the container framing only: validate the SNSS header and split the command stream into Records. Higher layers (Pickle decode, replay) build on top of these records.

Structs§

Nav
One back/forward history entry of a tab.
NavCommand
A decoded UpdateTabNavigation command: which tab, which back/forward position, and the URL + title recorded at that position.
Record
One command record from the append-only stream.
RecordStream
The result of reading a record stream: the container version, every decoded Record in stream order, and any non-fatal Warnings.
Replayed
The result of replaying one file’s command log.
SessionStore
A read-only, in-memory snapshot of a Brave profile’s Sessions directory.
Source
One decoded session file: its kind, path, and reconstructed windows.
Tab
A reconstructed tab: its history and which entry is current.
Window
A reconstructed window holding ordered tabs.

Enums§

Dialect
Which command-id mapping a file uses. Session_*/Apps_* files and the recently-closed Tabs_* files number their commands differently.
PickleError
A malformed navigation payload. Surfaced as a typed error so the caller can count it as a warning rather than crash or emit a silently-wrong row.
SnssError
A fatal error that prevents producing any model at all.
SourceKind
Which on-disk file family a Source came from.
Warning
A non-fatal decode anomaly. The model is still usable; warnings record where and why something was skipped so nothing fails silently.

Constants§

MAGIC
The 4-byte magic every SNSS file begins with.
SUPPORTED_VERSION
The only container version observed in the wild (and the only one supported).

Functions§

decode_navigation
Decode an UpdateTabNavigation payload into a NavCommand.
read_records
Read an SNSS command stream from any byte source.
replay
Replay an append-only command RecordStream into the logical Window/Tab/Nav tree, applying last-write-wins per (tab, index) and resolving each tab’s current entry and pinned state.