nigig-org/crates/apps/pdf/pdf-document/Cargo.toml
andodeki f535296b43 feat(scanner-ocr): on-device recognition behind ocr feature; gate pdf seam
nigig_doc_scanner splits the app shell (Makepad UI, nigig-core/uikit,
device location) from a new ocr feature: pure-Rust TemplateOcr
(Otsu plus 8-connected components plus embedded 5x7 templates for
0-9A-Z, confidence floor 0.80 plus runner-up margin, checked
budgets) with field suggestions and a deterministic fixture renderer
shared with downstream crates. Downstream device crates enable
nigig_doc_scanner/ocr with default-features=false (dep tree proven
free of UI/location crates). Binary requires app.

nigig-pdf-document gates its engine-free ocr seam behind an ocr
cargo feature (default on); recognition must not pull the
document/signing stack.

Verified: scanner ocr-only check plus 11 lib tests green;
pdf-document check green with default and --no-default-features;
pdf ocr tests 5/5. Pre-existing xmp.rs unused_mut warning untouched.
2026-09-25 22:41:38 +03:00

42 lines
1.6 KiB
TOML

[package]
name = "nigig-pdf-document"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "PDF document model: page tree, annotations, AcroForm, destinations. No UI dependencies."
[features]
# The OCR seam (`src/ocr.rs`: engine trait + hidden-text-layer types only, no
# engine, no new dependencies) is opt-out rather than opt-in so existing
# consumers keep building. Consumers that only need text recognition must NOT
# depend on this crate for it — the owned on-device engine lives in
# `nigig_doc_scanner` behind its `ocr` feature. Gating here documents that
# boundary and lets minimal builds skip even the seam.
default = ["ocr"]
ocr = []
[dependencies]
nigig-pdf-cos = { path = "../pdf-cos" }
# Signing and verification (ADR 0025). All RustCrypto or RustCrypto-adjacent,
# all MIT/Apache-2.0, all pure Rust — the engine crates compile no C and that
# property is what keeps the WASM and mobile targets viable.
#
# ADR 0005's rule against hand-rolled primitives applies with more force here
# than anywhere else in the codebase: a subtly wrong signature verifier
# reports "valid" for a forgery.
rsa = { version = "0.9", features = ["sha2"] }
ed25519-dalek = "2"
p256 = { version = "0.13", features = ["ecdsa"] }
x509-cert = "0.2"
cms = "0.2"
der = { version = "0.7", features = ["oid"] }
sha1 = "0.10"
sha2 = "0.10"
getrandom = "0.2"
[dev-dependencies]
# The test fixtures generate real keys and certificates rather than
# loading a blob nobody can regenerate.
rsa = { version = "0.9", features = ["sha2"] }
nigig-pdf-graphics = { path = "../pdf-graphics" }