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

Send a multi device sent transcript content #38

Merged
merged 12 commits into from
Jan 28, 2021
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# IDE settings
.vscode/*
gferon marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion libsignal-service-actix/examples/registering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ async fn main() -> Result<(), Error> {
let args = Args::from_args();

// Only used with MessageSender and MessageReceiver
let _trust_store = args.load_trust_store()?;
gferon marked this conversation as resolved.
Show resolved Hide resolved
let password = args.get_password()?;

let config: ServiceConfiguration = SignalServers::Staging.into();
Expand Down
8 changes: 2 additions & 6 deletions libsignal-service-actix/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl PushService for AwcPushService {
type ByteStream = Box<dyn futures::io::AsyncRead + Unpin>;
type WebSocket = AwcWebSocket;

async fn get<T>(&mut self, path: &str) -> Result<T, ServiceError>
async fn get<T>(&self, path: &str) -> Result<T, ServiceError>
where
for<'de> T: Deserialize<'de>,
{
Expand Down Expand Up @@ -83,11 +83,7 @@ impl PushService for AwcPushService {
}
}

async fn put<D, S>(
&mut self,
path: &str,
value: S,
) -> Result<D, ServiceError>
async fn put<D, S>(&self, path: &str, value: S) -> Result<D, ServiceError>
where
for<'de> D: Deserialize<'de>,
S: Serialize,
Expand Down
6 changes: 5 additions & 1 deletion libsignal-service/src/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ impl ServiceCipher {
session_cipher.get_remote_registration_id()?;
let body = base64::encode(message.serialize()?);
use crate::proto::envelope::Type;
let message_type = match message.get_type()? {
let message_type = match message.get_type().map_err(|_| {
ServiceError::InvalidFrameError {
reason: "unknown message type".into(),
}
})? {
CiphertextType::PreKey => Type::PrekeyBundle,
CiphertextType::Signal => Type::Ciphertext,
t => panic!("Bad type: {:?}", t),
Expand Down
2 changes: 1 addition & 1 deletion libsignal-service/src/messagepipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl<WS: WebSocketService> MessagePipe<WS> {
});
background_work.push(request.boxed_local());
},
Err(e) => log::warn!("Could not send keep alive"),
Err(e) => log::warn!("Could not send keep alive: {}", e),
}
},
None => {
Expand Down
14 changes: 5 additions & 9 deletions libsignal-service/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,11 @@ pub trait PushService {
type WebSocket: WebSocketService;
type ByteStream: futures::io::AsyncRead + Unpin;

async fn get<T>(&mut self, path: &str) -> Result<T, ServiceError>
async fn get<T>(&self, path: &str) -> Result<T, ServiceError>
where
for<'de> T: Deserialize<'de>;

async fn put<D, S>(
&mut self,
path: &str,
value: S,
) -> Result<D, ServiceError>
async fn put<D, S>(&self, path: &str, value: S) -> Result<D, ServiceError>
where
for<'de> D: Deserialize<'de>,
S: Serialize;
Expand Down Expand Up @@ -425,7 +421,7 @@ pub trait PushService {
}

async fn send_messages<'a>(
&mut self,
&self,
messages: OutgoingPushMessages<'a>,
) -> Result<SendMessageResponse, ServiceError> {
let path = format!("/v1/messages/{}", messages.destination);
Expand Down Expand Up @@ -484,7 +480,7 @@ pub trait PushService {
}

async fn get_pre_key(
&mut self,
&self,
context: &Context,
destination: &ServiceAddress,
device_id: i32,
Expand Down Expand Up @@ -528,7 +524,7 @@ pub trait PushService {
}

async fn get_pre_keys(
&mut self,
&self,
context: &Context,
destination: &ServiceAddress,
device_id: i32,
Expand Down
Loading