cleanup dht stuff and client/server api
This commit is contained in:
@@ -248,8 +248,8 @@ impl Crypto {
|
||||
node_ids: &[TypedKey],
|
||||
data: &[u8],
|
||||
typed_signatures: &[TypedSignature],
|
||||
) -> VeilidAPIResult<TypedKeySet> {
|
||||
let mut out = TypedKeySet::with_capacity(node_ids.len());
|
||||
) -> VeilidAPIResult<TypedKeyGroup> {
|
||||
let mut out = TypedKeyGroup::with_capacity(node_ids.len());
|
||||
for sig in typed_signatures {
|
||||
for nid in node_ids {
|
||||
if nid.kind == sig.kind {
|
||||
|
||||
@@ -17,7 +17,7 @@ use super::*;
|
||||
)]
|
||||
#[archive_attr(repr(C), derive(CheckBytes, Hash, PartialEq, Eq))]
|
||||
#[serde(from = "Vec<CryptoTyped<K>>", into = "Vec<CryptoTyped<K>>")]
|
||||
pub struct CryptoTypedSet<K = PublicKey>
|
||||
pub struct CryptoTypedGroup<K = PublicKey>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -37,7 +37,7 @@ where
|
||||
items: Vec<CryptoTyped<K>>,
|
||||
}
|
||||
|
||||
impl<K> CryptoTypedSet<K>
|
||||
impl<K> CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -151,7 +151,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<K> core::ops::Deref for CryptoTypedSet<K>
|
||||
impl<K> core::ops::Deref for CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -175,7 +175,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<K> fmt::Display for CryptoTypedSet<K>
|
||||
impl<K> fmt::Display for CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -205,7 +205,7 @@ where
|
||||
write!(f, "]")
|
||||
}
|
||||
}
|
||||
impl<K> FromStr for CryptoTypedSet<K>
|
||||
impl<K> FromStr for CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -238,7 +238,7 @@ where
|
||||
Ok(Self { items })
|
||||
}
|
||||
}
|
||||
impl<K> From<CryptoTyped<K>> for CryptoTypedSet<K>
|
||||
impl<K> From<CryptoTyped<K>> for CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -255,12 +255,12 @@ where
|
||||
<K as RkyvArchive>::Archived: Hash + PartialEq + Eq,
|
||||
{
|
||||
fn from(x: CryptoTyped<K>) -> Self {
|
||||
let mut tks = CryptoTypedSet::<K>::with_capacity(1);
|
||||
let mut tks = CryptoTypedGroup::<K>::with_capacity(1);
|
||||
tks.add(x);
|
||||
tks
|
||||
}
|
||||
}
|
||||
impl<K> From<Vec<CryptoTyped<K>>> for CryptoTypedSet<K>
|
||||
impl<K> From<Vec<CryptoTyped<K>>> for CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -277,12 +277,12 @@ where
|
||||
<K as RkyvArchive>::Archived: Hash + PartialEq + Eq,
|
||||
{
|
||||
fn from(x: Vec<CryptoTyped<K>>) -> Self {
|
||||
let mut tks = CryptoTypedSet::<K>::with_capacity(x.len());
|
||||
let mut tks = CryptoTypedGroup::<K>::with_capacity(x.len());
|
||||
tks.add_all(&x);
|
||||
tks
|
||||
}
|
||||
}
|
||||
impl<K> From<&[CryptoTyped<K>]> for CryptoTypedSet<K>
|
||||
impl<K> From<&[CryptoTyped<K>]> for CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -299,12 +299,12 @@ where
|
||||
<K as RkyvArchive>::Archived: Hash + PartialEq + Eq,
|
||||
{
|
||||
fn from(x: &[CryptoTyped<K>]) -> Self {
|
||||
let mut tks = CryptoTypedSet::<K>::with_capacity(x.len());
|
||||
let mut tks = CryptoTypedGroup::<K>::with_capacity(x.len());
|
||||
tks.add_all(x);
|
||||
tks
|
||||
}
|
||||
}
|
||||
impl<K> Into<Vec<CryptoTyped<K>>> for CryptoTypedSet<K>
|
||||
impl<K> Into<Vec<CryptoTyped<K>>> for CryptoTypedGroup<K>
|
||||
where
|
||||
K: Clone
|
||||
+ Copy
|
||||
@@ -42,11 +42,11 @@ pub fn common_crypto_kinds(a: &[CryptoKind], b: &[CryptoKind]) -> Vec<CryptoKind
|
||||
}
|
||||
|
||||
mod crypto_typed;
|
||||
mod crypto_typed_set;
|
||||
mod crypto_typed_group;
|
||||
mod keypair;
|
||||
|
||||
pub use crypto_typed::*;
|
||||
pub use crypto_typed_set::*;
|
||||
pub use crypto_typed_group::*;
|
||||
pub use keypair::*;
|
||||
|
||||
pub type TypedKey = CryptoTyped<PublicKey>;
|
||||
@@ -55,8 +55,8 @@ pub type TypedKeyPair = CryptoTyped<KeyPair>;
|
||||
pub type TypedSignature = CryptoTyped<Signature>;
|
||||
pub type TypedSharedSecret = CryptoTyped<SharedSecret>;
|
||||
|
||||
pub type TypedKeySet = CryptoTypedSet<PublicKey>;
|
||||
pub type TypedSecretSet = CryptoTypedSet<SecretKey>;
|
||||
pub type TypedKeyPairSet = CryptoTypedSet<KeyPair>;
|
||||
pub type TypedSignatureSet = CryptoTypedSet<Signature>;
|
||||
pub type TypedSharedSecretSet = CryptoTypedSet<SharedSecret>;
|
||||
pub type TypedKeyGroup = CryptoTypedGroup<PublicKey>;
|
||||
pub type TypedSecretGroup = CryptoTypedGroup<SecretKey>;
|
||||
pub type TypedKeyPairGroup = CryptoTypedGroup<KeyPair>;
|
||||
pub type TypedSignatureGroup = CryptoTypedGroup<Signature>;
|
||||
pub type TypedSharedSecretGroup = CryptoTypedGroup<SharedSecret>;
|
||||
|
||||
Reference in New Issue
Block a user