Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into dev3
Browse files Browse the repository at this point in the history
  • Loading branch information
nanu-c committed May 6, 2023
2 parents 82c4e6e + 9935bb0 commit 97ebefc
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 121 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

### Changed

## [0.5.2]

### Added

- Set registration for PNI (phone-number identity) which will be fully implemented later. (#164)

### Fixed

- Fix synchronization issue in the `sled` store implementation which could lead to corrupted sessions. (#162)
- Don't reuse websocket when sending unidentified messages. (#165)
- Fix fetching groups v2 metadata. (#164)

### Changed

- `Manager::load_registered` is now an async method (small breaking change, sorry!). (#164)

## [0.5.1]

Note: this release splits the project into multiple crates, to prepare for adding concurrent store implementations.
Expand Down Expand Up @@ -76,4 +90,5 @@ and then get the store implementation from the store crate instead when importin

[0.5.0]: https://github.com/whisperfish/presage/compare/0.4.0...0.5.0
[0.5.1]: https://github.com/whisperfish/presage/compare/0.5.0...0.5.1
[Unreleased]: https://github.com/whisperfish/presage/compare/0.5.1...main
[0.5.2]: https://github.com/whisperfish/presage/compare/0.5.1...0.5.2
[Unreleased]: https://github.com/whisperfish/presage/compare/0.5.2...main
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 @@ -334,6 +334,8 @@ fn migrate(
Ok(())
}

impl ProtocolStore for SledStore {}

impl Store for SledStore {
type Error = SledStoreError;

Expand Down Expand Up @@ -873,8 +875,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

0 comments on commit 97ebefc

Please sign in to comment.