Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename CertifOps to CertificateOps. #7615

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions libparsec/crates/client/src/certif/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use libparsec_types::prelude::*;

use super::{
store::{CertificatesStoreWriteGuard, GetCertificateError},
CertifOps, UpTo,
CertificateOps, UpTo,
};
use crate::{event_bus::EventInvalidCertificate, EventNewCertificates};

Expand Down Expand Up @@ -132,7 +132,7 @@ pub enum MaybeRedactedSwitch {
}

pub(super) async fn add_certificates_batch(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
common_certificates: &[Bytes],
sequester_certificates: &[Bytes],
Expand Down Expand Up @@ -379,7 +379,7 @@ macro_rules! verify_certificate_signature {
/// Validate the given certificate by both checking it content (format, signature, etc.)
/// and it global consistency with the others certificates.
async fn validate_common_certificate(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
signed: Bytes,
) -> Result<CommonTopicArcCertificate, CertifAddCertificatesBatchError> {
Expand Down Expand Up @@ -442,7 +442,7 @@ async fn validate_common_certificate(
/// Validate the given certificate by both checking it content (format, signature, etc.)
/// and it global consistency with the others certificates.
async fn validate_realm_certificate(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
realm_id: VlobID,
signed: Bytes,
Expand Down Expand Up @@ -552,7 +552,7 @@ async fn validate_realm_certificate(
/// Validate the given certificate by both checking it content (format, signature, etc.)
/// and it global consistency with the others certificates.
async fn validate_shamir_recovery_certificate(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
signed: Bytes,
) -> Result<ShamirRecoveryTopicArcCertificate, CertifAddCertificatesBatchError> {
Expand Down Expand Up @@ -613,7 +613,7 @@ async fn validate_shamir_recovery_certificate(
/// Validate the given certificate by both checking it content (format, signature, etc.)
/// and it global consistency with the others certificates.
async fn validate_sequester_certificate(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
signed: Bytes,
) -> Result<SequesterTopicArcCertificate, CertifAddCertificatesBatchError> {
Expand All @@ -634,7 +634,7 @@ async fn validate_sequester_certificate(
}

async fn validate_sequester_authority_certificate(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
signed: Bytes,
) -> Result<Arc<SequesterAuthorityCertificate>, CertifAddCertificatesBatchError> {
Expand Down Expand Up @@ -799,7 +799,7 @@ async fn check_user_not_revoked(
/// Admin existence has already been checked while fetching it device's verify key,
/// so what's left is checking it is not revoked and (optionally) it profile
async fn check_author_not_revoked_and_profile(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
up_to: DateTime,
author: UserID,
Expand Down Expand Up @@ -886,7 +886,7 @@ async fn get_user_profile(
}

async fn check_user_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &UserCertificate,
author_user_id: Option<UserID>,
Expand Down Expand Up @@ -1008,7 +1008,7 @@ async fn check_user_certificate_consistency(
}

async fn check_device_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &DeviceCertificate,
author_user_id: Option<UserID>,
Expand Down Expand Up @@ -1162,7 +1162,7 @@ async fn check_device_certificate_consistency(
}

async fn check_user_update_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &UserUpdateCertificate,
author_user_id: UserID,
Expand Down Expand Up @@ -1273,7 +1273,7 @@ async fn check_user_update_certificate_consistency(
}

async fn check_revoked_user_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &RevokedUserCertificate,
author_user_id: UserID,
Expand Down Expand Up @@ -1503,7 +1503,7 @@ async fn check_realm_role_certificate_consistency(
}

async fn check_realm_name_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &RealmNameCertificate,
author_user_id: UserID,
Expand Down Expand Up @@ -1590,7 +1590,7 @@ async fn check_realm_name_certificate_consistency(
}

async fn check_realm_key_rotation_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &RealmKeyRotationCertificate,
author_user_id: UserID,
Expand Down Expand Up @@ -1677,7 +1677,7 @@ async fn check_realm_key_rotation_certificate_consistency(
}

async fn check_realm_archiving_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &RealmArchivingCertificate,
author_user_id: UserID,
Expand Down Expand Up @@ -1764,7 +1764,7 @@ async fn check_realm_archiving_certificate_consistency(
}

async fn check_shamir_recovery_brief_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &ShamirRecoveryBriefCertificate,
author_user_id: UserID,
Expand Down Expand Up @@ -1843,7 +1843,7 @@ async fn check_shamir_recovery_brief_certificate_consistency(
}

async fn check_shamir_recovery_share_certificate_consistency(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
cooked: &ShamirRecoveryShareCertificate,
author_user_id: UserID,
Expand Down
4 changes: 2 additions & 2 deletions libparsec/crates/client/src/certif/block_validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
};

use super::{
store::CertifForReadWithRequirementsError, CertifOps, InvalidCertificateError,
store::CertifForReadWithRequirementsError, CertificateOps, InvalidCertificateError,
InvalidKeysBundleError,
};
#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -65,7 +65,7 @@ pub enum CertifValidateBlockError {
}

pub(super) async fn validate_block(
ops: &CertifOps,
ops: &CertificateOps,
needed_realm_certificate_timestamp: DateTime,
realm_id: VlobID,
key_index: IndexInt,
Expand Down
16 changes: 8 additions & 8 deletions libparsec/crates/client/src/certif/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use libparsec_types::prelude::*;

use super::{
store::{CertifStoreError, GetCertificateError},
CertifOps, UpTo,
CertificateOps, UpTo,
};

pub use super::store::CertifStoreError as CertifGetCurrentSelfProfileError;
Expand All @@ -17,7 +17,7 @@ pub use super::store::CertifStoreError as CertifListUserDevicesError;
pub use super::store::CertifStoreError as CertifListWorkspaceUsersError;

pub(super) async fn get_current_self_profile(
ops: &CertifOps,
ops: &CertificateOps,
) -> Result<UserProfile, CertifGetCurrentSelfProfileError> {
ops.store
.for_read(|store| store.get_current_self_profile())
Expand All @@ -26,7 +26,7 @@ pub(super) async fn get_current_self_profile(
}

pub(super) async fn get_current_self_realms_role(
ops: &CertifOps,
ops: &CertificateOps,
) -> Result<Vec<(VlobID, Option<RealmRole>, DateTime)>, CertifGetCurrentSelfRealmsRoleError> {
// TODO: cache !
let certifs = ops
Expand Down Expand Up @@ -55,7 +55,7 @@ pub(super) async fn get_current_self_realms_role(
}

pub(super) async fn get_current_self_realm_role(
ops: &CertifOps,
ops: &CertificateOps,
realm_id: VlobID,
) -> Result<Option<Option<RealmRole>>, CertifGetCurrentSelfRealmRoleError> {
// TODO: cache !
Expand Down Expand Up @@ -87,7 +87,7 @@ pub struct UserInfo {
}

pub(super) async fn list_users(
ops: &CertifOps,
ops: &CertificateOps,
skip_revoked: bool,
offset: Option<u32>,
limit: Option<u32>,
Expand Down Expand Up @@ -163,7 +163,7 @@ pub struct DeviceInfo {
}

pub(super) async fn list_user_devices(
ops: &CertifOps,
ops: &CertificateOps,
user_id: UserID,
) -> Result<Vec<DeviceInfo>, CertifListUserDevicesError> {
let certifs = ops
Expand Down Expand Up @@ -211,7 +211,7 @@ impl From<CertifStoreError> for CertifGetUserDeviceError {
}

pub(super) async fn get_user_device(
ops: &CertifOps,
ops: &CertificateOps,
device_id: DeviceID,
) -> Result<(UserInfo, DeviceInfo), CertifGetUserDeviceError> {
ops.store
Expand Down Expand Up @@ -316,7 +316,7 @@ pub struct WorkspaceUserAccessInfo {
/// List users currently part of the given workspace (i.e. user not revoked
/// and with a valid role)
pub(super) async fn list_workspace_users(
ops: &CertifOps,
ops: &CertificateOps,
realm_id: VlobID,
) -> Result<Vec<WorkspaceUserAccessInfo>, CertifListWorkspaceUsersError> {
ops.store
Expand Down
8 changes: 4 additions & 4 deletions libparsec/crates/client/src/certif/manifest_validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{certif::realm_keys_bundle, CertifDecryptForRealmError, EncrytionUsag

use super::{
store::{CertifForReadWithRequirementsError, CertificatesStoreReadGuard, GetCertificateError},
CertifOps, InvalidCertificateError, InvalidKeysBundleError, UpTo,
CertificateOps, InvalidCertificateError, InvalidKeysBundleError, UpTo,
};

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -102,7 +102,7 @@ pub enum CertifValidateManifestError {
}

pub(super) async fn validate_user_manifest(
ops: &CertifOps,
ops: &CertificateOps,
needed_realm_certificate_timestamp: DateTime,
needed_common_certificate_timestamp: DateTime,
author: DeviceID,
Expand Down Expand Up @@ -166,7 +166,7 @@ pub(super) async fn validate_user_manifest(

#[allow(clippy::too_many_arguments)]
pub(super) async fn validate_workspace_manifest(
ops: &CertifOps,
ops: &CertificateOps,
needed_realm_certificate_timestamp: DateTime,
needed_common_certificate_timestamp: DateTime,
realm_id: VlobID,
Expand Down Expand Up @@ -288,7 +288,7 @@ pub(super) async fn validate_workspace_manifest(

#[allow(clippy::too_many_arguments)]
pub(super) async fn validate_child_manifest(
ops: &CertifOps,
ops: &CertificateOps,
needed_realm_certificate_timestamp: DateTime,
needed_common_certificate_timestamp: DateTime,
realm_id: VlobID,
Expand Down
4 changes: 2 additions & 2 deletions libparsec/crates/client/src/certif/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub enum CertificateBasedActionOutcome {
}

#[derive(Debug)]
pub(crate) struct CertifOps {
pub(crate) struct CertificateOps {
#[allow(unused)]
config: Arc<ClientConfig>,
device: Arc<LocalDevice>,
Expand All @@ -77,7 +77,7 @@ pub(crate) struct CertifOps {

// For readability, we define the public interface here and let the actual
// implementation in separated submodules
impl CertifOps {
impl CertificateOps {
pub async fn start(
config: Arc<ClientConfig>,
device: Arc<LocalDevice>,
Expand Down
6 changes: 3 additions & 3 deletions libparsec/crates/client/src/certif/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use libparsec_types::prelude::*;

use super::{
store::{CertifStoreError, CertificatesStoreWriteGuard},
CertifAddCertificatesBatchError, CertifOps, InvalidCertificateError, MaybeRedactedSwitch,
CertifAddCertificatesBatchError, CertificateOps, InvalidCertificateError, MaybeRedactedSwitch,
};

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -60,7 +60,7 @@ impl From<CertifStoreError> for CertifPollServerError {
/// to avoid concurrency access changing certificates and breaking the deterministic
/// order certificates must be added on.
pub(super) async fn poll_server_for_new_certificates(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
requirements: Option<&PerTopicLastTimestamps>,
) -> Result<(), CertifPollServerError> {
Expand Down Expand Up @@ -94,7 +94,7 @@ pub(super) async fn poll_server_for_new_certificates(
}

async fn poll_server_and_add_certificates(
ops: &CertifOps,
ops: &CertificateOps,
store: &mut CertificatesStoreWriteGuard<'_>,
last_stored_timestamps: PerTopicLastTimestamps,
) -> Result<MaybeRedactedSwitch, CertifPollServerError> {
Expand Down
6 changes: 3 additions & 3 deletions libparsec/crates/client/src/certif/realm_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use libparsec_client_connection::ConnectionError;
use libparsec_protocol::authenticated_cmds;
use libparsec_types::prelude::*;

use super::{store::CertifStoreError, CertifOps, CertificateBasedActionOutcome, UpTo};
use super::{store::CertifStoreError, CertificateBasedActionOutcome, CertificateOps, UpTo};
use crate::EventTooMuchDriftWithServerClock;

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -46,7 +46,7 @@ impl From<CertifStoreError> for CertifEnsureRealmCreatedError {
}

pub(super) async fn ensure_realm_created(
ops: &CertifOps,
ops: &CertificateOps,
realm_id: VlobID,
) -> Result<CertificateBasedActionOutcome, CertifEnsureRealmCreatedError> {
let is_created = ops
Expand Down Expand Up @@ -74,7 +74,7 @@ pub(super) async fn ensure_realm_created(
}

async fn create_realm_idempotent(
ops: &CertifOps,
ops: &CertificateOps,
realm_id: VlobID,
) -> Result<CertificateBasedActionOutcome, CertifEnsureRealmCreatedError> {
let mut timestamp = ops.device.now();
Expand Down
6 changes: 4 additions & 2 deletions libparsec/crates/client/src/certif/realm_decrypt_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use libparsec_types::prelude::*;

use crate::{CertifDecryptForRealmError, EncrytionUsage};

use super::{realm_keys_bundle, store::CertifStoreError, CertifOps, InvalidKeysBundleError, UpTo};
use super::{
realm_keys_bundle, store::CertifStoreError, CertificateOps, InvalidKeysBundleError, UpTo,
};

#[derive(Debug, thiserror::Error)]
pub enum InvalidEncryptedRealmNameError {
Expand Down Expand Up @@ -58,7 +60,7 @@ pub enum CertifDecryptCurrentRealmNameError {
}

pub(super) async fn decrypt_current_realm_name(
ops: &CertifOps,
ops: &CertificateOps,
realm_id: VlobID,
) -> Result<(EntryName, DateTime), CertifDecryptCurrentRealmNameError> {
ops.store
Expand Down
Loading