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
16/// A BLS signature wrapper
17pub mod bls;
18/// A Elliptic Curve VRF wrapper
19pub mod ec_vrf;
20pub mod error;
21pub mod hash;
22/// A multi bls signature wrapper
23pub mod multi_bls;
24pub mod test_utils;
25pub mod traits;
26#[cfg(test)]
27mod unit_tests;
28
29/// Utility to store encrypted private keys
30pub mod key_file;
31#[cfg(mirai)]
32mod tags;
33
34pub use self::traits::*;
35pub use hash::HashValue;
36
37// Reexport once_cell and serde_name for use in CryptoHasher Derive
38// implementation.
39#[doc(hidden)]
40pub use once_cell as _once_cell;
41#[doc(hidden)]
42pub use serde_name as _serde_name;
43
44// MIRAI's tag analysis makes use of the incomplete const_generics feature, so
45// the module containing the definitions of MIRAI tag types should not get
46// compiled in a release build. The code below fails a build of the crate if
47// mirai is on but debug_assertions is not.
48#[cfg(all(mirai, not(debug_assertions)))]
49compile_error!("MIRAI can only be used to compile the crate in a debug build!");