pub struct IdentityManager { /* private fields */ }
Expand description
Identity manager for handling user identities and network integration
Implementations§
Source§impl IdentityManager
impl IdentityManager
Sourcepub fn new(config: IdentityManagerConfig) -> Self
pub fn new(config: IdentityManagerConfig) -> Self
Create a new identity manager
Sourcepub fn set_network(&mut self, network: Arc<P2PNode>)
pub fn set_network(&mut self, network: Arc<P2PNode>)
Set the P2P network reference
Sourcepub async fn create_identity(
&self,
display_name: String,
three_word_address: String,
ipv6_identity: Option<IPv6NodeID>,
ipv6_keypair: Option<&Keypair>,
) -> Result<UserIdentity>
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
Sourcepub async fn load_identity(
&self,
keypair: Keypair,
encrypted_profile_data: Vec<u8>,
profile_key: [u8; 32],
) -> Result<UserIdentity>
pub async fn load_identity( &self, keypair: Keypair, encrypted_profile_data: Vec<u8>, profile_key: [u8; 32], ) -> Result<UserIdentity>
Load existing identity from storage
Sourcepub async fn get_local_identity(&self) -> Option<UserIdentity>
pub async fn get_local_identity(&self) -> Option<UserIdentity>
Get local user identity
Sourcepub async fn get_local_profile(&self) -> Result<Option<UserProfile>>
pub async fn get_local_profile(&self) -> Result<Option<UserProfile>>
Get local user profile (decrypted)
Sourcepub async fn update_local_profile(&self, profile: UserProfile) -> Result<()>
pub async fn update_local_profile(&self, profile: UserProfile) -> Result<()>
Update local user profile
Sourcepub async fn publish_to_dht(&self) -> Result<()>
pub async fn publish_to_dht(&self) -> Result<()>
Publish identity and profile to DHT
Sourcepub async fn lookup_user(
&self,
user_id: &UserId,
) -> Result<Option<(UserIdentity, EncryptedUserProfile)>>
pub async fn lookup_user( &self, user_id: &UserId, ) -> Result<Option<(UserIdentity, EncryptedUserProfile)>>
Lookup user identity and profile from DHT
Sourcepub async fn get_friend_profile(
&self,
user_id: &UserId,
) -> Result<Option<UserProfile>>
pub async fn get_friend_profile( &self, user_id: &UserId, ) -> Result<Option<UserProfile>>
Decrypt and retrieve a friend’s profile if we have access
Sourcepub async fn grant_profile_access(
&self,
grantee_user_id: UserId,
grantee_public_key_bytes: Vec<u8>,
permissions: ProfilePermissions,
) -> Result<()>
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
Sourcepub async fn revoke_profile_access(&self, user_id: &UserId) -> Result<()>
pub async fn revoke_profile_access(&self, user_id: &UserId) -> Result<()>
Revoke access to local profile
Sourcepub async fn create_challenge(&self, duration: Duration) -> IdentityChallenge
pub async fn create_challenge(&self, duration: Duration) -> IdentityChallenge
Create an identity challenge
Sourcepub async fn verify_challenge_response(
&self,
proof: &ChallengeProof,
public_key_bytes: &[u8],
) -> Result<bool>
pub async fn verify_challenge_response( &self, proof: &ChallengeProof, public_key_bytes: &[u8], ) -> Result<bool>
Verify a challenge response
Sourcepub async fn create_contact_request(
&self,
to_user_id: UserId,
message: Option<String>,
requested_permissions: ProfilePermissions,
) -> Result<ContactRequest>
pub async fn create_contact_request( &self, to_user_id: UserId, message: Option<String>, requested_permissions: ProfilePermissions, ) -> Result<ContactRequest>
Create a contact request
Sourcepub async fn accept_contact_request(
&self,
request: &ContactRequest,
granted_permissions: ProfilePermissions,
) -> Result<()>
pub async fn accept_contact_request( &self, request: &ContactRequest, granted_permissions: ProfilePermissions, ) -> Result<()>
Accept a contact request
Sourcepub async fn cleanup_expired(&self)
pub async fn cleanup_expired(&self)
Clean up expired entries
Sourcepub async fn export_identity(&self) -> Result<Vec<u8>>
pub async fn export_identity(&self) -> Result<Vec<u8>>
Export identity for backup/sync
Sourcepub async fn import_identity(&self, export_data: &[u8]) -> Result<UserIdentity>
pub async fn import_identity(&self, export_data: &[u8]) -> Result<UserIdentity>
Import identity from backup
Auto Trait Implementations§
impl !Freeze for IdentityManager
impl !RefUnwindSafe for IdentityManager
impl Send for IdentityManager
impl Sync for IdentityManager
impl Unpin for IdentityManager
impl !UnwindSafe for IdentityManager
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
Mutably borrows from an owned value. Read more