Skip to main content

Crate pqm1

Crate pqm1 

Source
Expand description

§PQM-1

Post-Quantum Mnemonic v1: a 24-word BIP-39-compatible payload format for deterministic ML-DSA-65 wallet recovery.

This crate implements only the portable layer: BIP-39 phrase <-> 32-byte PQM-1 payload <-> SHAKE256-derived 32-byte ML-DSA-65 seed. It carries zero chain address/account types. Chains define their own profile domain and account/address derivation above this API.

§Minimal usage

use pqm1::{Pqm1Payload, Pqm1Profile};

let phrase =
    "absurd amount abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon armor";
let payload = Pqm1Payload::from_mnemonic(phrase).unwrap();
let seed = payload.derive_mldsa65_seed();

let near = Pqm1Profile { mldsa65_domain_tag: b"near.pqm1.v1.mldsa65" };
let near_seed = payload.derive_mldsa65_seed_with_profile(near);
assert_ne!(&*seed, &*near_seed);

§Caller invariants

  • PQM-1 v1 is one phrase -> one ML-DSA-65 seed. There are no BIP-32 / BIP-44 paths in this format.
  • A profile domain is part of the seed derivation. Use a chain/project- specific domain when adopting PQM-1 outside Monolythium.
  • This crate does not encrypt or persist keys. Store derived seeds/signing keys only through a real keystore.

Structs§

Pqm1Payload
A decoded PQM-1 v1 payload: algorithm tag + version + 240 bits of entropy.
Pqm1Profile
Profile parameters that sit above the chain-neutral PQM-1 payload.

Enums§

Pqm1Error
Errors decoding or deriving from a PQM-1 mnemonic / payload.

Constants§

ML_DSA_65_SEED_LEN
FIPS-204 ML-DSA seed length used by PQM-1 v1.
PQM1_ALGO_TAG_FALCON512_RESERVED
Algorithm tag reserved for FALCON-512.
PQM1_ALGO_TAG_MLDSA65
Algorithm tag for ML-DSA-65 (the only v1 production algorithm).
PQM1_ALGO_TAG_MLDSA87_RESERVED
Algorithm tag reserved for ML-DSA-87.
PQM1_ALGO_TAG_SLHDSA128S_RESERVED
Algorithm tag reserved for SLH-DSA-128s.
PQM1_ENTROPY_LEN
Entropy length carried inside the PQM-1 v1 payload.
PQM1_PAYLOAD_LEN
Total payload length: 1 byte algo + 1 byte version + 30 bytes entropy.
PQM1_V1_MLDSA65_DOMAIN_TAG
Monolythium’s locked PQM-1 v1 SHAKE256 domain tag for ML-DSA-65.
PQM1_V1_MNEMONIC_WORDS
Number of words in a PQM-1 v1 mnemonic.
PQM1_VERSION_V1
PQM-1 version byte (0x01 for v1).

Functions§

generate_mnemonic
Mint a fresh PQM-1 v1 mnemonic from caller-supplied randomness.
mnemonic_to_mldsa65_seed
Decode a PQM-1 v1 mnemonic and derive the Monolythium-profile ML-DSA seed.
mnemonic_to_mldsa65_seed_with_profile
Decode a PQM-1 v1 mnemonic and derive an ML-DSA seed for profile.