Struct AccountManager
pub struct AccountManager<R = StackedRatchet, Fcm = ThinRatchet>where
R: Ratchet,
Fcm: Ratchet,{ /* private fields */ }
Expand description
The default manager for handling the list of users stored locally. It also allows for user creation, and is used especially for when creating a new user via the registration service.
Implementations§
§impl<R, Fcm> AccountManager<R, Fcm>where
R: Ratchet,
Fcm: Ratchet,
impl<R, Fcm> AccountManager<R, Fcm>where
R: Ratchet,
Fcm: Ratchet,
pub async fn new(
backend_type: BackendType,
server_argon_settings: Option<ArgonDefaultServerSettings>,
_services_cfg: Option<ServicesConfig>,
server_misc_settings: Option<ServerMiscSettings>,
) -> Result<AccountManager<R, Fcm>, AccountError>
pub async fn new( backend_type: BackendType, server_argon_settings: Option<ArgonDefaultServerSettings>, _services_cfg: Option<ServicesConfig>, server_misc_settings: Option<ServerMiscSettings>, ) -> Result<AccountManager<R, Fcm>, AccountError>
bind_addr
: Required for determining the local save directories for this instance
home_dir
: Optional. Overrides the default storage location for files
server_argon_settings
: Security settings used for saving the password to the backend. The AD will be replaced each time a new user is created, so it can be empty
pub fn services_handler(&self) -> &ServicesHandler
pub fn services_handler(&self) -> &ServicesHandler
Returns a reference to the services handler
pub async fn register_impersonal_hyperlan_client_network_account(
&self,
conn_info: ConnectionInfo,
creds: ProposedCredentials,
init_hyper_ratchet: R,
) -> Result<ClientNetworkAccount<R, Fcm>, AccountError>
pub async fn register_impersonal_hyperlan_client_network_account( &self, conn_info: ConnectionInfo, creds: ProposedCredentials, init_hyper_ratchet: R, ) -> Result<ClientNetworkAccount<R, Fcm>, AccountError>
Once a valid and decrypted stage 4 packet gets received by the server (Bob), this function should be called to create the new CNAC. The generated CNAC will be assumed to be an impersonal hyperlan client
This also generates the argon-2id password hash
pub async fn register_personal_hyperlan_server(
&self,
hyper_ratchet: R,
creds: ProposedCredentials,
conn_info: ConnectionInfo,
) -> Result<ClientNetworkAccount<R, Fcm>, AccountError>
pub async fn register_personal_hyperlan_server( &self, hyper_ratchet: R, creds: ProposedCredentials, conn_info: ConnectionInfo, ) -> Result<ClientNetworkAccount<R, Fcm>, AccountError>
whereas the HyperLAN server (Bob) runs register_impersonal_hyperlan_client_network_account
, the registering
HyperLAN Client (Alice) runs this function below
pub async fn hyperlan_cid_is_registered(
&self,
cid: u64,
) -> Result<bool, AccountError>
pub async fn hyperlan_cid_is_registered( &self, cid: u64, ) -> Result<bool, AccountError>
Determines if the HyperLAN client is registered Impersonal mode
pub async fn get_registered_impersonal_cids(
&self,
limit: Option<i32>,
) -> Result<Option<Vec<u64>>, AccountError>
pub async fn get_registered_impersonal_cids( &self, limit: Option<i32>, ) -> Result<Option<Vec<u64>>, AccountError>
Returns a list of impersonal cids
pub async fn get_client_by_cid(
&self,
cid: u64,
) -> Result<Option<ClientNetworkAccount<R, Fcm>>, AccountError>
pub async fn get_client_by_cid( &self, cid: u64, ) -> Result<Option<ClientNetworkAccount<R, Fcm>>, AccountError>
Returns the CNAC with the supplied CID
pub async fn get_username_by_cid(
&self,
cid: u64,
) -> Result<Option<String>, AccountError>
pub async fn get_username_by_cid( &self, cid: u64, ) -> Result<Option<String>, AccountError>
Gets username by CID
pub async fn get_full_name_by_cid(
&self,
cid: u64,
) -> Result<Option<String>, AccountError>
pub async fn get_full_name_by_cid( &self, cid: u64, ) -> Result<Option<String>, AccountError>
Gets full name by CID
pub async fn get_peer_info_from_cids(
&self,
cids: &[u64],
) -> HashMap<u64, Option<PeerInfo>>
pub async fn get_peer_info_from_cids( &self, cids: &[u64], ) -> HashMap<u64, Option<PeerInfo>>
Gets user info for all the given CIDs, omitting any invalid users from the returned values
pub async fn get_client_by_username<T>(
&self,
username: T,
) -> Result<Option<ClientNetworkAccount<R, Fcm>>, AccountError>
pub async fn get_client_by_username<T>( &self, username: T, ) -> Result<Option<ClientNetworkAccount<R, Fcm>>, AccountError>
Returns the first username detected. This is not advised to use, because overlapping usernames are entirely possible. Instead, use get_client_by_cid, as the cid is unique unlike the username
pub async fn register_hyperlan_p2p_at_endpoints<T>(
&self,
implicated_cid: u64,
peer_cid: u64,
adjacent_username: T,
) -> Result<(), AccountError>
pub async fn register_hyperlan_p2p_at_endpoints<T>( &self, implicated_cid: u64, peer_cid: u64, adjacent_username: T, ) -> Result<(), AccountError>
Does not execute the registration process between two peers; it only consolidates the changes to the local CNAC returns true if success, false otherwise
pub async fn register_hyperlan_p2p_as_server(
&self,
cid0: u64,
cid1: u64,
) -> Result<(), AccountError>
pub async fn register_hyperlan_p2p_as_server( &self, cid0: u64, cid1: u64, ) -> Result<(), AccountError>
Registers the two accounts together at the server
pub async fn delete_client_by_cid(&self, cid: u64) -> Result<(), AccountError>
pub async fn delete_client_by_cid(&self, cid: u64) -> Result<(), AccountError>
Deletes a client by cid. Returns true if a success
pub async fn get_hyperlan_peer_list(
&self,
implicated_cid: u64,
) -> Result<Option<Vec<u64>>, AccountError>
pub async fn get_hyperlan_peer_list( &self, implicated_cid: u64, ) -> Result<Option<Vec<u64>>, AccountError>
Gets a list of hyperlan peers for the given peer
pub async fn find_target_information(
&self,
implicated_user: impl Into<UserIdentifier>,
target_user: impl Into<UserIdentifier>,
) -> Result<Option<(u64, MutualPeer)>, AccountError>
pub async fn find_target_information( &self, implicated_user: impl Into<UserIdentifier>, target_user: impl Into<UserIdentifier>, ) -> Result<Option<(u64, MutualPeer)>, AccountError>
Finds a hyperlan peer for a given user. Returns the implicated CID and mutual peer info
pub async fn find_local_user_information(
&self,
implicated_user: impl Into<UserIdentifier>,
) -> Result<Option<u64>, AccountError>
pub async fn find_local_user_information( &self, implicated_user: impl Into<UserIdentifier>, ) -> Result<Option<u64>, AccountError>
Converts a user identifier into its cid
pub async fn find_cnac_by_identifier(
&self,
implicated_user: impl Into<UserIdentifier>,
) -> Result<Option<ClientNetworkAccount<R, Fcm>>, AccountError>
pub async fn find_cnac_by_identifier( &self, implicated_user: impl Into<UserIdentifier>, ) -> Result<Option<ClientNetworkAccount<R, Fcm>>, AccountError>
Converts a user identifier into its cid
pub fn get_misc_settings(&self) -> &ServerMiscSettings
pub fn get_misc_settings(&self) -> &ServerMiscSettings
Returns the misc settings
pub fn get_backend_type(&self) -> &BackendType
pub fn get_backend_type(&self) -> &BackendType
Gets the backend type
Trait Implementations§
§impl<R, Fcm> Clone for AccountManager<R, Fcm>
impl<R, Fcm> Clone for AccountManager<R, Fcm>
§fn clone(&self) -> AccountManager<R, Fcm>
fn clone(&self) -> AccountManager<R, Fcm>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<R, Fcm> Freeze for AccountManager<R, Fcm>
impl<R = StackedRatchet, Fcm = ThinRatchet> !RefUnwindSafe for AccountManager<R, Fcm>
impl<R, Fcm> Send for AccountManager<R, Fcm>
impl<R, Fcm> Sync for AccountManager<R, Fcm>
impl<R, Fcm> Unpin for AccountManager<R, Fcm>
impl<R = StackedRatchet, Fcm = ThinRatchet> !UnwindSafe for AccountManager<R, Fcm>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.