parent
8542006259
commit
1b68da7572
|
@ -2195,7 +2195,7 @@ dependencies = [
|
|||
"solana-budget-program 0.15.0",
|
||||
"solana-client 0.15.0",
|
||||
"solana-drone 0.15.0",
|
||||
"solana-ed25519-dalek 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-kvstore 0.15.0",
|
||||
"solana-logger 0.15.0",
|
||||
"solana-metrics 0.15.0",
|
||||
|
@ -2387,7 +2387,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "solana-ed25519-dalek"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2643,7 +2643,7 @@ dependencies = [
|
|||
"serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-ed25519-dalek 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -3636,7 +3636,7 @@ dependencies = [
|
|||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"
|
||||
"checksum socket2 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "4e626972d3593207547f14bf5fc9efa4d0e7283deb73fef1dff313dae9ab8878"
|
||||
"checksum solana-ed25519-dalek 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a1bcc2cff3ecfee3ff892aef944f46378e84598c5017591d45f50d5a5c2cae7"
|
||||
"checksum solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c21f9d5aa62959872194dfd086feb4e8efec1c2589d27e6a0339904759e99fc"
|
||||
"checksum solana_rbpf 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ad37128dd7524e96cce18dec21be28fa369785842fcedb530b22df3a94b5fe5c"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b"
|
||||
|
|
|
@ -50,7 +50,7 @@ solana-budget-api = { path = "../programs/budget_api", version = "0.15.0" }
|
|||
solana-budget-program = { path = "../programs/budget_program", version = "0.15.0" }
|
||||
solana-client = { path = "../client", version = "0.15.0" }
|
||||
solana-drone = { path = "../drone", version = "0.15.0" }
|
||||
solana-ed25519-dalek = "0.1.0"
|
||||
solana-ed25519-dalek = "0.2.0"
|
||||
solana-kvstore = { path = "../kvstore", version = "0.15.0" , optional = true }
|
||||
solana-logger = { path = "../logger", version = "0.15.0" }
|
||||
solana-metrics = { path = "../metrics", version = "0.15.0" }
|
||||
|
|
|
@ -25,5 +25,5 @@ sha2 = "0.8.0"
|
|||
serde = "1.0.91"
|
||||
serde_derive = "1.0.91"
|
||||
serde_json = "1.0.39"
|
||||
solana-ed25519-dalek = "0.1.0"
|
||||
solana-ed25519-dalek = "0.2.0"
|
||||
untrusted = "0.6.2"
|
||||
|
|
|
@ -5,51 +5,15 @@ use bs58;
|
|||
use generic_array::typenum::U64;
|
||||
use generic_array::GenericArray;
|
||||
use rand::rngs::OsRng;
|
||||
use rand::{CryptoRng, Rng};
|
||||
use serde_json;
|
||||
use solana_ed25519_dalek as ed25519_dalek;
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
use std::fs::{self, File};
|
||||
use std::io::Write;
|
||||
use std::ops::Deref;
|
||||
use std::path::Path;
|
||||
|
||||
// --BEGIN
|
||||
// the below can go away if this lands:
|
||||
// https://github.com/dalek-cryptography/ed25519-dalek/pull/82
|
||||
#[derive(Debug)]
|
||||
pub struct Keypair(ed25519_dalek::Keypair);
|
||||
impl PartialEq for Keypair {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.pubkey() == other.pubkey()
|
||||
}
|
||||
}
|
||||
impl Deref for Keypair {
|
||||
type Target = ed25519_dalek::Keypair;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
impl From<ed25519_dalek::Keypair> for Keypair {
|
||||
fn from(keypair: ed25519_dalek::Keypair) -> Self {
|
||||
Keypair(keypair)
|
||||
}
|
||||
}
|
||||
impl Keypair {
|
||||
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ed25519_dalek::SignatureError> {
|
||||
ed25519_dalek::Keypair::from_bytes(bytes).map(std::convert::Into::into)
|
||||
}
|
||||
pub fn generate<R>(rng: &mut R) -> Self
|
||||
where
|
||||
R: CryptoRng + Rng,
|
||||
{
|
||||
ed25519_dalek::Keypair::generate(rng).into()
|
||||
}
|
||||
}
|
||||
// the above can go away if this lands:
|
||||
// https://github.com/dalek-cryptography/ed25519-dalek/pull/82
|
||||
// --END
|
||||
pub type Keypair = ed25519_dalek::Keypair;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
pub struct Signature(GenericArray<u8, U64>);
|
||||
|
|
Loading…
Reference in New Issue