pub struct EncryptedUserProfile {
pub user_id: UserId,
pub public_key: Vec<u8>,
pub encrypted_data: Vec<u8>,
pub nonce: [u8; 12],
pub access_grants: Vec<AccessGrant>,
pub ipv6_binding_proof: Option<IPv6BindingProof>,
pub signature: Vec<u8>,
pub updated_at: SystemTime,
}
Expand description
Encrypted user profile stored in DHT
Fields§
§user_id: UserId
User identifier
public_key: Vec<u8>
Public key for verification (stored as bytes for serialization)
encrypted_data: Vec<u8>
Encrypted profile data
nonce: [u8; 12]
Encryption nonce
access_grants: Vec<AccessGrant>
Access grants for friends
ipv6_binding_proof: Option<IPv6BindingProof>
IPv6 identity binding proof
signature: Vec<u8>
Profile signature
updated_at: SystemTime
Last updated timestamp
Implementations§
Source§impl EncryptedUserProfile
impl EncryptedUserProfile
Sourcepub fn new(
identity: &UserIdentity,
profile: &UserProfile,
keypair: &Keypair,
ipv6_binding: Option<IPv6BindingProof>,
) -> Result<Self>
pub fn new( identity: &UserIdentity, profile: &UserProfile, keypair: &Keypair, ipv6_binding: Option<IPv6BindingProof>, ) -> Result<Self>
Create a new encrypted user profile
Sourcepub fn grant_access(
&mut self,
grantee_user_id: UserId,
grantee_public_key_bytes: &[u8],
permissions: ProfilePermissions,
profile_key: &[u8; 32],
granter_keypair: &Keypair,
) -> Result<()>
pub fn grant_access( &mut self, grantee_user_id: UserId, grantee_public_key_bytes: &[u8], permissions: ProfilePermissions, profile_key: &[u8; 32], granter_keypair: &Keypair, ) -> Result<()>
Grant access to another user
Sourcepub fn revoke_access(&mut self, user_id: &UserId)
pub fn revoke_access(&mut self, user_id: &UserId)
Revoke access from a user
Sourcepub fn decrypt_profile(&self, profile_key: &[u8; 32]) -> Result<UserProfile>
pub fn decrypt_profile(&self, profile_key: &[u8; 32]) -> Result<UserProfile>
Decrypt profile data with provided key
Sourcepub fn get_access_grant(&self, user_id: &UserId) -> Option<&AccessGrant>
pub fn get_access_grant(&self, user_id: &UserId) -> Option<&AccessGrant>
Get access grant for a specific user
Sourcepub fn is_grant_valid(grant: &AccessGrant) -> bool
pub fn is_grant_valid(grant: &AccessGrant) -> bool
Check if access grant is still valid
Sourcepub fn verify_signature(&self) -> Result<bool>
pub fn verify_signature(&self) -> Result<bool>
Verify the profile signature
Trait Implementations§
Source§impl Clone for EncryptedUserProfile
impl Clone for EncryptedUserProfile
Source§fn clone(&self) -> EncryptedUserProfile
fn clone(&self) -> EncryptedUserProfile
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EncryptedUserProfile
impl Debug for EncryptedUserProfile
Source§impl<'de> Deserialize<'de> for EncryptedUserProfile
impl<'de> Deserialize<'de> for EncryptedUserProfile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EncryptedUserProfile
impl RefUnwindSafe for EncryptedUserProfile
impl Send for EncryptedUserProfile
impl Sync for EncryptedUserProfile
impl Unpin for EncryptedUserProfile
impl UnwindSafe for EncryptedUserProfile
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