p47h_open_core/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025 P47H Team <https://p47h.com>
3
4//! # p47h-open-core
5//!
6//! Cryptographic primitives and policy engine for secure identity management.
7//!
8//! This crate provides a unified API for the P47H ecosystem's core functionality:
9//!
10//! - **Identity Management**: Ed25519 key generation and DID resolution
11//! - **Policy Engine**: Pure RBAC/ABAC authorization without external dependencies
12//! - **WASM Engine**: The core logic for browser-based vault operations
13//!
14//! ## Quick Start
15//!
16//! ```rust,no_run
17//! use p47h_open_core::identity::Identity;
18//!
19//! // Generate a new cryptographic identity
20//! let mut rng = rand::thread_rng();
21//! let identity = Identity::generate(&mut rng).expect("Failed to generate identity");
22//! println!("Public key hash: {:?}", identity.public_key_hash());
23//! ```
24//!
25//! ## Architecture
26//!
27//! This facade crate re-exports the following modules:
28//!
29//! - [`identity`] - Ed25519 identity management (from `core-identity`)
30//! - [`policy`] - Authorization policy engine (from `core-policy`)
31//! - [`engine`] - WASM-ready vault engine (from `p47h-engine`)
32//!
33//! ## Feature Flags
34//!
35//! - `wasm` - Enable WebAssembly-specific optimizations (coming soon)
36//!
37//! ## Security
38//!
39//! All cryptographic operations use audited, production-ready libraries:
40//!
41//! - Ed25519 signatures via `ed25519-dalek`
42//! - Argon2id key derivation via `argon2`
43//! - XChaCha20-Poly1305 encryption via `chacha20poly1305`
44//! - Memory zeroization via `zeroize`
45
46#![forbid(unsafe_code)]
47#![warn(missing_docs)]
48#![doc(html_root_url = "https://docs.rs/p47h-open-core/1.0.1")]
49
50/// Identity management module.
51///
52/// Re-exports `core_identity` for Ed25519 identity generation and DID operations.
53pub mod identity {
54    pub use core_identity::*;
55}
56
57/// Policy engine module.
58///
59/// Re-exports `core_policy` for RBAC/ABAC authorization.
60pub mod policy {
61    pub use core_policy::*;
62}
63
64/// Core engine module.
65///
66/// Re-exports `p47h_engine` for WASM-ready vault operations.
67pub mod engine {
68    pub use p47h_engine::*;
69}
70
71// Convenience re-exports at root level
72pub use core_identity::Identity;
73pub use core_policy::{Action, Policy, Resource};