Skip to main content

md_codec/
lib.rs

1//! # `md-codec`
2//!
3//! Reference implementation of the **Mnemonic Descriptor (MD)** format —
4//! an engravable backup format for [BIP 388 wallet policies][bip388].
5//!
6//! [bip388]: https://github.com/bitcoin/bips/blob/master/bip-0388.mediawiki
7//!
8//! v0.30 wire format: bit-aligned payload, sparse per-`@N` TLV overrides,
9//! 5-bit single-payload header (4-bit version=4 + `divergent_paths` flag),
10//! 6-bit bytecode tag space, decoder auto-dispatch between single and chunked
11//! payloads via the first 5-bit symbol's bit 0, symbol-aligned codex32
12//! wrapping with HRP `"md"`. See `design/SPEC_v0_30_wire_format.md` for the
13//! normative spec.
14
15mod bch;
16
17pub mod bitstream;
18pub mod canonical_origin;
19pub mod canonicalize;
20pub mod chunk;
21pub mod codex32;
22pub mod decode;
23pub mod derive;
24pub mod encode;
25pub mod error;
26pub mod header;
27pub mod identity;
28pub mod origin_path;
29pub mod phrase;
30pub mod tag;
31pub mod tlv;
32#[cfg(feature = "derive")]
33pub mod to_miniscript;
34pub mod tree;
35pub mod use_site_path;
36pub mod validate;
37pub mod varint;
38
39pub use canonicalize::canonicalize_placeholder_indices;
40pub use chunk::{ChunkHeader, derive_chunk_set_id, reassemble, split};
41pub use decode::{decode_md1_string, decode_payload};
42pub use encode::{Descriptor, encode_md1_string, encode_payload};
43pub use error::Error;
44pub use header::Header;
45pub use identity::{
46    Md1EncodingId, WalletDescriptorTemplateId, WalletPolicyId, compute_md1_encoding_id,
47    compute_wallet_descriptor_template_id, compute_wallet_policy_id, validate_presence_byte,
48};
49pub use origin_path::{OriginPath, PathComponent, PathDecl, PathDeclPaths};
50pub use phrase::Phrase;
51pub use tag::Tag;
52pub use tlv::TlvSection;