Rust API Reference

Side-channel claim limit. Nothing on this page claims constant-time behaviour or side-channel resistance for any target: the side-channel harness covers nothing (finding A48) and no measurement exists. The Rust and C cores are designed for constant time and unmeasured; managed runtimes (JIT, GC, bounds checks) make no timing claim. Where this page names constant-time or side-channel techniques, in prose or in code, they are design intent or recommendations, not measured properties.

Complete API documentation for MetaMUI Crypto Primitives in Rust.

Installation

No package is published on a public registry yet (release candidate 1.0.0-rc.7); the coordinates below are the decided public names. Until the launch publishes them, build from the source tree (see the Installation Guide) or install a locally built candidate. The snippet was run against such a candidate; the run is recorded in the source repository’s documents/public-release/evidence/229-documentation.md.

[dependencies]
metamui-crypto = "1.0.0-rc.7"
rand = "0.8"

Quick Start

use metamui_crypto::{falcon512, mldsa65, mlkem768, Profile};

fn main() -> Result<(), metamui_crypto::Error> {
    let mut rng = rand::rngs::OsRng;

    let kp = falcon512::generate_keypair(&mut rng)?;
    let sig = falcon512::sign_padded(&kp.secret_key, b"hello", &mut rng)?;
    falcon512::verify_padded(&kp.public_key, b"hello", &sig)?;

    let kem = mlkem768::generate_keypair(&mut rng)?;
    let (ct, ss) = mlkem768::encapsulate(&kem.encapsulation_key, &mut rng)?;
    assert_eq!(mlkem768::decapsulate(&kem.decapsulation_key, &ct)?, ss);

    let dsa = mldsa65::generate_keypair(&mut rng)?;
    let sig = mldsa65::sign(&dsa.secret_key, b"hello", b"my-protocol/v1", &mut rng)?;
    mldsa65::verify(&dsa.public_key, b"hello", b"my-protocol/v1", &sig)?;

    assert!(Profile::parse("haetae").is_err()); // a family is not a profile
    Ok(())
}

API Documentation

For detailed API documentation, see:

Available Modules

The metamui-crypto facade exposes one module per release profile family (metamui-crypto-rust/metamui-crypto/src/lib.rs):

Module Kind
falcon512, falcon1024 Falcon signatures
mldsa44, mldsa65, mldsa87 ML-DSA (FIPS 204) signatures
slhdsa SLH-DSA (FIPS 205) signatures
mlkem512, mlkem768, mlkem1024 ML-KEM (FIPS 203) key encapsulation
haetae, aimer KpqC signatures
smaugt, ntruplus KpqC key encapsulation
profile Profile and Kind: parse and enumerate release profiles
error Error and LengthRule

Classical primitives (hashes, AEADs, X25519, Ed25519, sr25519 and the rest) are separate metamui-* crates of the same workspace, each with its own API; see the Rust Platform Guide.

Error Handling

Every fallible call returns Result<_, metamui_crypto::Error>. A wrong input length is Error::InvalidLength, whose expected field is a LengthRule (an exact size or a range).

Feature Flags

[dependencies]
metamui-crypto = { version = "1.0.0-rc.7", default-features = false }

The facade has one feature, std (on by default), which adds the operating-system randomness convenience entry points (*_os). Without it, pass your own CryptoRng + RngCore.

No-std Support

None. The crates require std (the no_std claims they once carried never built and were dropped in #334), and the public release is portable scalar Rust with no SIMD, assembly or CPU-feature-detection path.

See Also