ledger_zcash_builder/
lib.rs

1/*******************************************************************************
2*   (c) 2022-2024 Zondax AG
3*
4*  Licensed under the Apache License, Version 2.0 (the "License");
5*  you may not use this file except in compliance with the License.
6*  You may obtain a copy of the License at
7*
8*      http://www.apache.org/licenses/LICENSE-2.0
9*
10*  Unless required by applicable law or agreed to in writing, software
11*  distributed under the License is distributed on an "AS IS" BASIS,
12*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*  See the License for the specific language governing permissions and
14*  limitations under the License.
15********************************************************************************/
16//! This library provides tools for building and proving Zcash transactions
17//! for hardware security modules (HSMs). It includes functionality for
18//! handling various cryptographic operations and transaction components
19//! specific to the Zcash protocol.
20
21#![allow(
22    dead_code,
23    unused_imports,
24    unused_mut,
25    unused_variables,
26    clippy::too_many_arguments,
27    clippy::result_unit_err,
28    deprecated
29)]
30
31use blake2b_simd::Params as Blake2bParams;
32use data::*;
33use errors::Error;
34use group::{cofactor::CofactorCurveAffine, GroupEncoding};
35use jubjub::AffinePoint;
36use rand::RngCore;
37use rand_core::OsRng;
38use txbuilder::SaplingMetadata;
39use zcash_primitives::{
40    consensus::{self, Parameters, TestNetwork},
41    keys::OutgoingViewingKey,
42    legacy::Script,
43    memo::MemoBytes as Memo,
44    merkle_tree::{IncrementalWitness, MerklePath},
45    sapling::{redjubjub::Signature, Node, PaymentAddress, ProofGenerationKey, Rseed},
46    transaction::{
47        components::{Amount, OutPoint, TxOut},
48        Transaction,
49    },
50};
51
52mod prover;
53
54/// Module containing error types and handling for the library.
55pub mod errors;
56
57/// Module containing data structures and utilities for transaction building.
58pub mod data;
59
60/// Module providing the transaction building logic.
61pub mod txbuilder;
62
63/// Module providing transaction proving capabilities.
64pub mod txprover;
65
66// Re exports
67/// Re-exporting the `Builder` and `hsmauth` from `txbuilder` for easier access.
68pub use crate::txbuilder::{hsmauth, Builder};
69/// Re-exporting `LocalTxProver` from `txprover` for easier access.
70pub use crate::txprover::LocalTxProver;