speck_core/lib.rs
1//! # Speck Core
2//!
3//! Runtime package manager for MMU-less microcontrollers.
4//!
5//! This crate provides:
6//! - Secure code signing and verification (Ed25519)
7//! - Efficient binary delta updates
8//! - Flash-aware storage with wear leveling
9//! - Position-independent code module format
10//!
11//! ## Example
12//!
13//! ```rust
14//! use speck_core::{Module, KeyPair, DeltaBuilder};
15//!
16//! // Generate signing keys
17//! let keypair = KeyPair::generate();
18//!
19//! // Create and sign a module
20//! let code = vec![0x55, 0xAA, 0x00, 0x40]; // ARM Thumb code
21//! let module = Module::builder()
22//! .code(code)
23//! .entry_offset(0)
24//! .sign(&keypair)
25//! .build()
26//! .expect("valid module");
27//!
28//! // Verify the module
29//! module.verify().expect("signature valid");
30//! ```
31
32#![cfg_attr(not(feature = "std"), no_std)]
33#![warn(missing_docs, missing_debug_implementations)]
34
35extern crate alloc;
36
37pub mod crypto;
38pub mod delta;
39pub mod error;
40pub mod flash;
41pub mod format;
42pub mod storage;
43pub mod util;
44
45pub use crypto::{KeyPair, PublicKey, Signature};
46pub use delta::{Delta, DeltaApplier, DeltaBuilder};
47pub use error::{Error, Result};
48pub use flash::{Flash, FlashConfig, PageId};
49pub use format::{Module, ModuleBuilder, ModuleHeader, ModuleManifest};
50pub use storage::{StorageManager, StorageConfig, InstallationStatus};
51
52/// Library version constant
53pub const VERSION: &str = env!("CARGO_PKG_VERSION");
54
55/// Minimum compatible module format version
56pub const MIN_MODULE_VERSION: u16 = 1;
57
58/// Current module format version
59pub const CURRENT_MODULE_VERSION: u16 = 2;