Skip to content
Snippets Groups Projects
Commit e1e1834c authored by Cédric Moreau's avatar Cédric Moreau
Browse files

refact: move Signable and duniter keys

parent 1d5aa03f
No related branches found
No related tags found
No related merge requests found
use crate::bma::BmaNode;
use crate::bma::lookup_identity::{LookupResult, lookup2identities, lookup_print};
use crate::crypto::scrypt_duniter_key::ScryptDuniterKey;
use crate::crypto::duniter_key::scrypt_duniter_key::ScryptDuniterKey;
use crate::crypto::duniter_key::ToDuniterKey;
use crate::dubp::documents::certification::Certification;
use crate::crypto::signable::Signable;
use crate::dubp::signable::Signable;
pub fn certify(node: BmaNode, uid_or_pub: String) -> Result<(), String> {
let address = node.get_address();
......
......@@ -3,10 +3,16 @@ use std::fmt::Formatter;
use bs58;
use cryptoxide::ed25519;
pub use scrypt_duniter_key::ScryptDuniterKey;
pub use seed_duniter_key::SeedDuniterKey;
use crate::crypto::duniter_signature::DuniterSignature;
pub use crate::crypto::scrypt_duniter_key::ScryptDuniterKey;
pub use crate::crypto::seed_duniter_key::SeedDuniterKey;
use crate::crypto::signable::Signable;
use crate::dubp::signable::Signable;
/// The implementations
pub mod scrypt_duniter_key;
pub mod seed_duniter_key;
pub mod base58_duniter_key;
pub const PUBLIC_KEY_LEN: usize = 32;
pub const SECRET_KEY_LEN: usize = 64;
......@@ -45,4 +51,4 @@ impl DuniterKey {
pub fn verify(&self, message: &str, signature: &DuniterSignature) -> bool {
ed25519::verify(message.as_bytes(), &self.public, &signature.as_bytes())
}
}
\ No newline at end of file
}
......@@ -2,10 +2,3 @@ mod duniter_signature;
/// The API of crypto module.
pub mod duniter_key;
/// The implementations
pub mod scrypt_duniter_key;
pub mod seed_duniter_key;
pub mod base58_duniter_key;
/// Other
pub mod signable;
......@@ -10,7 +10,7 @@ pub struct Certification {
pub cert_blockstamp: String,
}
impl crate::crypto::signable::Signable for Certification {
impl crate::dubp::signable::Signable for Certification {
fn to_signable(self: &Self) -> String {
format!("Version: {}
Type: Certification
......
pub mod documents;
pub mod signable;
#[cfg(test)]
mod tests {
use crate::dubp::documents::certification::Certification;
use crate::crypto::signable::Signable;
use crate::dubp::signable::Signable;
#[test]
fn test_signable_cert() {
......
File moved
......@@ -22,9 +22,9 @@ mod tests {
use crate::*;
use crate::crypto::duniter_key::SeedDuniterKey;
use crate::crypto::base58_duniter_key::Base58DuniterKey;
use crate::crypto::scrypt_duniter_key::{ScryptDuniterKey};
use crate::crypto::signable::Signable;
use crate::crypto::duniter_key::base58_duniter_key::Base58DuniterKey;
use crate::crypto::duniter_key::scrypt_duniter_key::{ScryptDuniterKey};
use crate::dubp::signable::Signable;
const SALT: &str = "test_salt";
const PASSWD: &str = "test_passwd";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment