pub struct AccountManager { /* private fields */ }
Implementations§
Source§impl AccountManager
impl AccountManager
pub fn new(service: PushService, profile_key: Option<ProfileKey>) -> Self
pub async fn check_pre_keys<P: PreKeysStore>( &mut self, protocol_store: &mut P, service_id_kind: ServiceIdKind, ) -> Result<bool, ServiceError>
Sourcepub async fn update_pre_key_bundle<R: Rng + CryptoRng, P: PreKeysStore>(
&mut self,
protocol_store: &mut P,
service_id_kind: ServiceIdKind,
use_last_resort_key: bool,
csprng: &mut R,
) -> Result<(), ServiceError>
pub async fn update_pre_key_bundle<R: Rng + CryptoRng, P: PreKeysStore>( &mut self, protocol_store: &mut P, service_id_kind: ServiceIdKind, use_last_resort_key: bool, csprng: &mut R, ) -> 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<R: Rng + CryptoRng>(
&mut self,
csprng: &mut R,
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<R: Rng + CryptoRng>( &mut self, csprng: &mut R, 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<R: Rng + CryptoRng, S: AsRef<str>>(
&mut self,
aci: Aci,
name: ProfileName<S>,
about: Option<String>,
about_emoji: Option<String>,
retain_avatar: bool,
csprng: &mut R,
) -> Result<(), ProfileManagerError>
pub async fn upload_versioned_profile_without_avatar<R: Rng + CryptoRng, S: AsRef<str>>( &mut self, aci: Aci, name: ProfileName<S>, about: Option<String>, about_emoji: Option<String>, retain_avatar: bool, csprng: &mut R, ) -> 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: Aci, ) -> Result<Profile, ProfileManagerError>
Sourcepub async fn upload_versioned_profile<'s, C: Read + Send + 's, R: Rng + CryptoRng, S: AsRef<str>>(
&mut self,
aci: Aci,
name: ProfileName<S>,
about: Option<String>,
about_emoji: Option<String>,
avatar: AvatarWrite<&'s mut C>,
csprng: &mut R,
) -> Result<Option<String>, ProfileManagerError>
pub async fn upload_versioned_profile<'s, C: Read + Send + 's, R: Rng + CryptoRng, S: AsRef<str>>( &mut self, aci: Aci, name: ProfileName<S>, about: Option<String>, about_emoji: Option<String>, avatar: AvatarWrite<&'s mut C>, csprng: &mut R, ) -> 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<R: Rng + CryptoRng>(
&mut self,
device_name: &str,
public_key: &IdentityKey,
csprng: &mut R,
) -> Result<(), ServiceError>
pub async fn update_device_name<R: Rng + CryptoRng>( &mut self, device_name: &str, public_key: &IdentityKey, csprng: &mut R, ) -> 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, AciStore: PreKeysStore + SessionStoreExt, PniStore: PreKeysStore, AciOrPni: ProtocolStore + SenderKeyStore + SessionStoreExt + Sync + Clone>(
&mut self,
aci_protocol_store: &mut AciStore,
pni_protocol_store: &mut PniStore,
sender: MessageSender<AciOrPni>,
local_aci: Aci,
e164: PhoneNumber,
csprng: &mut R,
) -> Result<(), MessageSenderError>
pub async fn pnp_initialize_devices<R: Rng + CryptoRng, AciStore: PreKeysStore + SessionStoreExt, PniStore: PreKeysStore, AciOrPni: ProtocolStore + SenderKeyStore + SessionStoreExt + Sync + Clone>( &mut self, aci_protocol_store: &mut AciStore, pni_protocol_store: &mut PniStore, sender: MessageSender<AciOrPni>, local_aci: Aci, 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 Freeze for AccountManager
impl !RefUnwindSafe for AccountManager
impl Send for AccountManager
impl Sync for AccountManager
impl Unpin for AccountManager
impl !UnwindSafe for AccountManager
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> 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