parity-zcash/keys/src/lib.rs

45 lines
956 B
Rust
Raw Normal View History

//! Bitcoin keys.
2016-09-19 06:39:57 -07:00
extern crate rand;
extern crate rustc_hex as hex;
2016-09-19 06:39:57 -07:00
#[macro_use]
extern crate lazy_static;
extern crate base58;
2019-06-28 14:27:46 -07:00
extern crate secp256k1;
Prefix workspace crates with zebra- (#70) * Update license and author metadata in workspace crates. - ensure that the license field is set to GPL-3 for all GPL-3 licensed crates; - ensure that the author field is set to "Zcash Foundation", responsible for maintenance; - preserve the original authorship info in AUTHORS.md for human-readable history. Updating the author field ensures that all of the machine systems that read crate metadata list the ZF organization, not any single individual, as the maintainer of the crate. * Prefix all internal crate names with zebra-. This does not move the directories containing these crates to also have zebra- prefixes (for instance, zebra-chain instead of chain). I think that this would be preferable, but because it's a `git mv`, it will be simple to do later and leaving it out of this change makes it easier to see the renaming of all of the internal modules. * Remove git dependency from eth-secp256k1 * Avoid an error seemingly related to Deref coercions. This code caused an overflow while evaluating type constraints. As best as I can determine, the cause of the problem was something like so: the Rust implementation of the Bitcoin-specific hash function used in the Bloom filter doesn't operate on byte slices, but only on a `&mut R where R: Read`, so to hash a byte slice, you need to create a mutable copy of the input slice which can be consumed as a `Read` implementation by the hash function; the previous version of this code created a slice copy using a `Deref` coercion instead of `.clone()`, and when a tokio update added new trait impls, the type inference for the `Deref` coercion exploded (somehow -- I'm not sure about the last part?). This commit avoids the problem by manually cloning the input slice.
2019-07-02 12:07:06 -07:00
extern crate zebra_crypto;
extern crate zebra_primitives;
2016-09-19 06:39:57 -07:00
2016-12-15 07:03:59 -08:00
mod address;
mod display;
mod error;
2019-06-28 14:27:46 -07:00
pub mod generator;
mod keypair;
2016-09-19 06:39:57 -07:00
mod network;
2016-08-18 03:56:18 -07:00
mod private;
2016-08-20 09:06:04 -07:00
mod public;
2016-08-21 02:12:53 -07:00
mod signature;
Prefix workspace crates with zebra- (#70) * Update license and author metadata in workspace crates. - ensure that the license field is set to GPL-3 for all GPL-3 licensed crates; - ensure that the author field is set to "Zcash Foundation", responsible for maintenance; - preserve the original authorship info in AUTHORS.md for human-readable history. Updating the author field ensures that all of the machine systems that read crate metadata list the ZF organization, not any single individual, as the maintainer of the crate. * Prefix all internal crate names with zebra-. This does not move the directories containing these crates to also have zebra- prefixes (for instance, zebra-chain instead of chain). I think that this would be preferable, but because it's a `git mv`, it will be simple to do later and leaving it out of this change makes it easier to see the renaming of all of the internal modules. * Remove git dependency from eth-secp256k1 * Avoid an error seemingly related to Deref coercions. This code caused an overflow while evaluating type constraints. As best as I can determine, the cause of the problem was something like so: the Rust implementation of the Bitcoin-specific hash function used in the Bloom filter doesn't operate on byte slices, but only on a `&mut R where R: Read`, so to hash a byte slice, you need to create a mutable copy of the input slice which can be consumed as a `Read` implementation by the hash function; the previous version of this code created a slice copy using a `Deref` coercion instead of `.clone()`, and when a tokio update added new trait impls, the type inference for the `Deref` coercion exploded (somehow -- I'm not sure about the last part?). This commit avoids the problem by manually cloning the input slice.
2019-07-02 12:07:06 -07:00
pub use zebra_primitives::{bytes, hash};
2016-09-19 06:39:57 -07:00
2019-06-28 14:27:46 -07:00
pub use address::{Address, Type};
2016-12-15 07:03:59 -08:00
pub use display::DisplayLayout;
pub use error::Error;
2019-06-28 14:27:46 -07:00
pub use keypair::KeyPair;
pub use network::Network;
2016-12-15 07:03:59 -08:00
pub use private::Private;
pub use public::Public;
2019-06-28 14:27:46 -07:00
pub use signature::{CompactSignature, Signature};
2016-08-20 09:25:41 -07:00
use hash::{H160, H256};
2016-09-19 06:39:57 -07:00
2016-12-15 07:03:59 -08:00
/// 20 bytes long hash derived from public `ripemd160(sha256(public))`
2016-08-18 05:39:00 -07:00
pub type AddressHash = H160;
2016-12-15 07:03:59 -08:00
/// 32 bytes long secret key
pub type Secret = H256;
2016-12-15 07:03:59 -08:00
/// 32 bytes long signable message
2016-08-20 09:25:41 -07:00
pub type Message = H256;
lazy_static! {
2019-06-28 14:27:46 -07:00
pub static ref SECP256K1: secp256k1::Secp256k1 = secp256k1::Secp256k1::new();
}