pub struct UserIdentity {
pub user_id: UserId,
pub public_key: Vec<u8>,
pub display_name_hint: String,
pub three_word_address: String,
pub created_at: SystemTime,
pub version: u64,
pub verification_level: VerificationLevel,
}
Expand description
Core user identity structure
Fields§
§user_id: UserId
Unique user identifier (SHA256 of public key)
public_key: Vec<u8>
ED25519 public key for verification (stored as bytes for serialization)
display_name_hint: String
Human-readable display name (encrypted in profile)
three_word_address: String
Three-word address for easy sharing
created_at: SystemTime
Identity creation timestamp
version: u64
Identity version for updates
verification_level: VerificationLevel
Verification level
Implementations§
Source§impl UserIdentity
impl UserIdentity
Sourcepub fn new(
display_name: String,
three_word_address: String,
) -> Result<(Self, Keypair)>
pub fn new( display_name: String, three_word_address: String, ) -> Result<(Self, Keypair)>
Create a new user identity
Sourcepub fn derive_user_id(public_key: &PublicKey) -> UserId
pub fn derive_user_id(public_key: &PublicKey) -> UserId
Derive user ID from public key
Sourcepub fn derive_user_id_from_bytes(public_key_bytes: &[u8]) -> UserId
pub fn derive_user_id_from_bytes(public_key_bytes: &[u8]) -> UserId
Derive user ID from public key bytes
Sourcepub fn verify_signature(
&self,
message: &[u8],
signature: &Signature,
) -> Result<bool>
pub fn verify_signature( &self, message: &[u8], signature: &Signature, ) -> Result<bool>
Verify a signature against this identity
Sourcepub fn get_profile_dht_key(&self) -> Key
pub fn get_profile_dht_key(&self) -> Key
Get DHT key for storing this user’s profile
Sourcepub fn get_name_resolution_dht_key(display_name: &str) -> Key
pub fn get_name_resolution_dht_key(display_name: &str) -> Key
Get DHT key for name resolution
Trait Implementations§
Source§impl Clone for UserIdentity
impl Clone for UserIdentity
Source§fn clone(&self) -> UserIdentity
fn clone(&self) -> UserIdentity
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 UserIdentity
impl Debug for UserIdentity
Source§impl<'de> Deserialize<'de> for UserIdentity
impl<'de> Deserialize<'de> for UserIdentity
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 UserIdentity
impl RefUnwindSafe for UserIdentity
impl Send for UserIdentity
impl Sync for UserIdentity
impl Unpin for UserIdentity
impl UnwindSafe for UserIdentity
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