Skip to content

deserializeStaticFilter(bytes): StaticFilter

Defined in: packages/static-filter/src/serialization.ts:212

Decode bytes written by serializeStaticFilter.

The payload is validated before a filter is returned, in O(byte length): a parameters section of exactly 28 bytes, a key count of at most 2^30, a segment length that is a power of two in [4, 2^18], a segment count length that is a positive multiple of it, at least one slot per key, a fingerprint section of exactly one or two bytes per slot, an attempt seed that one of the first 100 construction attempts under the seed draws, and, for an empty filter, no slots at all. Fingerprint values cannot be checked without the keys; pass { integrity: true } when serializing to catch accidental corruption. The filter owns a copy of the bytes.

Uint8Array

StaticFilter

With CORRUPT_FILTER_PAYLOAD when the payload breaks one of those rules, INVALID_PACKAGE_HEADER for a malformed header, UNKNOWN_KIND for a kind tag this release does not read, or a shared wire code from STATIC_FILTER_PARSE_ERROR_CODES for a malformed envelope.