mk_codec/string_layer/mod.rs
1//! String layer — `KeyCard` ↔ `Vec<String>` (BCH + chunked-header reassembly).
2//!
3//! Wraps the bytecode-layer codec ([`crate::bytecode`]) with the
4//! BIP 93–derived BCH error-correction layer (forked from `md-codec` per
5//! `design/DECISIONS.md` D-13) and the closure-locked string-layer header
6//! structure (per Q-5 — 2-symbol single-string + 8-symbol chunked).
7//!
8//! Submodules:
9//!
10//! - [`bch`]: BCH polymod, syndrome decoder, and bech32-alphabet helpers.
11//! - [`bch_decode`]: syndrome-based BM/Forney decoder (impl detail of
12//! `bch`). `pub(crate)` for cross-module test fixture access; not part
13//! of the user-facing API.
14//! - [`header`]: 5-bit-symbol-aligned `StringLayerHeader`
15//! (`SingleString` + `Chunked` variants).
16//! - [`chunk`]: stream split + reassemble with `cross_chunk_hash`
17//! integrity check.
18//!
19//! The public entry points wired up here ([`encode`] / [`encode_with_chunk_set_id`]
20//! / [`decode`]) are the layer-3 boundary; `crate::key_card` re-exports them.
21
22pub mod bch;
23pub(crate) mod bch_decode;
24pub mod chunk;
25pub mod header;
26
27mod pipeline;
28
29pub use bch::{
30 ALPHABET, BchCode, CaseStatus, CorrectionResult, DecodedString, SEPARATOR, bch_correct_long,
31 bch_correct_regular, bch_create_checksum_long, bch_create_checksum_regular, bch_verify_long,
32 bch_verify_regular, bytes_to_5bit, case_check, decode_string, encode_5bit_to_string,
33 five_bit_to_bytes, hrp_expand,
34};
35pub use chunk::{reassemble_from_chunks, split_into_chunks};
36pub use header::StringLayerHeader;
37pub use pipeline::{decode, encode, encode_with_chunk_set_id};