Documentation
¶
Overview ¶
Package chunk stores an arbitrary-size secret across several fixed-capacity credential blobs, hiding the Windows Credential Manager per-blob byte cap behind a header-plus-chunks layout. It is pure and store-agnostic — the caller injects a Store — so the split/join, the commit protocol, and the shrink cleanup are unit-tested on any OS without a real credential store.
Layout: a header blob under the base target records the chunk count and the total length; the payload lives in chunk blobs beside it. The header is written last, so it is the commit point — a crash before it leaves orphaned chunks that no header references, and a header pointing at a missing or short chunk reads back as "not found" rather than as a truncated secret.
Index ¶
Constants ¶
const DefaultMaxBlob = 2560
DefaultMaxBlob is the Windows Credential Manager CRED_MAX_CREDENTIAL_BLOB_SIZE: the most bytes a single credential blob can hold.
Variables ¶
var ErrMissing = errors.New("chunk: target not found")
ErrMissing is what a Store's Get and Delete return for an absent target.
var ErrNotFound = errors.New("chunk: item not found")
ErrNotFound is returned by Get and Delete when no intact chunked item exists: an absent header, or a header that references a missing or short chunk.
Functions ¶
This section is empty.
Types ¶
type Chunker ¶
Chunker splits secrets across a Store's blobs. MaxBlob is the per-blob byte cap (DefaultMaxBlob when zero); tests set a small value to exercise the boundaries.
func (Chunker) Delete ¶
Delete removes the chunks and then the header. An absent item is ErrNotFound, which the caller maps to a no-op so Delete stays idempotent.