prns-core 0.3.4

Pure Reticulum engine and wire contract for Personal Reticulum
[package]
name = "prns-core"
version = "0.3.4"
edition.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
rust-version.workspace = true
description = "Pure Reticulum engine and wire contract for Personal Reticulum"
documentation = "https://docs.rs/prns-core"
readme = "README.md"
keywords = ["reticulum", "mesh", "networking", "no-std", "embedded"]
categories = ["network-programming", "embedded", "no-std"]
publish = true
include = [
    "src/**",
    "tests/**",
    "!tests/**/__pycache__/**",
    "!tests/**/*.pyc",
    "examples/**",
    "Cargo.toml",
    "README.md",
]

[lib]
path = "src/lib.rs"

[features]
default = ["std", "std-sync-host"]
# `zeroize/alloc` rides our own `alloc` gate so `Zeroize for Vec<u8>` is present by declaration rather than incidental dependency feature unification. The host identity vault's keyring backend zeroizes the secret bytes the OS store hands back.
alloc = ["zeroize/alloc"]
signed-artifact = ["alloc", "dep:rmp"]
rnx = ["alloc", "dep:rmp"]
i2p = ["alloc", "dep:base64", "dep:data-encoding"]
shared-instance-rpc = ["alloc", "dep:md-5", "dep:rmp"]
interface-discovery = ["alloc", "dep:rmp"]
interface-discovery-archive = ["interface-discovery", "std", "dep:serde", "dep:serde_json"]
# Place fixed-capacity bulk in a caller-chosen heap region (PSRAM) via a custom `Allocator`: pulls the `allocator_api2` backport and unlocks the allocator-generic `FixedHeap*` columns + the `Esp32S3` prepackage. Off by default. Ordinary hosts never link the backport; they use the inline or growable residences.
external-alloc = ["alloc", "dep:allocator-api2"]
std = ["alloc", "dep:roaring", "dep:crc32fast"]
std-sync-host = ["std"]
tokio-host = ["std"]
embassy-host = []
runtime-metrics = ["alloc"]
stream-compression = ["std"]
# Gives capable fixed-storage targets one 256 KiB outgoing static-response window. Incoming
# resource limits are deliberately unchanged.
large-static-responses = []
# Fan a resource build's per-part SHA-256 hashmap across a rayon work-stealing pool. Bit-identical output (same names, same slots), so wire format and parity are unchanged; std-only, off by default, so embedded and default builds keep the serial loop.
parallel-resource-hash = ["std", "dep:rayon"]
parallel-persistence = ["std", "dep:rayon"]
# Compiles `engine::test_support` (the shared engine fixtures) outside `cfg(test)` so `prns-runtime`'s manifold tests can drive the same announces and descriptors. Never enabled by a shipping build; `prns-runtime` turns it on as a dev-dependency feature.
test-support = ["std"]
# The host identity vault's OS secret store (`KeyringVault`). Off by default, never built by the core gates; only an opt-in host links it. Pick exactly one Linux secret-service backend: `keyring-zbus` is pure Rust (zbus, no system library, so `cargo build` just works), `keyring-libdbus` links the system libdbus-1 C library (lighter Rust tree, but needs libdbus-1-dev present). macOS Keychain and the Windows Credential Manager ride either backend. There is deliberately no bare `keyring` feature: a feature sharing the dependency's name fuses them and pulls both backends at once; `_keyring-vault` is the internal compile gate the two share, not a knob.
keyring-zbus = ["_keyring-vault", "keyring/async-secret-service", "keyring/async-io"]
keyring-libdbus = ["_keyring-vault", "keyring/sync-secret-service"]
_keyring-vault = ["std", "dep:keyring", "keyring/crypto-rust", "keyring/apple-native", "keyring/windows-native"]
# The embedded identity vault's flash backend (`FlashVault`). Persists the secret key to a board-owned NOR flash region over `embedded-storage`, generated once on first boot. no_std, no alloc; the board supplies the driver and the region bounds. Off by default. Only an embedded host links it.
flash = ["dep:embedded-storage", "dep:embedded-storage-async"]

[dependencies]
cfg-if = "1.0"

# Crypto: no_std, no internal RNG (entropy is supplied as data by the host), so these must build alloc-free
sha2 = { version = "0.11", default-features = false }
hmac = { version = "0.13", default-features = false }
hkdf = { version = "0.13", default-features = false }
aes = { version = "0.8", default-features = false }
cbc = { version = "0.1", default-features = false, features = ["block-padding"] }
ed25519-dalek = { version = "2", default-features = false, features = ["zeroize", "fast"] }
x25519-dalek = { version = "2", default-features = false, features = ["precomputed-tables", "static_secrets"] }
zeroize = { version = "1", default-features = false, features = ["derive"] }
base64 = { version = "0.22", optional = true, default-features = false, features = ["alloc"] }
data-encoding = { version = "2", optional = true, default-features = false, features = ["alloc"] }
md-5 = { version = "0.11", optional = true, default-features = false }

# Fixed-capacity collections for retained engine state (alloc-free, inline storage)
heapless = { version = "0.8", default-features = false }

# Stable backport of the nightly `allocator_api` (`Allocator` + allocator-aware `Box`/`Vec`), under `external-alloc` only. Lets the fixed-heap columns be generic over the allocator: `Global` on a host, esp-alloc's `ExternalMemory` (PSRAM) on the S3. Version-matched to what esp-alloc 0.10 carries.
allocator-api2 = { version = "0.3", optional = true, default-features = false, features = ["alloc"] }

# Data-parallel resource hashing on capable hosts (`parallel-resource-hash`): a sender's part-name hashmap is one independent SHA-256 per part, so a work-stealing pool fans the hashing across cores. Optional and std-only; embedded builds keep the serial loop.
rayon = { version = "1", optional = true }
crc32fast = { version = "1", optional = true }
roaring = { version = "=0.11.4", optional = true, default-features = false }
rmp = { version = "0.8", optional = true, default-features = false }
serde = { version = "1", optional = true, features = ["derive"] }
serde_json = { version = "1", optional = true }

# OS secret store for the host identity vault (under `keyring`): the platform's own credential manager (Secret Service / kwallet on Linux, Keychain on macOS, Credential Manager on Windows), so a host's private key rests where the OS guards it rather than in a plain file. Off by default and never built by the core gates; only an opt-in host pulls the dbus/security-framework tree.
keyring = { version = "3", optional = true, default-features = false }

# Generic NOR-flash traits for the embedded identity vault's `FlashVault` (under `flash`): the board hands it any driver implementing `NorFlash`/`ReadNorFlash` (esp-storage on ESP, the nRF flash HAL, …) so the vault stays HAL-agnostic. no_std.
embedded-storage = { version = "0.3", optional = true, default-features = false }
embedded-storage-async = { version = "0.4", optional = true, default-features = false }

[dev-dependencies]
embassy-futures = "0.1"
proptest = "1"
rmpv = "1.3"
serde_json = "1"

[lints]
workspace = true

[package.metadata.docs.rs]
all-features = true