Skip to content

Commit

Permalink
Tidy imports in account crate.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpfs committed Feb 3, 2025
1 parent e2ce5c3 commit d779f9f
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 35 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions crates/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down
34 changes: 17 additions & 17 deletions crates/account/src/account.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -13,22 +13,28 @@ 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,
secret::{Secret, SecretMeta, SecretPath, SecretRow, SecretType},
BuilderCredentials, Header, SecretAccess, Summary, Vault, VaultBuilder,
VaultFlags,
};
use sos_vfs as vfs;
use std::{
borrow::Cow,
collections::HashMap,
Expand All @@ -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;

Expand Down Expand Up @@ -1028,7 +1028,7 @@ impl LocalAccount {
vault_id: &VaultId,
new_key: AccessKey,
) -> Result<Vec<u8>> {
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
Expand Down
6 changes: 3 additions & 3 deletions crates/account/src/account_switcher.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<
Expand Down
2 changes: 1 addition & 1 deletion crates/account/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/account/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
3 changes: 1 addition & 2 deletions crates/account/src/error.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
12 changes: 5 additions & 7 deletions crates/account/src/folder_sync.rs
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
2 changes: 1 addition & 1 deletion crates/account/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl Merge for LocalAccount {
diff: FileDiff,
outcome: &mut MergeOutcome,
) -> Result<CheckedPatch> {
use sos_backend::reducers::FileReducer;
use sos_reducers::FileReducer;
tracing::debug!(
checkpoint = ?diff.checkpoint,
num_events = diff.patch.len(),
Expand Down

0 comments on commit d779f9f

Please sign in to comment.