change visibility of dhcache
This commit is contained in:
parent
246056913e
commit
709ec4543b
@ -3,20 +3,20 @@ use crate::*;
|
|||||||
|
|
||||||
// Diffie-Hellman key exchange cache
|
// Diffie-Hellman key exchange cache
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash)]
|
||||||
pub(crate) struct DHCacheKey {
|
pub struct DHCacheKey {
|
||||||
pub key: PublicKey,
|
pub key: PublicKey,
|
||||||
pub secret: SecretKey,
|
pub secret: SecretKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub(crate) struct DHCacheValue {
|
pub struct DHCacheValue {
|
||||||
pub shared_secret: SharedSecret,
|
pub shared_secret: SharedSecret,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) type DHCache = LruCache<DHCacheKey, DHCacheValue>;
|
pub type DHCache = LruCache<DHCacheKey, DHCacheValue>;
|
||||||
pub(crate) const DH_CACHE_SIZE: usize = 4096;
|
pub const DH_CACHE_SIZE: usize = 4096;
|
||||||
|
|
||||||
pub(crate) fn cache_to_bytes(cache: &DHCache) -> Vec<u8> {
|
pub fn cache_to_bytes(cache: &DHCache) -> Vec<u8> {
|
||||||
let cnt: usize = cache.len();
|
let cnt: usize = cache.len();
|
||||||
let mut out: Vec<u8> = Vec::with_capacity(cnt * (32 + 32 + 32));
|
let mut out: Vec<u8> = Vec::with_capacity(cnt * (32 + 32 + 32));
|
||||||
for e in cache.iter() {
|
for e in cache.iter() {
|
||||||
@ -31,7 +31,7 @@ pub(crate) fn cache_to_bytes(cache: &DHCache) -> Vec<u8> {
|
|||||||
rev
|
rev
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn bytes_to_cache(bytes: &[u8], cache: &mut DHCache) {
|
pub fn bytes_to_cache(bytes: &[u8], cache: &mut DHCache) {
|
||||||
for d in bytes.chunks(32 + 32 + 32) {
|
for d in bytes.chunks(32 + 32 + 32) {
|
||||||
let k = DHCacheKey {
|
let k = DHCacheKey {
|
||||||
key: PublicKey::new(d[0..32].try_into().expect("asdf")),
|
key: PublicKey::new(d[0..32].try_into().expect("asdf")),
|
||||||
|
@ -15,7 +15,6 @@ pub mod vld0;
|
|||||||
pub use blake3digest512::*;
|
pub use blake3digest512::*;
|
||||||
|
|
||||||
pub use crypto_system::*;
|
pub use crypto_system::*;
|
||||||
pub use dh_cache::*;
|
|
||||||
pub use envelope::*;
|
pub use envelope::*;
|
||||||
pub use receipt::*;
|
pub use receipt::*;
|
||||||
pub use types::*;
|
pub use types::*;
|
||||||
@ -27,6 +26,7 @@ pub use vld0::*;
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
|
use dh_cache::*;
|
||||||
use hashlink::linked_hash_map::Entry;
|
use hashlink::linked_hash_map::Entry;
|
||||||
use hashlink::LruCache;
|
use hashlink::LruCache;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! # The Veilid Framework
|
//! # The Veilid Framework
|
||||||
//!
|
//!
|
||||||
//! Core library used to create a Veilid node and operate veilid services as part of an application.
|
//! Core library used to create a Veilid node and operate it as part of an application.
|
||||||
//!
|
//!
|
||||||
//! `veilid-core` contains all of the core logic for Veilid and can be used in mobile applications as well as desktop
|
//! `veilid-core` contains all of the core logic for Veilid and can be used in mobile applications as well as desktop
|
||||||
//! and in-browser WebAssembly apps.
|
//! and in-browser WebAssembly apps.
|
||||||
|
Loading…
Reference in New Issue
Block a user