Skip to content

Commit

Permalink
Temporarily switch to our own fork of ed25519-dalek
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc committed Mar 23, 2019
1 parent 24689aa commit c9c78eb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crev-data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ crev-common = { path = "../crev-common", version = "0.5" }
blake2 = "0.8"
chrono = "0.4"
common_failures = "0.1"
ed25519-dalek = { git = "https://github.com/dpc/ed25519-dalek", branch = "custom-digest-2" }
crev-ed25519-dalek = "0.1"
failure = "0.1"
serde = "1"
serde_derive = "1"
Expand Down
12 changes: 6 additions & 6 deletions crev-data/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crev_common::{
self,
serde::{as_base64, from_base64},
};
use ed25519_dalek::{self, PublicKey, SecretKey};
use crev_ed25519_dalek::{self, PublicKey, SecretKey};
use rand::OsRng;
use std::fmt;

Expand Down Expand Up @@ -47,10 +47,10 @@ impl Id {
pub fn verify_signature(&self, content: &[u8], sig_str: &str) -> Result<()> {
match self {
Id::Crev { id } => {
let pubkey = ed25519_dalek::PublicKey::from_bytes(&id)?;
let pubkey = crev_ed25519_dalek::PublicKey::from_bytes(&id)?;

let sig_bytes = crev_common::base64_decode(sig_str)?;
let signature = ed25519_dalek::Signature::from_bytes(&sig_bytes)?;
let signature = crev_ed25519_dalek::Signature::from_bytes(&sig_bytes)?;
pubkey.verify_with_digest::<blake2::Blake2b>(&content, &signature)?;
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ impl PubId {
#[derive(Debug)]
pub struct OwnId {
pub id: PubId,
pub keypair: ed25519_dalek::Keypair,
pub keypair: crev_ed25519_dalek::Keypair,
}

impl AsRef<Id> for OwnId {
Expand All @@ -156,7 +156,7 @@ impl OwnId {

Ok(Self {
id: crate::PubId::new_from_pubkey(calculated_pub_key.as_bytes().to_vec(), url),
keypair: ed25519_dalek::Keypair {
keypair: crev_ed25519_dalek::Keypair {
secret: sec_key,
public: calculated_pub_key,
},
Expand Down Expand Up @@ -184,7 +184,7 @@ impl OwnId {

pub fn generate(url: Url) -> Self {
let mut csprng: OsRng = OsRng::new().unwrap();
let keypair = ed25519_dalek::Keypair::generate(&mut csprng);
let keypair = crev_ed25519_dalek::Keypair::generate(&mut csprng);
Self {
id: PubId::new_from_pubkey(keypair.public.as_bytes().to_vec(), url),
keypair,
Expand Down

0 comments on commit c9c78eb

Please sign in to comment.