Skip to main content

sapling_crypto/
lib.rs

1//! # sapling
2//!
3//! ## Nomenclature
4//!
5//! All types in the `sapling-crypto` crate, unless otherwise specified, are
6//! Sapling-specific types. For example, [`PaymentAddress`] is documented as being a
7//! shielded payment address; we implicitly mean it is an Sapling payment address (as
8//! opposed to e.g. an Orchard payment address, which is also shielded).
9//!
10#![cfg_attr(feature = "std", doc = "## Feature flags")]
11#![cfg_attr(feature = "std", doc = document_features::document_features!())]
12//!
13
14#![no_std]
15#![cfg_attr(docsrs, feature(doc_cfg))]
16// Catch documentation errors caused by code changes.
17#![deny(rustdoc::broken_intra_doc_links)]
18#![deny(unsafe_code)]
19
20#[macro_use]
21extern crate alloc;
22
23#[cfg(feature = "std")]
24extern crate std;
25
26mod address;
27pub mod builder;
28pub mod bundle;
29mod once;
30
31#[cfg(feature = "circuit")]
32pub mod circuit;
33pub mod constants;
34pub mod group_hash;
35pub mod keys;
36pub mod note;
37pub mod note_encryption;
38pub mod pczt;
39pub mod pedersen_hash;
40#[cfg(feature = "circuit")]
41pub mod prover;
42mod rng_compat;
43mod spec;
44mod tree;
45pub mod util;
46pub mod value;
47#[cfg(feature = "circuit")]
48mod verifier;
49pub mod zip32;
50
51pub use address::PaymentAddress;
52pub use bundle::Bundle;
53pub use keys::{Diversifier, NullifierDerivingKey, ProofGenerationKey, SaplingIvk, ViewingKey};
54pub use note::{Note, Rseed, nullifier::Nullifier};
55pub use tree::{
56    Anchor, CommitmentTree, IncrementalWitness, MerklePath, NOTE_COMMITMENT_TREE_DEPTH, Node,
57    merkle_hash,
58};
59
60#[cfg(feature = "circuit")]
61pub use verifier::{BatchValidator, PreparedBatchVerifyingKeys, SaplingVerificationContext};
62
63#[cfg(any(test, feature = "test-dependencies"))]
64#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
65pub mod testing {
66    pub use super::{
67        address::testing::arb_payment_address, keys::testing::arb_incoming_viewing_key,
68        note::testing::arb_note, tree::testing::arb_node,
69    };
70}
71
72#[cfg(test)]
73mod test_vectors;