pub struct Me {
pub username: String,
pub file_path: PathBuf,
pub data: Option<String>,
pub verbs: Verbs,
}Expand description
Represents a local encrypted identity used in dApps or Web3 environments.
Fields§
§username: String§file_path: PathBuf§data: Option<String>§verbs: VerbsImplementations§
Source§impl Me
impl Me
Sourcepub fn from_username_unchecked(username: &str) -> Self
pub fn from_username_unchecked(username: &str) -> Self
Initializes a Me instance without validating the username.
pub fn delete(username: &str, hash: &str) -> Result<()>
Sourcepub fn new(username: &str, hash: &str) -> Result<Self>
pub fn new(username: &str, hash: &str) -> Result<Self>
Initializes a new Me instance with the given username and hash.
Sourcepub fn encrypt(&self, plaintext: &str, hash: &str) -> Result<Vec<u8>>
pub fn encrypt(&self, plaintext: &str, hash: &str) -> Result<Vec<u8>>
Encrypts the provided plaintext with the given hash.
Sourcepub fn decrypt(&self, data: &[u8], hash: &str) -> Result<String, ()>
pub fn decrypt(&self, data: &[u8], hash: &str) -> Result<String, ()>
Decrypts the provided encrypted data using the given hash.
Sourcepub fn display(username: &str, hash: &str) -> Result<String>
pub fn display(username: &str, hash: &str) -> Result<String>
Displays the decrypted contents of the identity file.
Sourcepub fn change_hash(&self, old_hash: &str, new_hash: &str) -> Result<()>
pub fn change_hash(&self, old_hash: &str, new_hash: &str) -> Result<()>
Changes the encryption password (hash) of the identity file.
Sourcepub fn save(&self, hash: &str) -> Result<()>
pub fn save(&self, hash: &str) -> Result<()>
Saves the current identity by encrypting and writing to file.
pub fn have(&mut self, key: &str, value: &str) -> Result<()>
pub fn be(&mut self, key: &str, value: &str) -> Result<()>
pub fn at(&mut self, key: &str, value: &str) -> Result<()>
pub fn relate(&mut self, key: &str, value: &str) -> Result<()>
pub fn react(&mut self, key: &str, value: &str) -> Result<()>
pub fn say(&mut self, key: &str, value: &str) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Me
impl RefUnwindSafe for Me
impl Send for Me
impl Sync for Me
impl Unpin for Me
impl UnwindSafe for Me
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