solana_zk_token_sdk/lib.rs
1#![allow(clippy::arithmetic_side_effects, clippy::op_ref)]
2
3// The warning `clippy::op_ref` is disabled to allow efficient operator arithmetic of structs that
4// implement the `Copy` trait.
5//
6// ```
7// let opening_0: PedersenOpening = PedersenOpening::new_rand();
8// let opening_1: PedersenOpening = PedersenOpening::new_rand();
9//
10// // since PedersenOpening implement `Copy`, `opening_0` and `opening_1` will be copied as
11// // parameters before `opening_sum` is computed.
12// let opening_sum = opening_0 + opening_1;
13//
14// // if passed in as references, the extra copies will not occur
15// let opening_sum = &opening_0 + &opening_1;
16// ```
17//
18// `clippy::op_ref` is turned off to prevent clippy from warning that this is not idiomatic code.
19
20pub use solana_curve25519 as curve25519;
21
22#[cfg(not(target_os = "solana"))]
23#[macro_use]
24pub(crate) mod macros;
25#[cfg(not(target_os = "solana"))]
26pub mod encryption;
27mod range_proof;
28mod sigma_proofs;
29#[cfg(not(target_os = "solana"))]
30mod transcript;
31
32pub mod errors;
33pub mod instruction;
34pub mod zk_token_elgamal;
35pub mod zk_token_proof_instruction;
36pub mod zk_token_proof_program;
37pub mod zk_token_proof_state;
38
39#[cfg(not(target_os = "solana"))]
40pub use curve25519_dalek;
41
42/// Byte length of a compressed Ristretto point or scalar in Curve255519
43const UNIT_LEN: usize = 32;
44/// Byte length of a compressed Ristretto point in Curve25519
45const RISTRETTO_POINT_LEN: usize = UNIT_LEN;
46/// Byte length of a scalar in Curve25519
47const SCALAR_LEN: usize = UNIT_LEN;