Struct libsignal_service::AccountManager

source ·
pub struct AccountManager<Service> { /* private fields */ }

Implementations§

source§

impl<Service: PushService> AccountManager<Service>

source

pub fn new(service: Service, profile_key: Option<ProfileKey>) -> Self

source

pub async fn update_pre_key_bundle<R: Rng + CryptoRng, P: PreKeysStore>( &mut self, protocol_store: &mut P, service_id_type: ServiceIdType, csprng: &mut R, use_last_resort_key: bool, ) -> Result<(), ServiceError>

Checks the availability of pre-keys, and updates them as necessary.

Parameters are the protocol’s StoreContext, and the offsets for the next pre-key and signed pre-keys.

Equivalent to Java’s RefreshPreKeysJob

Link a new device, given a tsurl.

Equivalent of Java’s AccountManager::addDevice()

When calling this, make sure that UnidentifiedDelivery is disabled, ie., that your application does not send any unidentified messages before linking is complete. Cfr.:

  • app/src/main/java/org/thoughtcrime/securesms/migrations/LegacyMigrationJob.java:250 and;
  • app/src/main/java/org/thoughtcrime/securesms/DeviceActivity.java:195
TextSecurePreferences.setIsUnidentifiedDeliveryEnabled(context, false);
source

pub async fn linked_devices( &mut self, aci_identity_store: &dyn IdentityKeyStore, ) -> Result<Vec<DeviceInfo>, ServiceError>

source

pub async fn register_account<R: Rng + CryptoRng, Aci: PreKeysStore + IdentityKeyStore, Pni: PreKeysStore + IdentityKeyStore>( &mut self, csprng: &mut R, registration_method: RegistrationMethod<'_>, account_attributes: AccountAttributes, aci_protocol_store: &mut Aci, pni_protocol_store: &mut Pni, skip_device_transfer: bool, ) -> Result<VerifyAccountResponse, ProvisioningError>

source

pub async fn upload_versioned_profile_without_avatar<S: AsRef<str>>( &mut self, aci: Aci, name: ProfileName<S>, about: Option<String>, about_emoji: Option<String>, retain_avatar: bool, ) -> Result<(), ProfileManagerError>

Upload a profile

Panics if no profile_key was set.

Convenience method for

manager.upload_versioned_profile::<std::io::Cursor<Vec<u8>>, _>(uuid, name, about, about_emoji, _)

in which the retain_avatar parameter sets whether to remove (false) or retain (true) the currently set avatar.

source

pub async fn retrieve_profile( &mut self, address: ServiceAddress, ) -> Result<Profile, ProfileManagerError>

source

pub async fn upload_versioned_profile<'s, C: Read + Send + 's, S: AsRef<str>>( &mut self, aci: Aci, name: ProfileName<S>, about: Option<String>, about_emoji: Option<String>, avatar: AvatarWrite<&'s mut C>, ) -> Result<Option<String>, ProfileManagerError>

Upload a profile

Panics if no profile_key was set.

Returns the avatar url path.

source

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

Set profile attributes

Signal Android does not allow unsetting voice/video.

source

pub async fn update_device_name( &mut self, device_name: &str, public_key: &IdentityKey, ) -> Result<(), ServiceError>

Update (encrypted) device name

source

pub async fn submit_recaptcha_challenge( &mut self, token: &str, captcha: &str, ) -> Result<(), ServiceError>

Upload a proof-required reCaptcha token and response.

Token gotten originally with HTTP status 428 response to sending a message. Captcha gotten from user completing the challenge captcha.

It’s either a silent OK, or throws a ServiceError.

source

pub async fn pnp_initialize_devices<R: Rng + CryptoRng, Aci: PreKeysStore + SessionStoreExt, Pni: PreKeysStore, AciOrPni: ProtocolStore + SenderKeyStore + SessionStoreExt + Sync + Clone>( &mut self, aci_protocol_store: &mut Aci, pni_protocol_store: &mut Pni, sender: MessageSender<Service, AciOrPni, R>, local_aci: ServiceAddress, e164: PhoneNumber, csprng: &mut R, ) -> Result<(), MessageSenderError>

Initialize PNI on linked devices.

Should be called as the primary device to migrate from pre-PNI to PNI.

This is the equivalent of Android’s PnpInitializeDevicesJob or iOS’ PniHelloWorldManager.

Auto Trait Implementations§

§

impl<Service> Freeze for AccountManager<Service>
where Service: Freeze,

§

impl<Service> RefUnwindSafe for AccountManager<Service>
where Service: RefUnwindSafe,

§

impl<Service> Send for AccountManager<Service>
where Service: Send,

§

impl<Service> Sync for AccountManager<Service>
where Service: Sync,

§

impl<Service> Unpin for AccountManager<Service>
where Service: Unpin,

§

impl<Service> UnwindSafe for AccountManager<Service>
where Service: UnwindSafe,

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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
§

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, 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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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

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
§

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> MaybeSend for T