pub struct SignalWebSocket<C: WebSocketType> { /* private fields */ }Expand description
A dispatching web socket client for the Signal web socket API.
This structure can be freely cloned, since this acts as a facade for multiple entry and exit points.
Implementations§
Source§impl SignalWebSocket<Identified>
impl SignalWebSocket<Identified>
Sourcepub async fn whoami(&mut self) -> Result<WhoAmIResponse, ServiceError>
pub async fn whoami(&mut self) -> Result<WhoAmIResponse, ServiceError>
Method used to check our own UUID
Sourcepub async fn devices(&mut self) -> Result<Vec<DeviceInfo>, ServiceError>
pub async fn devices(&mut self) -> Result<Vec<DeviceInfo>, ServiceError>
Fetches a list of all devices tied to the authenticated account.
This list include the device that sends the request.
pub async fn set_account_attributes( &mut self, attributes: AccountAttributes, ) -> Result<(), ServiceError>
Source§impl SignalWebSocket<Identified>
impl SignalWebSocket<Identified>
pub async fn get_pre_key_status( &mut self, service_id_kind: ServiceIdKind, ) -> Result<PreKeyStatus, ServiceError>
Sourcepub async fn check_pre_keys(
&mut self,
service_id_kind: ServiceIdKind,
digest: &[u8; 32],
) -> Result<bool, ServiceError>
pub async fn check_pre_keys( &mut self, service_id_kind: ServiceIdKind, digest: &[u8; 32], ) -> Result<bool, ServiceError>
Checks for consistency of the repeated-use keys
Supply the digest as follows:
SHA256(identityKeyBytes || signedEcPreKeyId || signedEcPreKeyIdBytes || lastResortKeyId || lastResortKeyBytes)
The IDs are represented as 8-byte big endian ints.
Retuns Ok(true) if the view is consistent, Ok(false) if the view is inconsistent.
pub async fn register_pre_keys( &mut self, service_id_kind: ServiceIdKind, pre_key_state: PreKeyState, ) -> Result<(), ServiceError>
pub async fn get_pre_key( &mut self, destination: &ServiceId, device_id: u32, ) -> Result<PreKeyBundle, ServiceError>
pub async fn get_sender_certificate( &mut self, ) -> Result<SenderCertificate, ServiceError>
pub async fn get_uuid_only_sender_certificate( &mut self, ) -> Result<SenderCertificate, ServiceError>
pub async fn distribute_pni_keys( &mut self, pni_identity_key: &IdentityKey, device_messages: Vec<OutgoingPushMessage>, device_pni_signed_prekeys: HashMap<String, SignedPreKeyEntity>, device_pni_last_resort_kyber_prekeys: HashMap<String, KyberPreKeyEntity>, pni_registration_ids: HashMap<String, u32>, signature_valid_on_each_signed_pre_key: bool, ) -> Result<VerifyAccountResponse, ServiceError>
Source§impl SignalWebSocket<Identified>
impl SignalWebSocket<Identified>
pub async fn unlink_device(&mut self, id: i64) -> Result<(), ServiceError>
Source§impl SignalWebSocket<Identified>
impl SignalWebSocket<Identified>
pub async fn retrieve_profile_by_id( &mut self, address: Aci, profile_key: Option<ProfileKey>, ) -> Result<SignalServiceProfile, ServiceError>
Sourcepub async fn write_profile<'s, C, S>(
&mut self,
version: &ProfileKeyVersion,
name: &[u8],
about: &[u8],
emoji: &[u8],
commitment: &ProfileKeyCommitment,
avatar: AvatarWrite<&mut C>,
) -> Result<Option<String>, ServiceError>
pub async fn write_profile<'s, C, S>( &mut self, version: &ProfileKeyVersion, name: &[u8], about: &[u8], emoji: &[u8], commitment: &ProfileKeyCommitment, avatar: AvatarWrite<&mut C>, ) -> Result<Option<String>, ServiceError>
Writes a profile and returns the avatar URL, if one was provided.
The name, about and emoji fields are encrypted with an ProfileCipher.
See AccountManager for a convenience method.
Java equivalent: writeProfile
Source§impl SignalWebSocket<Unidentified>
impl SignalWebSocket<Unidentified>
pub async fn retrieve_profile_avatar( &mut self, path: &str, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>
pub async fn retrieve_groups_v2_profile_avatar( &mut self, path: &str, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>
Source§impl SignalWebSocket<Unidentified>
impl SignalWebSocket<Unidentified>
pub async fn create_verification_session<'a>( &mut self, number: &'a str, push_token: Option<&'a str>, mcc: Option<&'a str>, mnc: Option<&'a str>, ) -> Result<RegistrationSessionMetadataResponse, ServiceError>
pub async fn patch_verification_session<'a>( &mut self, session_id: &'a str, push_token: Option<&'a str>, mcc: Option<&'a str>, mnc: Option<&'a str>, captcha: Option<&'a str>, push_challenge: Option<&'a str>, ) -> Result<RegistrationSessionMetadataResponse, ServiceError>
Sourcepub async fn request_verification_code(
&mut self,
session_id: &str,
client: &str,
transport: VerificationTransport,
) -> Result<RegistrationSessionMetadataResponse, ServiceError>
pub async fn request_verification_code( &mut self, session_id: &str, client: &str, transport: VerificationTransport, ) -> Result<RegistrationSessionMetadataResponse, ServiceError>
Request a verification code.
Signal requires a client type, and they use these three strings internally:
- “android-2021-03”
- “android”
- “ios”
“android-2021-03” allegedly implies FCM support, whereas the other strings don’t. In principle, they will consider any string as “unknown”, so other strings may work too.
Source§impl SignalWebSocket<Identified>
impl SignalWebSocket<Identified>
pub async fn submit_registration_request( &mut self, registration_method: RegistrationMethod<'_>, account_attributes: AccountAttributes, skip_device_transfer: bool, aci_identity_key: &IdentityKey, pni_identity_key: &IdentityKey, device_activation_request: DeviceActivationRequest, ) -> Result<VerifyAccountResponse, ServiceError>
pub async fn submit_verification_code( &mut self, session_id: &str, verification_code: &str, ) -> Result<RegistrationSessionMetadataResponse, ServiceError>
Source§impl<C: WebSocketType> SignalWebSocket<C>
impl<C: WebSocketType> SignalWebSocket<C>
pub async fn send_messages( &mut self, messages: OutgoingPushMessages, ) -> Result<SendMessageResponse, ServiceError>
pub async fn send_messages_unidentified( &mut self, messages: OutgoingPushMessages, access: &UnidentifiedAccess, ) -> Result<SendMessageResponse, ServiceError>
Source§impl<C: WebSocketType> SignalWebSocket<C>
impl<C: WebSocketType> SignalWebSocket<C>
pub async fn get_sticker_pack_manifest( &mut self, id: &str, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>
pub async fn get_sticker( &mut self, pack_id: &str, sticker_id: u32, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>
Source§impl<C: WebSocketType> SignalWebSocket<C>
impl<C: WebSocketType> SignalWebSocket<C>
pub fn new( ws: WebSocket, keep_alive_path: String, unidentified_push_service: PushService, ) -> (Self, impl Future<Output = ()>)
pub fn is_closed(&self) -> bool
pub fn is_used(&self) -> bool
pub async fn with_request_stream<R: 'static, F: FnOnce(&mut SignalRequestStream) -> R>( &mut self, f: F, ) -> R
pub fn request( &mut self, r: WebSocketRequestMessage, ) -> impl Future<Output = Result<WebSocketResponseMessage, ServiceError>>
Trait Implementations§
Source§impl<C: Clone + WebSocketType> Clone for SignalWebSocket<C>
impl<C: Clone + WebSocketType> Clone for SignalWebSocket<C>
Source§fn clone(&self) -> SignalWebSocket<C>
fn clone(&self) -> SignalWebSocket<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<C> Freeze for SignalWebSocket<C>
impl<C> !RefUnwindSafe for SignalWebSocket<C>
impl<C> Send for SignalWebSocket<C>where
C: Send,
impl<C> Sync for SignalWebSocket<C>where
C: Sync,
impl<C> Unpin for SignalWebSocket<C>where
C: Unpin,
impl<C> !UnwindSafe for SignalWebSocket<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more