Skip to content

Commit

Permalink
Move search module inside account module.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpfs committed Nov 27, 2023
1 parent 27af483 commit 816dde7
Show file tree
Hide file tree
Showing 24 changed files with 34 additions and 32 deletions.
13 changes: 9 additions & 4 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions src/commands/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ use terminal_banner::{Banner, Padding};

use sos_net::sdk::{
account::{
search::{ArchiveFilter, DocumentView},
search::{ArchiveFilter, DocumentView, Document},
AccountRef,
},
search::Document,
vault::{
secret::{Secret, SecretId, SecretMeta, SecretRef, SecretRow},
Summary, VaultRef,
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use terminal_banner::{Banner, Padding};
use secrecy::{ExposeSecret, SecretString};
use sos_net::sdk::{
hex,
search::Document,
account::search::Document,
secrecy,
url::Url,
vault::{
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/account_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use sos_net::sdk::{
files::FileStorage,
Account, DelegatedPassphrase, AccountsList,
LocalProvider,
search::SearchIndex,
},
hex,
passwd::diceware::generate_passphrase,
search::SearchIndex,
vault::{secret::SecretId, Gatekeeper, VaultId},
vfs,
};
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/csv/bitwarden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ mod test {

use sos_sdk::{
passwd::diceware::generate_passphrase,
search::SearchIndex,
account::search::SearchIndex,
vault::{Gatekeeper, VaultBuilder},
};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/csv/chrome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mod test {

use sos_sdk::{
passwd::diceware::generate_passphrase,
search::SearchIndex,
account::search::SearchIndex,
vault::{Gatekeeper, VaultBuilder},
};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/csv/dashlane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ mod test {

use sos_sdk::{
passwd::diceware::generate_passphrase,
search::SearchIndex,
account::search::SearchIndex,
vault::{secret::Secret, Gatekeeper, VaultBuilder},
};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/csv/firefox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ mod test {

use sos_sdk::{
passwd::diceware::generate_passphrase,
search::SearchIndex,
account::search::SearchIndex,
vault::{Gatekeeper, VaultBuilder},
};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/csv/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ mod test {

use sos_sdk::{
passwd::diceware::generate_passphrase,
search::SearchIndex,
account::search::SearchIndex,
vault::{Gatekeeper, VaultBuilder},
};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/csv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use url::Url;
use vcard4::Vcard;

use sos_sdk::{
account::search::SearchIndex,
crypto::AccessKey,
search::SearchIndex,
vault::{
secret::{IdentityKind, Secret, SecretMeta},
Gatekeeper, Vault,
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/csv/one_password.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ mod test {

use sos_sdk::{
passwd::diceware::generate_passphrase,
search::SearchIndex,
account::search::SearchIndex,
vault::{Gatekeeper, VaultBuilder},
};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion workspace/migrate/src/import/keychain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use std::{
};

use sos_sdk::{
account::search::SearchIndex,
crypto::AccessKey,
search::SearchIndex,
vault::{
secret::{Secret, SecretMeta},
Gatekeeper, Vault,
Expand Down
3 changes: 1 addition & 2 deletions workspace/net/src/client/account/user_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use sos_sdk::{
archive::{
AccountBackup, ExtractFilesLocation, Inventory, RestoreOptions,
},
search::UserIndex,
search::{UserIndex, DocumentCount, SearchIndex},
Account, AccountBuilder, AccountData, AccountHandler, AccountInfo,
AuthenticatedUser, DelegatedPassphrase, DetachedView,
AccountsList, LocalProvider, NewAccount, SecretOptions, UserPaths,
Expand All @@ -28,7 +28,6 @@ use sos_sdk::{
Event, EventKind, EventReducer, ReadEvent, WriteEvent,
},
mpc::generate_keypair,
search::{DocumentCount, SearchIndex},
signer::ecdsa::Address,
vault::{
secret::{Secret, SecretData, SecretId, SecretMeta, SecretType},
Expand Down
2 changes: 1 addition & 1 deletion workspace/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contacts = []
security-report = []

[dependencies]
sos-vfs = "0.1"
sos-vfs = "0.2"
async-trait = "0.1"
async-recursion = "1"
aes-gcm = { version = "0.10.1", features = ["std"] }
Expand Down
4 changes: 2 additions & 2 deletions workspace/sdk/src/account/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::{
AccountBuilder, AccountInfo, AuthenticatedUser,
DelegatedPassphrase, AccountsList, LocalProvider, NewAccount,
UserPaths,
search::{DocumentCount, SearchIndex},
},
commit::{CommitHash, CommitProof, CommitState},
crypto::{AccessKey, SecureAccessKey},
Expand All @@ -28,7 +29,6 @@ use crate::{
Event, EventKind, EventReducer, ReadEvent, WriteEvent,
},
mpc::generate_keypair,
search::{DocumentCount, SearchIndex},
signer::ecdsa::Address,
vault::{
secret::{Secret, SecretData, SecretId, SecretMeta, SecretType},
Expand All @@ -52,7 +52,7 @@ use async_trait::async_trait;

use super::{files::FileProgress, search::UserIndex};

/// Account handler provides is notified of account changes.
/// Account handler is notified of account changes.
#[async_trait::async_trait]
pub trait AccountHandler {
/// Data associated with this handler.
Expand Down
2 changes: 1 addition & 1 deletion workspace/sdk/src/account/archive/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ use crate::{
archive::{ArchiveItem, Inventory, Reader, Writer},
identity::Identity,
AccountInfo, DelegatedPassphrase, AccountsList, UserPaths,
search::SearchIndex,
},
constants::{EVENT_LOG_EXT, VAULT_EXT},
crypto::AccessKey,
decode, encode,
events::{FolderEventLog, WriteEvent},
passwd::ChangePassword,
search::SearchIndex,
sha2::{Digest, Sha256},
vault::{
secret::SecretId, Gatekeeper, Summary, Vault, VaultAccess, VaultId,
Expand Down
2 changes: 1 addition & 1 deletion workspace/sdk/src/account/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ use urn::Urn;
use web3_address::ethereum::Address;

use crate::{
account::search::SearchIndex,
commit::{CommitHash, CommitProof, CommitState},
constants::{LOGIN_AGE_KEY_URN, LOGIN_SIGNING_KEY_URN},
crypto::KeyDerivation,
decode,
search::SearchIndex,
signer::{
ecdsa::{BoxedEcdsaSigner, SingleParty},
Signer,
Expand Down
5 changes: 3 additions & 2 deletions workspace/sdk/src/account/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ use urn::Urn;
use web3_address::ethereum::Address;

use crate::{
account::{AccountInfo, DelegatedPassphrase, AccountsList, UserPaths},
account::{AccountInfo, DelegatedPassphrase, AccountsList, UserPaths,
search::SearchIndex,
},
constants::{DEVICE_KEY_URN, VAULT_EXT},
crypto::AccessKey,
encode,
events::{AuditEvent, Event, EventKind},
search::SearchIndex,
signer::{
ed25519::{self, BoxedEd25519Signer, VerifyingKey},
Signer,
Expand Down
2 changes: 1 addition & 1 deletion workspace/sdk/src/account/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
account::{
archive::RestoreTargets, AccountStatus, NewAccount,
UserPaths,
search::SearchIndex,
},
commit::{CommitHash, CommitTree},
constants::VAULT_EXT,
Expand All @@ -13,7 +14,6 @@ use crate::{
ReadEvent, WriteEvent,
},
passwd::{diceware::generate_passphrase, ChangePassword},
search::SearchIndex,
vault::{
secret::{Secret, SecretData, SecretId, SecretMeta},
Gatekeeper, Header, Summary, Vault, VaultAccess, VaultBuilder,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//! Account search index.
use std::{collections::HashSet, sync::Arc};

use tokio::sync::RwLock;
use crate::{
crypto::AccessKey,
search::{Document, DocumentCount, SearchIndex},
vault::{
secret::{SecretId, SecretType},
Gatekeeper, Vault, VaultId,
},
vcard4, Result,
};

use tokio::sync::RwLock;
mod index;
pub use index::*;

/// Modify and query a search index.
pub struct UserIndex {
Expand Down
1 change: 0 additions & 1 deletion workspace/sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub mod prelude;
#[cfg(feature = "recovery")]
pub mod recovery;

pub mod search;
pub mod signer;
mod timestamp;
pub mod vault;
Expand Down
1 change: 0 additions & 1 deletion workspace/sdk/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub use crate::constants::*;
pub use crate::crypto::*;
pub use crate::events::*;
pub use crate::formats::*;
pub use crate::search::*;
pub use crate::signer::ecdsa::Address;
pub use crate::vault::secret::*;
pub use crate::vault::*;
Expand Down
2 changes: 1 addition & 1 deletion workspace/sdk/src/vault/gatekeeper.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Gatekeeper manages access to a vault.
use crate::{
account::search::SearchIndex,
crypto::{AccessKey, KeyDerivation, PrivateKey},
decode, encode,
events::{ReadEvent, WriteEvent},
search::SearchIndex,
vault::{
secret::{Secret, SecretId, SecretMeta},
SharedAccess, Summary, Vault, VaultAccess, VaultCommit, VaultEntry,
Expand Down

0 comments on commit 816dde7

Please sign in to comment.