1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
// Copyright (c) 2021, Facebook, Inc. and its affiliates
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![warn(
future_incompatible,
nonstandard_style,
rust_2018_idioms,
rust_2021_compatibility
)]
use fastcrypto::{bls12381, ed25519};
// This re-export allows using the trait-defined APIs
pub use fastcrypto::traits;
////////////////////////////////////////////////////////////////////////
/// Type aliases selecting the signature algorithm for the code base.
////////////////////////////////////////////////////////////////////////
// Here we select the types that are used by default in the code base.
// The whole code base should only:
// - refer to those aliases and not use the individual scheme implementations
// - not use the schemes in a way that break genericity (e.g. using their Struct impl functions)
// - swap one of those aliases to point to another type if necessary
//
// Beware: if you change those aliases to point to another scheme implementation, you will have
// to change all four aliases to point to concrete types that work with each other. Failure to do
// so will result in a ton of compilation errors, and worse: it will not make sense!
pub type PublicKey = bls12381::BLS12381PublicKey;
pub type Signature = bls12381::BLS12381Signature;
pub type AggregateSignature = bls12381::BLS12381AggregateSignature;
pub type PrivateKey = bls12381::BLS12381PrivateKey;
pub type KeyPair = bls12381::BLS12381KeyPair;
// Example to use BLS12-377 instead:
// #[cfg(feature = "celo")]
// pub type PublicKey = bls12377::BLS12377PublicKey;
// #[cfg(feature = "celo")]
// pub type Signature = bls12377::BLS12377Signature;
// #[cfg(feature = "celo")]
// pub type PrivateKey = bls12377::BLS12377PrivateKey;
// #[cfg(feature = "celo")]
// pub type KeyPair = bls12377::BLS12377KeyPair;
pub type NetworkPublicKey = ed25519::Ed25519PublicKey;
pub type NetworkKeyPair = ed25519::Ed25519KeyPair;
////////////////////////////////////////////////////////////////////////
#[cfg(all(test, feature = "celo"))]
#[path = "tests/bls12377_tests.rs"]
pub mod bls12377_tests;
#[cfg(feature = "celo")]
pub mod bls12377;