diem_crypto/lib.rs
1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8#![forbid(unsafe_code)]
9#![deny(missing_docs)]
10//! This feature gets turned on only if diem-crypto is compiled via MIRAI in a
11//! nightly build.
12#![cfg_attr(mirai, allow(incomplete_features), feature(const_generics))]
13
14//! A library supplying various cryptographic primitives
15
16extern crate rand_08 as rand;
17
18/// A BLS signature wrapper
19pub mod bls;
20/// A Elliptic Curve VRF wrapper
21pub mod ec_vrf;
22pub mod error;
23pub mod hash;
24/// A multi bls signature wrapper
25pub mod multi_bls;
26pub mod test_utils;
27pub mod traits;
28#[cfg(test)]
29mod unit_tests;
30
31/// Utility to store encrypted private keys
32pub mod key_file;
33#[cfg(mirai)]
34mod tags;
35
36pub use self::traits::*;
37pub use hash::HashValue;
38
39// Reexport once_cell and serde_name for use in CryptoHasher Derive
40// implementation.
41#[doc(hidden)]
42pub use once_cell as _once_cell;
43#[doc(hidden)]
44pub use serde_name as _serde_name;
45
46// MIRAI's tag analysis makes use of the incomplete const_generics feature, so
47// the module containing the definitions of MIRAI tag types should not get
48// compiled in a release build. The code below fails a build of the crate if
49// mirai is on but debug_assertions is not.
50#[cfg(all(mirai, not(debug_assertions)))]
51compile_error!("MIRAI can only be used to compile the crate in a debug build!");