PasswordStore

Struct PasswordStore 

Source
pub struct PasswordStore;
Expand description

Pass process runner.

Implementations§

Source§

impl PasswordStore

Source

pub fn get(path: &str) -> Result<(String, String)>

Get the username and password a the specified path.

Examples found in repository?
examples/main.rs (line 28)
26fn main() {
27    PasswordStore::insert("pass", "password").unwrap();
28    let password = PasswordStore::get("pass");
29    println!("Password: {:?}", password);
30    let usernames = PasswordStore::get_usernames("pass").unwrap();
31    println!("Usernames: {:?}", usernames);
32    PasswordStore::remove("pass").unwrap();
33
34    PasswordStore::insert("test/pass", "password").unwrap();
35    let password = PasswordStore::get("test/pass");
36    println!("Password: {:?}", password);
37    let usernames = PasswordStore::get_usernames("test/pass").unwrap();
38    println!("Usernames: {:?}", usernames);
39    PasswordStore::remove("test/pass").unwrap();
40
41    PasswordStore::insert("test with spaces/pass with spaces", "password").unwrap();
42    let password = PasswordStore::get("test with spaces/pass with spaces");
43    println!("{:?}", password);
44    let usernames = PasswordStore::get_usernames("test with spaces").unwrap();
45    println!("{:?}", usernames);
46    PasswordStore::remove("test with spaces/pass with spaces").unwrap();
47
48    PasswordStore::generate("pass", true, 25).unwrap();
49    let password = PasswordStore::get("pass");
50    println!("Password: {:?}", password);
51    let usernames = PasswordStore::get_usernames("pass").unwrap();
52    println!("Usernames: {:?}", usernames);
53    PasswordStore::remove("pass").unwrap();
54}
Source

pub fn get_usernames(path: &str) -> Result<Vec<String>>

Get the list of usernames at the specified path.

Examples found in repository?
examples/main.rs (line 30)
26fn main() {
27    PasswordStore::insert("pass", "password").unwrap();
28    let password = PasswordStore::get("pass");
29    println!("Password: {:?}", password);
30    let usernames = PasswordStore::get_usernames("pass").unwrap();
31    println!("Usernames: {:?}", usernames);
32    PasswordStore::remove("pass").unwrap();
33
34    PasswordStore::insert("test/pass", "password").unwrap();
35    let password = PasswordStore::get("test/pass");
36    println!("Password: {:?}", password);
37    let usernames = PasswordStore::get_usernames("test/pass").unwrap();
38    println!("Usernames: {:?}", usernames);
39    PasswordStore::remove("test/pass").unwrap();
40
41    PasswordStore::insert("test with spaces/pass with spaces", "password").unwrap();
42    let password = PasswordStore::get("test with spaces/pass with spaces");
43    println!("{:?}", password);
44    let usernames = PasswordStore::get_usernames("test with spaces").unwrap();
45    println!("{:?}", usernames);
46    PasswordStore::remove("test with spaces/pass with spaces").unwrap();
47
48    PasswordStore::generate("pass", true, 25).unwrap();
49    let password = PasswordStore::get("pass");
50    println!("Password: {:?}", password);
51    let usernames = PasswordStore::get_usernames("pass").unwrap();
52    println!("Usernames: {:?}", usernames);
53    PasswordStore::remove("pass").unwrap();
54}
Source

pub fn generate(path: &str, use_symbols: bool, length: i32) -> Result<()>

Generate a password in the store.

