mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
encreplica is described in its own header as the SOLE at-rest boundary for the replica stream — without it every base's SQLite pages hit the backend in the clear. It sat at 22.3%, with WriteLTXFile, OpenLTXFile, ageSeal and ageOpen all at zero: the existing tests covered the local blob store and the constructor and stopped at the encryption. Six properties now hold it, and the first is the reason the package exists: the body written through this client is NOT findable in the stored blob, and neither is the LTX header. Only the 16 bytes this client writes itself are cleartext, and their contents are pinned too — restore reads Size and CreatedAt from that prefix without decrypting, so a wrong length or a lost timestamp breaks recovery somewhere far from here. The rest: a round trip is byte-identical including through the offset/size window replicate's resumable reader drives; an offset past the end yields nothing rather than panicking; another base's key opens nothing, which is the per-org boundary itself, one shared backend and keys that are not; a flipped bit is refused rather than returned; and a missing segment still satisfies os.ErrNotExist, which is how replicate tells "not replicated yet" from "the backend is broken". Verified by removing the seal — storing plain where ct belongs — and watching the first test say the plaintext body is present in the stored blob. store/encreplica 22.3% -> 72.3%. Co-authored-by: Hanzo Dev <[email protected]>