Skip to main content

prism_fhe/
lib.rs

1//! Prism standard-library homomorphic-encryption sub-crate.
2//!
3//! `prism-fhe` realizes the homomorphic-encryption Layer-3 of the
4//! standard library named in [Wiki ADR-031][09-adr-031]: declares
5//! `FheAxis` through the [`axis!`][09-adr-030] SDK macro and supplies
6//! a parametric reference impl suitable for conformance testing.
7//!
8//! ## Scope
9//!
10//! The wiki's ADR-031 names canonical FHE-scheme impls (TFHE, BGV,
11//! CKKS); per ADR-031 the specific impl roster is operational policy.
12//! This crate ships the reference impl
13//! [`OneTimePadFhe<BLOCK_BYTES>`] — a one-time-pad (XOR with a
14//! key-stream) "homomorphic" scheme that satisfies the
15//! additive-over-ciphertexts axis contract trivially over any block
16//! width. Production FHE schemes are application-level integrations
17//! that satisfy the same `FheAxis` contract with cryptographically
18//! secure schemes; the `axis!` declaration here is what makes them
19//! composable through the prism standard-library Layer-3 surface.
20//!
21//! ## ConstrainedTypeShape declaration
22//!
23//! Per ADR-031's `Ciphertext<Plaintext, Scheme>` shape commitment:
24//! [`CiphertextShape<BYTES>`] carries an `N`-byte ciphertext block.
25//! Downstream FHE schemes wrap this shape in a newtype that associates
26//! the plaintext-type IRI per ADR-017.
27//!
28//! ## Closure under uor-foundation (ADR-013)
29//!
30//! The `FheAxis` trait has `::uor_foundation::pipeline::AxisExtension`
31//! as a supertrait; the parametric reference impl hand-writes its
32//! `AxisExtension` impl since the `axis!`-emitted companion macro
33//! takes `:ident`.
34//!
35//! ## See also
36//!
37//! - [Wiki: 09 Architecture Decisions § ADR-030 — `axis!` SDK macro][09-adr-030]
38//! - [Wiki: 09 Architecture Decisions § ADR-031 — `prism` is the standard library][09-adr-031]
39//!
40//! [09-adr-030]: https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions
41//! [09-adr-031]: https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions
42
43#![no_std]
44#![cfg_attr(docsrs, feature(doc_cfg))]
45
46pub mod fhe;
47pub mod verbs;
48
49pub use fhe::{
50    CiphertextShape, FheAxis, OneTimePadFhe, OneTimePadFhe128, OneTimePadFhe16, OneTimePadFhe64,
51    OneTimePadFheAxis, MAX_FHE_BLOCK_BYTES,
52};
53
54/// Wiki ADR-031 standard-library version banner.
55pub const STANDARD_LIBRARY_VERSION: &str = env!("CARGO_PKG_VERSION");