Skip to main content

jacs_core/
lib.rs

1//! JACS portable protocol layer.
2//!
3//! `jacs-core` holds the protocol bits of JACS that must compile for both
4//! native and `wasm32-unknown-unknown` targets: canonical JSON, signing
5//! algorithm dispatch, encrypted-key envelopes, embedded schemas, and
6//! agreement payload logic. It performs **no I/O**, opens no files, makes
7//! no network calls, and pulls in no native-only crates. See
8//! `docs/jacs/JACS_WASM_PRD.md` for the full split rationale.
9
10pub mod agent;
11pub mod agreements;
12pub mod canonical;
13pub mod envelope;
14pub mod errors;
15pub mod material;
16pub mod schema;
17pub mod sign;
18pub mod verify;
19
20pub use agent::CoreAgent;
21pub use errors::CoreError;
22pub use material::{AgentMaterial, UnlockSecret};
23pub use sign::{DetachedSigner, Ed25519DalekSigner, Pq2025Signer, SigningAlgorithm};
24pub use verify::VerificationOutcome;
25
26/// Test helper: generate a fresh Ed25519 signer for fixture builders. Kept
27/// inside the crate (not feature-gated) because integration tests under
28/// `tests/` are external consumers and cannot reach private items. The
29/// underlying primitive is already pub through `Ed25519DalekSigner::
30/// generate`; this re-export is purely a discoverability hint for test
31/// authors building encrypted-material fixtures.
32pub fn ed25519_signer_for_tests() -> Ed25519DalekSigner {
33    Ed25519DalekSigner::generate().expect("ephemeral ed25519 keypair")
34}