Struct libsignal_service::AccountManager
source · pub struct AccountManager<Service> { /* private fields */ }
Implementations§
source§impl<Service: PushService> AccountManager<Service>
impl<Service: PushService> AccountManager<Service>
pub fn new(service: Service, profile_key: Option<ProfileKey>) -> Self
sourcepub 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>
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
sourcepub async fn link_device(
&mut self,
url: Url,
aci_identity_store: &dyn IdentityKeyStore,
pni_identity_store: &dyn IdentityKeyStore,
credentials: ServiceCredentials,
master_key: Option<MasterKey>,
) -> Result<(), ProvisioningError>
pub async fn link_device( &mut self, url: Url, aci_identity_store: &dyn IdentityKeyStore, pni_identity_store: &dyn IdentityKeyStore, credentials: ServiceCredentials, master_key: Option<MasterKey>, ) -> Result<(), ProvisioningError>
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);
pub async fn linked_devices( &mut self, aci_identity_store: &dyn IdentityKeyStore, ) -> Result<Vec<DeviceInfo>, ServiceError>
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>
sourcepub 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>
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.
pub async fn retrieve_profile( &mut self, address: ServiceAddress, ) -> Result<Profile, ProfileManagerError>
sourcepub 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>
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.
sourcepub async fn set_account_attributes(
&mut self,
attributes: AccountAttributes,
) -> Result<(), ServiceError>
pub async fn set_account_attributes( &mut self, attributes: AccountAttributes, ) -> Result<(), ServiceError>
Set profile attributes
Signal Android does not allow unsetting voice/video.
sourcepub async fn update_device_name(
&mut self,
device_name: &str,
public_key: &IdentityKey,
) -> Result<(), ServiceError>
pub async fn update_device_name( &mut self, device_name: &str, public_key: &IdentityKey, ) -> Result<(), ServiceError>
Update (encrypted) device name
sourcepub async fn submit_recaptcha_challenge(
&mut self,
token: &str,
captcha: &str,
) -> Result<(), ServiceError>
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.
sourcepub 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>
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> 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
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>
§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> 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