Skip to main content

Module string_layer

Module string_layer 

Source
Expand description

String layer — KeyCardVec<String> (BCH + chunked-header reassembly).

Wraps the bytecode-layer codec (crate::bytecode) with the BIP 93–derived BCH error-correction layer (forked from md-codec per design/DECISIONS.md D-13) and the closure-locked string-layer header structure (per Q-5 — 2-symbol single-string + 8-symbol chunked).

Submodules:

  • bch: BCH polymod, syndrome decoder, and bech32-alphabet helpers.
  • bch_decode: syndrome-based BM/Forney decoder (impl detail of bch). pub(crate) for cross-module test fixture access; not part of the user-facing API.
  • header: 5-bit-symbol-aligned StringLayerHeader (SingleString + Chunked variants).
  • chunk: stream split + reassemble with cross_chunk_hash integrity check.

The public entry points wired up here (encode / encode_with_chunk_set_id / decode) are the layer-3 boundary; crate::key_card re-exports them.

Re-exports§

pub use bch::ALPHABET;
pub use bch::BchCode;
pub use bch::CaseStatus;
pub use bch::CorrectionResult;
pub use bch::DecodedString;
pub use bch::SEPARATOR;
pub use bch::bch_correct_long;
pub use bch::bch_correct_regular;
pub use bch::bch_create_checksum_long;
pub use bch::bch_create_checksum_regular;
pub use bch::bch_verify_long;
pub use bch::bch_verify_regular;
pub use bch::bytes_to_5bit;
pub use bch::case_check;
pub use bch::decode_string;
pub use bch::encode_5bit_to_string;
pub use bch::five_bit_to_bytes;
pub use bch::hrp_expand;
pub use chunk::reassemble_from_chunks;
pub use chunk::split_into_chunks;
pub use header::StringLayerHeader;

Modules§

bch
BCH primitives for the mk1 string layer: bech32 alphabet conversion and syndrome-based error correction.
bch_decode
Syndrome-based BCH decoder for the MK regular and long codes.
chunk
Stream chunking + cross-chunk integrity hash for mk1 multi-string cards.
header
5-bit-symbol-aligned string-layer header (single-string + chunked variants).

Functions§

decode
Decode one or more mk1-prefixed strings into a KeyCard.
encode
Encode a KeyCard into one or more mk1-prefixed strings.
encode_with_chunk_set_id
Like encode, but with an explicit chunk_set_id override.