Struct PushService

Source
pub struct PushService { /* private fields */ }

Implementations§

Source§

impl PushService

Source

pub async fn whoami(&mut self) -> Result<WhoAmIResponse, ServiceError>

Method used to check our own UUID

Source

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.

Source

pub async fn set_account_attributes( &mut self, attributes: AccountAttributes, ) -> Result<(), ServiceError>

Source§

impl PushService

Source

pub async fn get_attachment( &mut self, ptr: &AttachmentPointer, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>

Source

pub async fn upload_to_cdn0( &mut self, path: &str, upload_attributes: AttachmentV2UploadAttributes, filename: String, reader: impl Read + Send, ) -> Result<(), ServiceError>

Source§

impl PushService

Source

pub async fn get_pre_key_status( &mut self, service_id_kind: ServiceIdKind, ) -> Result<PreKeyStatus, ServiceError>

Source

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.

Source

pub async fn register_pre_keys( &mut self, service_id_kind: ServiceIdKind, pre_key_state: PreKeyState, ) -> Result<(), ServiceError>

Source

pub async fn get_pre_key( &mut self, destination: &ServiceId, device_id: u32, ) -> Result<PreKeyBundle, ServiceError>

Source

pub async fn get_sender_certificate( &mut self, ) -> Result<SenderCertificate, ServiceError>

Source

pub async fn get_uuid_only_sender_certificate( &mut self, ) -> Result<SenderCertificate, ServiceError>

Source

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 PushService

Source§

impl PushService

Source

pub async fn retrieve_profile_by_id( &mut self, address: Aci, profile_key: Option<ProfileKey>, ) -> Result<SignalServiceProfile, ServiceError>

Source

pub async fn retrieve_profile_avatar( &mut self, path: &str, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>

Source

pub async fn retrieve_groups_v2_profile_avatar( &mut self, path: &str, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>

Source

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>
where C: Read + Send + 's, S: AsRef<str>,

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 PushService

Source

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>

Source

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>

Source

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>

Source

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

pub async fn submit_verification_code( &mut self, session_id: &str, verification_code: &str, ) -> Result<RegistrationSessionMetadataResponse, ServiceError>

Source§

impl PushService

Source

pub async fn get_sticker_pack_manifest( &mut self, id: &str, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>

Source

pub async fn get_sticker( &mut self, pack_id: &str, sticker_id: u32, ) -> Result<impl AsyncRead + Send + Unpin, ServiceError>

Source§

impl PushService

Source

pub fn new( cfg: impl Into<ServiceConfiguration>, credentials: Option<ServiceCredentials>, user_agent: impl AsRef<str>, ) -> Self

Source

pub fn request( &self, method: Method, endpoint: Endpoint<'_>, auth_override: HttpAuthOverride, ) -> Result<RequestBuilder, ServiceError>

Source

pub async fn ws( &mut self, path: &str, keepalive_path: &str, additional_headers: &[(&'static str, &str)], credentials: Option<ServiceCredentials>, ) -> Result<SignalWebSocket, ServiceError>

Trait Implementations§

Source§

impl Clone for PushService

Source§

fn clone(&self) -> PushService

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more