solana_zk_token_sdk/
lib.rs

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