Mudrit
Reference

mudrit (facade)

The all-in-one facade crate — the prelude, the re-exports of both layers, and pick_and_sign

Part of mudrit (facade)

The mudrit crate is a convenience bundle. It re-exports the PDF engine (mudrit-pdfsign) and, through it, the key-management API (mudrit-keystore), plus the optional cross-platform Pkcs11Picker. Most applications depend only on this crate.

use mudrit::prelude::*;

let signer = PfxSigner::from_file("cert.pfx", "password")?;
let signed = sign_pdf(std::fs::read("in.pdf")?, &signer, &SignConfig::default())?;

The prelude

use mudrit::prelude::*; brings in everything needed to sign in one import — sign_pdf / sign_file, SignConfig + its builder types, the Appearance types, Signer / KeyStore, the SignatureAlgorithm, and (per enabled feature) the backends PfxSigner / Pkcs11Signer / WinStoreSigner. See the prelude overview for the full list.

Re-exports

Prop

Type

pick_and_sign

A one-call convenience (feature picker) that opens the Iced Pkcs11Picker, then signs input with the chosen, unlocked signer. It lives in the facade because it bridges the picker and the engine (the key-management crate must not depend on the PDF engine).

pub fn pick_and_sign(
    modules: Vec<String>,
    cfg: &SignConfig,
    input: &[u8],
) -> Result<Option<Vec<u8>>>

Returns Ok(Some(signed)) on success, or Ok(None) if the user cancels the picker (other errors propagate).

use mudrit::prelude::*;

let cfg = SignConfig::builder().place("F", [350, 60, 560, 160])?.build();
if let Some(signed) = mudrit::pick_and_sign(modules, &cfg, &pdf)? {
    std::fs::write("out.pdf", signed)?;
}

The sub-crates stay independently usable. Depend on mudrit-keystore alone for pure key management (no PDF), or on mudrit-pdfsign alone for the engine with your own Signer. This facade is purely a convenience.

See also

On this page