From 4a2f9a89669feaa6c9bd31919d1d794da744ee8f Mon Sep 17 00:00:00 2001 From: Sam Stelfox Date: Tue, 2 Jul 2024 16:53:23 -0400 Subject: [PATCH] feat: mostly reducing scope of public interfaces --- src/api/platform/snapshots/get_all_request.rs | 2 -- src/codec/crypto/mod.rs | 14 +++++++------- src/codec/header/identity_header.rs | 4 +++- src/codec/header/mod.rs | 12 +++++++----- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/api/platform/snapshots/get_all_request.rs b/src/api/platform/snapshots/get_all_request.rs index 98ea051..6f66e1b 100644 --- a/src/api/platform/snapshots/get_all_request.rs +++ b/src/api/platform/snapshots/get_all_request.rs @@ -1,10 +1,8 @@ use async_trait::async_trait; -use serde::Serialize; use crate::api::client::{ApiRequest, PlatformApiRequest}; use crate::api::platform::{ApiDriveId, ApiSnapshot}; -#[derive(Serialize)] pub(crate) struct GetAllRequest { drive_id: ApiDriveId, } diff --git a/src/codec/crypto/mod.rs b/src/codec/crypto/mod.rs index f1ccc54..8bfc6ef 100644 --- a/src/codec/crypto/mod.rs +++ b/src/codec/crypto/mod.rs @@ -13,14 +13,14 @@ mod verifying_key; pub(crate) use encrypted_buffer::EncryptedBuffer; -pub use access_key::{AccessKey, AccessKeyError}; -pub use asym_locked_access_key::{AsymLockedAccessKey, AsymLockedAccessKeyError}; -pub use authentication_tag::AuthenticationTag; +pub(crate) use access_key::AccessKey; +pub(crate) use asym_locked_access_key::{AsymLockedAccessKey, AsymLockedAccessKeyError}; +pub(crate) use authentication_tag::AuthenticationTag; pub use fingerprint::Fingerprint; -pub use hash::Hash; -pub use key_id::KeyId; -pub use nonce::Nonce; +pub(crate) use hash::Hash; +pub(crate) use key_id::KeyId; +pub(crate) use nonce::Nonce; pub use signature::Signature; pub use signing_key::SigningKey; -pub use sym_locked_access_key::SymLockedAccessKey; +pub(crate) use sym_locked_access_key::SymLockedAccessKey; pub use verifying_key::VerifyingKey; diff --git a/src/codec/header/identity_header.rs b/src/codec/header/identity_header.rs index 22ea184..522bece 100644 --- a/src/codec/header/identity_header.rs +++ b/src/codec/header/identity_header.rs @@ -5,6 +5,8 @@ use winnow::Parser; use crate::codec::header::BANYAN_FS_MAGIC; use crate::codec::{ParserResult, Stream}; +const FORMAT_VERSION: u8 = 0x01; + #[derive(Debug, PartialEq)] pub struct IdentityHeader; @@ -14,7 +16,7 @@ impl IdentityHeader { writer: &mut W, ) -> std::io::Result { writer.write_all(BANYAN_FS_MAGIC).await?; - writer.write_all(&[0x01]).await?; + writer.write_all(&[FORMAT_VERSION]).await?; Ok(BANYAN_FS_MAGIC.len() + 1) } diff --git a/src/codec/header/mod.rs b/src/codec/header/mod.rs index b25c7c0..1520f45 100644 --- a/src/codec/header/mod.rs +++ b/src/codec/header/mod.rs @@ -7,11 +7,13 @@ mod public_settings; pub use access_mask::{AccessMask, AccessMaskBuilder, AccessMaskError}; pub use content_options::ContentOptions; -pub use format_header::FormatHeader; -pub use identity_header::IdentityHeader; -pub use key_count::KeyCount; +pub(crate) use identity_header::IdentityHeader; +pub(crate) use key_count::KeyCount; pub use public_settings::PublicSettings; -pub(super) const BANYAN_FS_MAGIC: &[u8] = b"BYFS"; +pub const BANYAN_FS_MAGIC: &[u8] = b"BYFS"; -pub(super) const BANYAN_DATA_MAGIC: &[u8] = b"BYFD"; +pub const BANYAN_DATA_MAGIC: &[u8] = b"BYFD"; + +#[allow(dead_code)] +pub const BANYAN_JOURNAL_MAGIC: &[u8] = b"BYFJ";