Skip to content

Commit

Permalink
chore: move phonebook initialization outside of Identity
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed Oct 25, 2023
1 parent 385ec6b commit 547d614
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 4 additions & 1 deletion extensions/warp-ipfs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ use warp::multipass::{

use crate::config::Bootstrap;
use crate::store::discovery::Discovery;
use crate::store::phonebook::PhoneBook;
use crate::store::{ecdh_decrypt, ecdh_encrypt};

#[derive(Clone)]
Expand Down Expand Up @@ -454,13 +455,15 @@ impl WarpIpfs {
relays.clone(),
);

let phonebook = PhoneBook::new(discovery.clone(), pb_tx);

info!("Initializing identity profile");
let identity_store = IdentityStore::new(
ipfs.clone(),
config.path.clone(),
tesseract.clone(),
self.multipass_tx.clone(),
pb_tx,
phonebook,
&config,
discovery.clone(),
)
Expand Down
6 changes: 1 addition & 5 deletions extensions/warp-ipfs/src/store/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//onto the lock.
#![allow(clippy::clone_on_copy)]
use crate::{
behaviour::phonebook::PhoneBookCommand,
config::{self, Discovery as DiscoveryConfig, UpdateEvents},
store::{did_to_libp2p_pub, discovery::Discovery, DidExt, PeerIdExt, PeerTopic},
};
Expand Down Expand Up @@ -234,7 +233,7 @@ impl IdentityStore {
path: Option<PathBuf>,
tesseract: Tesseract,
tx: broadcast::Sender<MultiPassEventKind>,
pb_tx: futures::channel::mpsc::Sender<PhoneBookCommand>,
phonebook: PhoneBook,
config: &config::Config,
discovery: Discovery,
) -> Result<Self, Error> {
Expand Down Expand Up @@ -262,8 +261,6 @@ impl IdentityStore {
discovery.clone(),
);

let phonebook = PhoneBook::new(discovery.clone(), pb_tx);

let signal = Default::default();

let store = Self {
Expand Down Expand Up @@ -381,7 +378,6 @@ impl IdentityStore {

log::debug!("Event: {event:?}");


if let Err(e) = store.process_message(in_did, event).await {
error!("Error: {e}");
}
Expand Down

0 comments on commit 547d614

Please sign in to comment.