Skip to content

Defined in: packages/cas/src/content-addressed-store.ts:45

Options for contentAddressedStore.

readonly backend: ArtifactBackend

Defined in: packages/cas/src/content-addressed-store.ts:47

Where bytes are stored and read. The store never assumes it is local.


readonly hash: (bytes) => string

Defined in: packages/cas/src/content-addressed-store.ts:58

Content hash from framed bytes to address. Injected, so a caller chooses the algorithm and its width, and so a test can use a hash that cannot collide.

It must be deterministic — two calls on equal bytes return one string — and collision-resistant enough for the store’s expected population. A 64-bit non-cryptographic hash is adequate below roughly 2^32 artifacts; above that, or against an adversary choosing the inputs, use SHA-256. A collision is not silent: see ContentAddressedStore.add.

Uint8Array

string


readonly magic: Uint8Array

Defined in: packages/cas/src/content-addressed-store.ts:65

The four-byte family marker this store accepts and writes. One store addresses one family of artifacts, so a knotkit/heap artifact read through a knotkit/trie store fails as INVALID_MAGIC rather than decoding under the wrong package’s rules.