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

Fix fetching groups and receive PNI identity #164

Merged
merged 6 commits into from
May 2, 2023
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
22 changes: 11 additions & 11 deletions presage-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,18 +500,18 @@ async fn run<C: Store + 'static>(subcommand: Cmd, config_store: C) -> anyhow::Re
}
}
Cmd::Receive { notifications } => {
let mut manager = Manager::load_registered(config_store)?;
let mut manager = Manager::load_registered(config_store).await?;
receive(&mut manager, notifications).await?;
}
Cmd::Send { uuid, message } => {
let mut manager = Manager::load_registered(config_store)?;
let mut manager = Manager::load_registered(config_store).await?;
send(&message, &uuid, &mut manager).await?;
}
Cmd::SendToGroup {
message,
master_key,
} => {
let mut manager = Manager::load_registered(config_store)?;
let mut manager = Manager::load_registered(config_store).await?;

let timestamp = std::time::SystemTime::now()
.duration_since(UNIX_EPOCH)
Expand All @@ -538,7 +538,7 @@ async fn run<C: Store + 'static>(subcommand: Cmd, config_store: C) -> anyhow::Re
uuid,
mut profile_key,
} => {
let mut manager = Manager::load_registered(config_store)?;
let mut manager = Manager::load_registered(config_store).await?;
if profile_key.is_none() {
for contact in manager
.contacts()?
Expand Down Expand Up @@ -566,7 +566,7 @@ async fn run<C: Store + 'static>(subcommand: Cmd, config_store: C) -> anyhow::Re
Cmd::Unblock => unimplemented!(),
Cmd::UpdateContact => unimplemented!(),
Cmd::ListGroups => {
let manager = Manager::load_registered(config_store)?;
let manager = Manager::load_registered(config_store).await?;
for group in manager.groups()? {
match group {
Ok((
Expand All @@ -592,7 +592,7 @@ async fn run<C: Store + 'static>(subcommand: Cmd, config_store: C) -> anyhow::Re
}
}
Cmd::ListContacts => {
let manager = Manager::load_registered(config_store)?;
let manager = Manager::load_registered(config_store).await?;
for Contact {
name,
uuid,
Expand All @@ -604,11 +604,11 @@ async fn run<C: Store + 'static>(subcommand: Cmd, config_store: C) -> anyhow::Re
}
}
Cmd::Whoami => {
let manager = Manager::load_registered(config_store)?;
let manager = Manager::load_registered(config_store).await?;
println!("{:?}", &manager.whoami().await?);
}
Cmd::GetContact { ref uuid } => {
let manager = Manager::load_registered(config_store)?;
let manager = Manager::load_registered(config_store).await?;
match manager.contact_by_id(uuid)? {
Some(contact) => println!("{contact:#?}"),
None => eprintln!("Could not find contact for {uuid}"),
Expand All @@ -619,7 +619,7 @@ async fn run<C: Store + 'static>(subcommand: Cmd, config_store: C) -> anyhow::Re
phone_number,
ref name,
} => {
let manager = Manager::load_registered(config_store)?;
let manager = Manager::load_registered(config_store).await?;
for contact in manager
.contacts()?
.filter_map(Result::ok)
Expand All @@ -632,15 +632,15 @@ async fn run<C: Store + 'static>(subcommand: Cmd, config_store: C) -> anyhow::Re
}
#[cfg(feature = "quirks")]
Cmd::RequestSyncContacts => {
let mut manager = Manager::load_registered(config_store)?;
let mut manager = Manager::load_registered(config_store).await?;
manager.request_contacts_sync().await?;
}
Cmd::ListMessages {
group_master_key,
recipient_uuid,
from,
} => {
let manager = Manager::load_registered(config_store)?;
let manager = Manager::load_registered(config_store).await?;
let thread = match (group_master_key, recipient_uuid) {
(Some(master_key), _) => Thread::Group(master_key),
(_, Some(uuid)) => Thread::Contact(uuid),
Expand Down
12 changes: 7 additions & 5 deletions presage-store-sled/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use presage::{
prelude::{
protocol::{
Context, Direction, IdentityKey, IdentityKeyPair, IdentityKeyStore, PreKeyId,
PreKeyRecord, PreKeyStore, ProtocolAddress, SenderKeyRecord, SenderKeyStore,
SessionRecord, SessionStore, SessionStoreExt, SignalProtocolError, SignedPreKeyId,
SignedPreKeyRecord, SignedPreKeyStore,
PreKeyRecord, PreKeyStore, ProtocolAddress, ProtocolStore, SenderKeyRecord,
SenderKeyStore, SessionRecord, SessionStore, SessionStoreExt, SignalProtocolError,
SignedPreKeyId, SignedPreKeyRecord, SignedPreKeyStore,
},
Content, ProfileKey, Uuid,
},
Expand Down Expand Up @@ -325,6 +325,8 @@ fn migrate(
Ok(())
}

impl ProtocolStore for SledStore {}

impl Store for SledStore {
type Error = SledStoreError;

Expand Down Expand Up @@ -833,8 +835,8 @@ impl IdentityKeyStore for SledStore {
"no registration data".into(),
))?;
Ok(IdentityKeyPair::new(
IdentityKey::new(state.public_key),
state.private_key,
IdentityKey::new(state.aci_public_key),
state.aci_private_key,
))
}

Expand Down
4 changes: 2 additions & 2 deletions presage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ authors = ["Gabriel Féron <g@leirbag.net>"]
edition = "2021"

[dependencies]
libsignal-service = { git = "https://github.com/whisperfish/libsignal-service-rs", rev = "f11b2d1" }
libsignal-service-hyper = { git = "https://github.com/whisperfish/libsignal-service-rs", rev = "f11b2d1" }
libsignal-service = { git = "https://github.com/whisperfish/libsignal-service-rs", rev = "c2f70ef" }
libsignal-service-hyper = { git = "https://github.com/whisperfish/libsignal-service-rs", rev = "c2f70ef" }

base64 = "0.12"
futures = "0.3"
Expand Down
Loading