Struct IdentityManager

Source
pub struct IdentityManager { /* private fields */ }
Expand description

Identity manager for handling user identities and network integration

Implementations§

Source§

impl IdentityManager

Source

pub fn new(config: IdentityManagerConfig) -> Self

Create a new identity manager

Source

pub fn set_network(&mut self, network: Arc<P2PNode>)

Set the P2P network reference

Source

pub async fn create_identity( &self, display_name: String, three_word_address: String, ipv6_identity: Option<IPv6NodeID>, ipv6_keypair: Option<&Keypair>, ) -> Result<UserIdentity>

Create a new user identity

Source

pub async fn load_identity( &self, keypair: Keypair, encrypted_profile_data: Vec<u8>, profile_key: [u8; 32], ) -> Result<UserIdentity>

Load existing identity from storage

Source

pub async fn get_local_identity(&self) -> Option<UserIdentity>

Get local user identity

Source

pub async fn get_local_profile(&self) -> Result<Option<UserProfile>>

Get local user profile (decrypted)

Source

pub async fn update_local_profile(&self, profile: UserProfile) -> Result<()>

Update local user profile

Source

pub async fn publish_to_dht(&self) -> Result<()>

Publish identity and profile to DHT

Source

pub async fn lookup_user( &self, user_id: &UserId, ) -> Result<Option<(UserIdentity, EncryptedUserProfile)>>

Lookup user identity and profile from DHT

Source

pub async fn get_friend_profile( &self, user_id: &UserId, ) -> Result<Option<UserProfile>>

Decrypt and retrieve a friend’s profile if we have access

Source

pub async fn grant_profile_access( &self, grantee_user_id: UserId, grantee_public_key_bytes: Vec<u8>, permissions: ProfilePermissions, ) -> Result<()>

Grant access to local profile

Source

pub async fn revoke_profile_access(&self, user_id: &UserId) -> Result<()>

Revoke access to local profile

Source

pub async fn create_challenge(&self, duration: Duration) -> IdentityChallenge

Create an identity challenge

Source

pub async fn verify_challenge_response( &self, proof: &ChallengeProof, public_key_bytes: &[u8], ) -> Result<bool>

Verify a challenge response

Source

pub async fn create_contact_request( &self, to_user_id: UserId, message: Option<String>, requested_permissions: ProfilePermissions, ) -> Result<ContactRequest>

Create a contact request

Source

pub async fn accept_contact_request( &self, request: &ContactRequest, granted_permissions: ProfilePermissions, ) -> Result<()>

Accept a contact request

Source

pub async fn cleanup_expired(&self)

Clean up expired entries

Source

pub async fn export_identity(&self) -> Result<Vec<u8>>

Export identity for backup/sync

Source

pub async fn import_identity(&self, export_data: &[u8]) -> Result<UserIdentity>

Import identity from backup

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

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

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

impl<T> ErasedDestructor for T
where T: 'static,