Move `hash` module to `radicle-crypto`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
09a8b46f34
commit
be789a487f
|
|
@ -2224,7 +2224,6 @@ dependencies = [
|
|||
"radicle-ssh",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.10.6",
|
||||
"siphasher",
|
||||
"sqlite",
|
||||
"tempfile",
|
||||
|
|
|
|||
|
|
@ -10,13 +10,14 @@ edition = "2021"
|
|||
|
||||
[features]
|
||||
test = ["fastrand", "quickcheck"]
|
||||
ssh = ["base64", "radicle-ssh", "sha2", "ssh-key"]
|
||||
ssh = ["base64", "radicle-ssh", "ssh-key"]
|
||||
|
||||
[dependencies]
|
||||
ed25519-compact = { version = "2.0.2", features = ["pem"] }
|
||||
cyphernet = { version = "0", optional = true }
|
||||
multibase = { version = "0.9.1" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
sha2 = { version = "0.10.2" }
|
||||
sqlite = { version = "0.28.1", optional = true }
|
||||
thiserror = { version = "1" }
|
||||
zeroize = { version = "1.5.7" }
|
||||
|
|
@ -47,10 +48,6 @@ version = "0"
|
|||
default-features = false
|
||||
optional = true
|
||||
|
||||
[dependencies.sha2]
|
||||
version = "0.10.2"
|
||||
optional = true
|
||||
|
||||
[dependencies.base64]
|
||||
version = "0.13"
|
||||
optional = true
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ pub use ed25519::{Error, KeyPair, Seed};
|
|||
#[cfg(any(test, feature = "test"))]
|
||||
pub mod test;
|
||||
|
||||
pub mod hash;
|
||||
#[cfg(feature = "ssh")]
|
||||
pub mod ssh;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use quickcheck::Arbitrary;
|
||||
|
||||
use crate::{test::signer::MockSigner, KeyPair, PublicKey, SecretKey, Seed};
|
||||
use crate::{hash, test::signer::MockSigner, KeyPair, PublicKey, SecretKey, Seed};
|
||||
|
||||
impl Arbitrary for MockSigner {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
|
|
@ -22,6 +22,13 @@ impl Arbitrary for PublicKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl Arbitrary for hash::Digest {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
let bytes: Vec<u8> = Arbitrary::arbitrary(g);
|
||||
hash::Digest::new(&bytes)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ByteArray<const N: usize>([u8; N]);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ pub mod tests;
|
|||
pub mod wire;
|
||||
|
||||
pub use nakamoto_net::{Io, Link, LocalDuration, LocalTime};
|
||||
pub use radicle::{collections, crypto, git, hash, identity, node, profile, rad, storage};
|
||||
pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::clock::Timestamp;
|
||||
pub use crate::crypto::hash::Digest;
|
||||
pub use crate::crypto::{PublicKey, Signature, Signer};
|
||||
pub use crate::deserializer::Deserializer;
|
||||
pub use crate::hash::Digest;
|
||||
pub use crate::identity::{Did, Id};
|
||||
pub use crate::service::filter::Filter;
|
||||
pub use crate::service::message::Address;
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ use nakamoto_net as nakamoto;
|
|||
use nakamoto_net::{Link, LocalTime};
|
||||
|
||||
use crate::address;
|
||||
use crate::crypto::hash::Digest;
|
||||
use crate::crypto::{PublicKey, Signature, Signer, Unverified};
|
||||
use crate::deserializer::Deserializer;
|
||||
use crate::git;
|
||||
use crate::git::fmt;
|
||||
use crate::hash::Digest;
|
||||
use crate::identity::Id;
|
||||
use crate::node;
|
||||
use crate::service;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ multibase = { version = "0.9.1" }
|
|||
log = { version = "0.4.17", features = ["std"] }
|
||||
once_cell = { version = "1.13" }
|
||||
olpc-cjson = { version = "0.1.1" }
|
||||
sha2 = { version = "0.10.2" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = { version = "1", features = ["preserve_order"] }
|
||||
siphasher = { version = "0.3.10" }
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ pub extern crate radicle_crypto as crypto;
|
|||
pub mod cob;
|
||||
pub mod collections;
|
||||
pub mod git;
|
||||
pub mod hash;
|
||||
pub mod identity;
|
||||
pub mod node;
|
||||
pub mod profile;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use quickcheck::Arbitrary;
|
|||
|
||||
use crate::collections::HashMap;
|
||||
use crate::git;
|
||||
use crate::hash;
|
||||
use crate::identity::{project::Delegate, project::Doc, Did, Id};
|
||||
use crate::storage;
|
||||
use crate::storage::refs::{Refs, SignedRefs};
|
||||
|
|
@ -198,10 +197,3 @@ impl Arbitrary for Id {
|
|||
Id::from(oid)
|
||||
}
|
||||
}
|
||||
|
||||
impl Arbitrary for hash::Digest {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
let bytes: Vec<u8> = Arbitrary::arbitrary(g);
|
||||
hash::Digest::new(&bytes)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue