1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#![recursion_limit = "256"]
#![deny(clippy::dbg_macro)]
// TODO: we cannot use this until whisperfish builds with a newer Rust version
#![allow(clippy::uninlined_format_args)]

mod account_manager;
pub mod attachment_cipher;
pub mod cipher;
pub mod profile_cipher;
pub mod sticker_cipher;

pub mod configuration;
pub mod content;
mod digeststream;
pub mod envelope;
pub mod groups_v2;
pub mod master_key;
pub mod messagepipe;
pub mod models;
pub mod pre_keys;
pub mod profile_name;
pub mod profile_service;
#[allow(clippy::derive_partial_eq_without_eq)]
pub mod proto;
pub mod provisioning;
pub mod push_service;
pub mod receiver;
pub mod sender;
pub mod service_address;
pub mod session_store;
mod timestamp;
pub mod unidentified_access;
pub mod utils;
pub mod websocket;

pub use crate::account_manager::{
    decrypt_device_name, AccountManager, Profile, ProfileManagerError,
};
pub use crate::service_address::*;

pub const USER_AGENT: &str =
    concat!(env!("CARGO_PKG_NAME"), "-rs-", env!("CARGO_PKG_VERSION"));

/// GROUP_UPDATE_FLAG signals that this message updates the group membership or
/// name.
pub const GROUP_UPDATE_FLAG: u32 = 1;

/// GROUP_LEAVE_FLAG signals that this message is a group leave message.
pub const GROUP_LEAVE_FLAG: u32 = 2;

/// This trait allows for the conditional support of Send compatible futures
/// depending on whether or not the `unsend-futures` feature flag is enabled.
/// As this feature is disabled by default, Send is supported by default.
///
/// This is necessary as actix does not support Send, which means unconditionally
/// imposing this requirement would break libsignal-service-actix.
///
/// Conversely, hyper does support Send, which is why libsignal-service-hyper
/// does not enable the `unsend-futures` feature flag.
#[cfg(not(feature = "unsend-futures"))]
pub trait MaybeSend: Send {}
#[cfg(not(feature = "unsend-futures"))]
impl<T> MaybeSend for T where T: Send {}

#[cfg(feature = "unsend-futures")]
pub trait MaybeSend {}
#[cfg(feature = "unsend-futures")]
impl<T> MaybeSend for T {}

pub mod prelude {
    pub use super::ServiceAddress;
    pub use crate::{
        cipher::ServiceCipher,
        configuration::{
            ServiceConfiguration, ServiceCredentials, SignalingKey,
        },
        content::Content,
        envelope::Envelope,
        groups_v2::{
            AccessControl, Group, Member, PendingMember, RequestingMember,
            Timer,
        },
        master_key::{MasterKey, MasterKeyStore, StorageServiceKey},
        proto::{
            attachment_pointer::AttachmentIdentifier, sync_message::Contacts,
            AttachmentPointer,
        },
        push_service::{PushService, ServiceError},
        receiver::MessageReceiver,
        sender::{MessageSender, MessageSenderError},
        session_store::SessionStoreExt,
    };
    pub use phonenumber;
    pub use prost::Message as ProtobufMessage;
    pub use uuid::{Error as UuidError, Uuid};
    pub use zkgroup::{
        groups::{GroupMasterKey, GroupSecretParams},
        profiles::ProfileKey,
    };

    pub use libsignal_protocol::{DeviceId, IdentityKeyStore};
}

pub use libsignal_protocol as protocol;
pub use zkgroup;