Expand description
mk-codec — reference implementation of the Mnemonic Key (MK) backup format.
Status: v0.1 implementation in progress. Wire format is locked
per the closure design at
docs/superpowers/specs/2026-04-29-mk1-open-questions-closure-design.md.
The bytecode and string-layer encoders/decoders land in subsequent
phases of design/IMPLEMENTATION_PLAN_mk_v0_1.md.
See for the design surface:
design/SPEC_mk_v0_1.md— wire-format spec (post-closure)design/DECISIONS.md— rolling decisions log including D-1..D-15 and Q-1..Q-10 closuresdesign/IMPLEMENTATION_PLAN_mk_v0_1.md— v0.1 implementation plandesign/FOLLOWUPS.md— deferred items, pre-BIP-submission audit gates, cross-repo coordinationbip/bip-mnemonic-key.mediawiki— BIP draft
See for related sibling project:
bg002h/descriptor-mnemonic— the MD policy-template format and itsmd-codecreference implementation. MK is designed to engrave alongside MD policy cards for foreign-xpub multisig recovery.
§Eventual factoring
Per design/DECISIONS.md D-13, this crate initially forks the
BCH primitives from the sibling md-codec. The shared codex32-derived
plumbing extracts to a third crate (mc-codex32, likely a third
sibling repo) once both formats are implementation-validated; the
trigger condition (closure Q-9) is “both md-codec and mk-codec at v1.0
with cross-validated conformance vectors and stable public APIs.”
Until then, fork-from-md-codec; both implementations carry their own
BCH-primitives copy.
Re-exports§
pub use consts::CHUNKED_FRAGMENT_LONG_BYTES;pub use consts::CHUNKED_FRAGMENT_REGULAR_BYTES;pub use consts::CROSS_CHUNK_HASH_BYTES;pub use consts::GENERATOR_FAMILY;pub use consts::HRP;pub use consts::MAX_CHUNKS;pub use consts::MAX_PATH_COMPONENTS;pub use consts::MK_LONG_CONST;pub use consts::MK_REGULAR_CONST;pub use consts::NUMS_DOMAIN;pub use consts::ORIGIN_FINGERPRINT_BYTES;pub use consts::POLICY_ID_STUB_BYTES;pub use consts::SINGLE_STRING_LONG_BYTES;pub use consts::SINGLE_STRING_REGULAR_BYTES;pub use consts::XPUB_COMPACT_BYTES;pub use error::Error;pub use error::Result;pub use key_card::KeyCard;pub use key_card::decode;pub use key_card::encode;pub use key_card::encode_with_chunk_set_id;
Modules§
- bytecode
- Bytecode layer —
KeyCard↔ canonical bytecode (pre-chunking). - consts
- Locked constants for
mk1perdesign/SPEC_mk_v0_1.mdv0.1. - error
- Error type for
mk-codec. - key_
card KeyCard— the in-memory representation of a decoded MK card.- string_
layer - String layer —
KeyCard↔Vec<String>(BCH + chunked-header reassembly). - test_
vectors - Canonical
mktest-vector corpus.