pub struct Me {
pub username: String,
pub file_path: PathBuf,
pub data: Option<String>,
}Expand description
Represents a local encrypted identity used in dApps or Web3 environments.
Fields§
§username: String§file_path: PathBuf§data: Option<String>Implementations§
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) -> Result<Self>
pub fn new(username: &str) -> Result<Self>
Initializes a new Me instance with the given username.
Sourcepub fn create(username: &str, hash: &str) -> Result<Self>
pub fn create(username: &str, hash: &str) -> Result<Self>
Creates and saves a new encrypted identity file.
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.
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