From d779f9f1cc06a59bd141e794dd55823afb56509f Mon Sep 17 00:00:00 2001 From: muji Date: Mon, 3 Feb 2025 18:29:52 +0800 Subject: [PATCH] Tidy imports in account crate. --- Cargo.lock | 1 - crates/account/Cargo.toml | 2 -- crates/account/src/account.rs | 34 +++++++++++++------------- crates/account/src/account_switcher.rs | 6 ++--- crates/account/src/builder.rs | 2 +- crates/account/src/convert.rs | 2 +- crates/account/src/error.rs | 3 +-- crates/account/src/folder_sync.rs | 12 ++++----- crates/account/src/sync.rs | 2 +- 9 files changed, 29 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4689d3a50..592fd06657 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4840,7 +4840,6 @@ dependencies = [ "sos-login", "sos-migrate", "sos-reducers", - "sos-sdk", "sos-search", "sos-signer", "sos-sync", diff --git a/crates/account/Cargo.toml b/crates/account/Cargo.toml index b74a5c9766..757b4c75a2 100644 --- a/crates/account/Cargo.toml +++ b/crates/account/Cargo.toml @@ -31,7 +31,6 @@ contacts = ["dep:vcard4"] migrate = ["sos-migrate/import", "sos-migrate/export"] files = [ "sos-external-files", - "sos-sdk/files", "sos-backend/files", "sos-login/files", "sos-client-storage/files", @@ -41,7 +40,6 @@ search = ["sos-search", "sos-client-storage/search"] [dependencies] sos-core.workspace = true -sos-sdk.workspace = true sos-backend.workspace = true sos-database.workspace = true sos-filesystem.workspace = true diff --git a/crates/account/src/account.rs b/crates/account/src/account.rs index be79c3a84e..d26742898f 100644 --- a/crates/account/src/account.rs +++ b/crates/account/src/account.rs @@ -1,9 +1,9 @@ //! Account storage and search index. use crate::{convert::CipherComparison, AccountBuilder, Error, Result}; -use sos_backend::compact::compact_folder; +use indexmap::IndexSet; use sos_backend::{ - reducers::FolderReducer, write_exclusive, AccessPoint, AccountEventLog, - StorageError, + compact::compact_folder, write_exclusive, AccessPoint, AccountEventLog, + BackendTarget, StorageError, }; use sos_client_storage::{ AccessOptions, AccountPack, ClientAccountStorage, ClientDeviceStorage, @@ -13,15 +13,20 @@ use sos_client_storage::{ use sos_core::{ commit::{CommitHash, CommitState}, crypto::{AccessKey, Cipher, KeyDerivation}, - decode, encode, - events::{AccountEvent, Event, EventKind, ReadEvent, WriteEvent}, - events::{EventLog, EventRecord}, - AccountId, SecretId, VaultCommit, VaultId, + decode, + device::{DevicePublicKey, TrustedDevice}, + encode, + events::{ + AccountEvent, Event, EventKind, EventLog, EventRecord, ReadEvent, + WriteEvent, + }, + AccountId, Paths, SecretId, UtcDateTime, VaultCommit, VaultId, }; -use sos_sdk::{ - identity::{AccountRef, FolderKeys, Identity, PublicIdentity}, - vfs, Paths, UtcDateTime, +use sos_login::{ + device::{DeviceManager, DeviceSigner}, + AccountRef, FolderKeys, Identity, PublicIdentity, }; +use sos_reducers::FolderReducer; use sos_sync::{CreateSet, StorageEventLogs}; use sos_vault::{ list_accounts, list_local_folders, @@ -29,6 +34,7 @@ use sos_vault::{ BuilderCredentials, Header, SecretAccess, Summary, Vault, VaultBuilder, VaultFlags, }; +use sos_vfs as vfs; use std::{ borrow::Cow, collections::HashMap, @@ -48,12 +54,6 @@ use { #[cfg(feature = "archive")] use sos_filesystem::archive::{Inventory, RestoreOptions}; -use sos_backend::BackendTarget; -use sos_core::device::{DevicePublicKey, TrustedDevice}; -use sos_login::device::{DeviceManager, DeviceSigner}; - -use indexmap::IndexSet; - #[cfg(feature = "files")] use sos_external_files::FileMutationEvent; @@ -1028,7 +1028,7 @@ impl LocalAccount { vault_id: &VaultId, new_key: AccessKey, ) -> Result> { - use sos_sdk::vault::ChangePassword; + use sos_vault::ChangePassword; let paths = self.paths().clone(); // Get the current vault passphrase from the identity vault let current_key = self diff --git a/crates/account/src/account_switcher.rs b/crates/account/src/account_switcher.rs index 1f62ffdc29..feaffae96d 100644 --- a/crates/account/src/account_switcher.rs +++ b/crates/account/src/account_switcher.rs @@ -1,6 +1,6 @@ use crate::{Account, Error, LocalAccount, Result}; -use sos_core::AccountId; -use sos_sdk::{prelude::PublicIdentity, Paths}; +use sos_core::{AccountId, Paths}; +use sos_login::PublicIdentity; use sos_vault::list_accounts; use std::path::PathBuf; use std::pin::Pin; @@ -13,7 +13,7 @@ use sos_search::{ArchiveFilter, Document, DocumentView, QueryFilter}; use {crate::ClipboardCopyRequest, xclipboard::Clipboard}; #[cfg(feature = "clipboard")] -use sos_sdk::prelude::SecretPath; +use sos_core::SecretPath; /// Account switcher for local accounts. pub type LocalAccountSwitcher = AccountSwitcher< diff --git a/crates/account/src/builder.rs b/crates/account/src/builder.rs index 54183c513f..e01edfd77d 100644 --- a/crates/account/src/builder.rs +++ b/crates/account/src/builder.rs @@ -11,7 +11,7 @@ use sos_core::{ crypto::AccessKey, AccountId, Paths, SecretId, VaultFlags, }; -use sos_sdk::identity::{FolderKeys, Identity, IdentityFolder}; +use sos_login::{FolderKeys, Identity, IdentityFolder}; use sos_vault::{ secret::{Secret, SecretMeta, SecretRow}, AccessPoint, BuilderCredentials, SecretAccess, Summary, Vault, diff --git a/crates/account/src/convert.rs b/crates/account/src/convert.rs index 3426e83556..29ce203d4e 100644 --- a/crates/account/src/convert.rs +++ b/crates/account/src/convert.rs @@ -2,7 +2,7 @@ use crate::{Account, Error, LocalAccount, Result}; use serde::{Deserialize, Serialize}; use sos_backend::AccessPoint; -use sos_sdk::{ +use sos_core::{ crypto::{AccessKey, Cipher, KeyDerivation}, decode, encode, }; diff --git a/crates/account/src/error.rs b/crates/account/src/error.rs index f113f18a2a..d278b381ac 100644 --- a/crates/account/src/error.rs +++ b/crates/account/src/error.rs @@ -1,6 +1,5 @@ //! Errors generated by the account library. -use sos_core::VaultId; -use sos_sdk::prelude::ErrorExt; +use sos_core::{ErrorExt, VaultId}; use std::path::PathBuf; use thiserror::Error; diff --git a/crates/account/src/folder_sync.rs b/crates/account/src/folder_sync.rs index 21e8bd22d4..b3372cf4b3 100644 --- a/crates/account/src/folder_sync.rs +++ b/crates/account/src/folder_sync.rs @@ -1,24 +1,22 @@ //! Implements merging for folders. use crate::Result; use async_trait::async_trait; -use sos_backend::reducers::FolderReducer; use sos_backend::Folder; use sos_core::{ events::{ patch::{CheckedPatch, FolderDiff}, - LogEvent, WriteEvent, + EventLog, LogEvent, WriteEvent, }, VaultId, }; -use sos_sdk::{ - events::EventLog, identity::IdentityFolder, vault::secret::SecretRow, -}; -use sos_vault::SecretAccess; +use sos_login::IdentityFolder; +use sos_reducers::FolderReducer; +use sos_vault::{secret::SecretRow, SecretAccess}; /// Options for folder merge. pub(crate) enum FolderMergeOptions<'a> { /// Update a URN lookup when merging. - Urn(VaultId, &'a mut sos_sdk::identity::UrnLookup), + Urn(VaultId, &'a mut sos_login::UrnLookup), /// Update a search index when merging. #[cfg(feature = "search")] Search(VaultId, &'a mut sos_search::SearchIndex), diff --git a/crates/account/src/sync.rs b/crates/account/src/sync.rs index 05f0d91edc..4d8e1c0b06 100644 --- a/crates/account/src/sync.rs +++ b/crates/account/src/sync.rs @@ -306,7 +306,7 @@ impl Merge for LocalAccount { diff: FileDiff, outcome: &mut MergeOutcome, ) -> Result { - use sos_backend::reducers::FileReducer; + use sos_reducers::FileReducer; tracing::debug!( checkpoint = ?diff.checkpoint, num_events = diff.patch.len(),