Expand description
Shared helpers used across moonproof crates.
Mirror of midnight-js/packages/utils — narrow surface focused
on the bits actually duplicated across crates today (hex parsing
/ validation). Anything more domain-specific belongs in the
consuming crate, not here.
Re-exports§
pub use events::EventBus;pub use events::DEFAULT_CAPACITY;pub use hash::sha256;pub use hash::sha256_dir;pub use hash::sha256_file;pub use hash::sha256_file_hex;pub use hash::sha256_hex;pub use hash::Sha256Builder;pub use hex::is_hex;pub use hex::parse_hex;pub use hex::parse_hex_n;pub use hex::to_hex;pub use hex::to_hex_prefixed;pub use hex::HexError;pub use state::StateCell;
Modules§
- events
- Generic event bus over
tokio::sync::broadcast. - hash
- SHA-256 helpers — replace the
Sha256::new(); hasher.update(...); hex::encode(hasher.finalize())pattern repeated across runtime / keystore / cli / codegen. - hex
- Hex parsing + encoding helpers.
- rt
- Timers and clocks that work the same on a host and in a browser:
tokio’s timer and
std::timeon a host, the browser’ssetTimeoutandperformance.now()underwasm32-unknown-unknown, wherestd::time::Instant::nowand tokio’s timer driver are unavailable. - state
- Generic “latest-snapshot” state cell over
tokio::sync::watch.