Examples found in repository?
examples/main.rs (line 48)
26fn main() {
27    PasswordStore::insert("pass", "password").unwrap();
28    let password = PasswordStore::get("pass");
29    println!("Password: {:?}", password);
30    let usernames = PasswordStore::get_usernames("pass").unwrap();
31    println!("Usernames: {:?}", usernames);
32    PasswordStore::remove("pass").unwrap();
33
34    PasswordStore::insert("test/pass", "password").unwrap();
35    let password = PasswordStore::get("test/pass");
36    println!("Password: {:?}", password);
37    let usernames = PasswordStore::get_usernames("test/pass").unwrap();
38    println!("Usernames: {:?}", usernames);
39    PasswordStore::remove("test/pass").unwrap();
40
41    PasswordStore::insert("test with spaces/pass with spaces", "password").unwrap();
42    let password = PasswordStore::get("test with spaces/pass with spaces");
43    println!("{:?}", password);
44    let usernames = PasswordStore::get_usernames("test with spaces").unwrap();
45    println!("{:?}", usernames);
46    PasswordStore::remove("test with spaces/pass with spaces").unwrap();
47
48    PasswordStore::generate("pass", true, 25).unwrap();
49    let password = PasswordStore::get("pass");
50    println!("Password: {:?}", password);
51    let usernames = PasswordStore::get_usernames("pass").unwrap();
52    println!("Usernames: {:?}", usernames);
53    PasswordStore::remove("pass").unwrap();
54}
Source

pub fn insert(path: &str, password: &str) -> Result<()>

Insert a password in the store.

Examples found in repository?
examples/main.rs (line 27)
26fn main() {
27    PasswordStore::insert("pass", "password").unwrap();
28    let password = PasswordStore::get("pass");
29    println!("Password: {:?}", password);
30    let usernames = PasswordStore::get_usernames("pass").unwrap();
31    println!("Usernames: {:?}", usernames);
32    PasswordStore::remove("pass").unwrap();
33
34    PasswordStore::insert("test/pass", "password").unwrap();
35    let password = PasswordStore::get("test/pass");
36    println!("Password: {:?}", password);
37    let usernames = PasswordStore::get_usernames("test/pass").unwrap();
38    println!("Usernames: {:?}", usernames);
39    PasswordStore::remove("test/pass").unwrap();
40
41    PasswordStore::insert("test with spaces/pass with spaces", "password").unwrap();
42    let password = PasswordStore::get("test with spaces/pass with spaces");
43    println!("{:?}", password);
44    let usernames = PasswordStore::get_usernames("test with spaces").unwrap();
45    println!("{:?}", usernames);
46    PasswordStore::remove("test with spaces/pass with spaces").unwrap();
47
48    PasswordStore::generate("pass", true, 25).unwrap();
49    let password = PasswordStore::get("pass");
50    println!("Password: {:?}", password);
51    let usernames = PasswordStore::get_usernames("pass").unwrap();
52    println!("Usernames: {:?}", usernames);
53    PasswordStore::remove("pass").unwrap();
54}
Source

pub fn remove(path: &str) -> Result<()>

Remove a password from the store.

Examples found in repository?
examples/main.rs (line 32)
26fn main() {
27    PasswordStore::insert("pass", "password").unwrap();
28    let password = PasswordStore::get("pass");
29    println!("Password: {:?}", password);
30    let usernames = PasswordStore::get_usernames("pass").unwrap();
31    println!("Usernames: {:?}", usernames);
32    PasswordStore::remove("pass").unwrap();
33
34    PasswordStore::insert("test/pass", "password").unwrap();
35    let password = PasswordStore::get("test/pass");
36    println!("Password: {:?}", password);
37    let usernames = PasswordStore::get_usernames("test/pass").unwrap();
38    println!("Usernames: {:?}", usernames);
39    PasswordStore::remove("test/pass").unwrap();
40
41    PasswordStore::insert("test with spaces/pass with spaces", "password").unwrap();
42    let password = PasswordStore::get("test with spaces/pass with spaces");
43    println!("{:?}", password);
44    let usernames = PasswordStore::get_usernames("test with spaces").unwrap();
45    println!("{:?}", usernames);
46    PasswordStore::remove("test with spaces/pass with spaces").unwrap();
47
48    PasswordStore::generate("pass", true, 25).unwrap();
49    let password = PasswordStore::get("pass");
50    println!("Password: {:?}", password);
51    let usernames = PasswordStore::get_usernames("pass").unwrap();
52    println!("Usernames: {:?}", usernames);
53    PasswordStore::remove("pass").unwrap();
54}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.