Struct PassStore

Source
pub struct PassStore { /* private fields */ }
Expand description

Represents the underlying directory structure of a password store. The folder structure is inherit from pass(1).

Implementations§

Source§

impl PassStore

Represents the underlying directory structure of a password store. The folder structure is inherit from pass(1).

On construction of the store, base directory is be walked. All found gpg-files will be treated as store entries, which are represented by PassEntry.

Source

pub fn new() -> Result<PassStore>

Constructs a new PassStore with the default store location.

Source

pub fn from(path: &PathBuf) -> Result<PassStore>

Constructs a new PassStore using the provided location.

§Examples
use std::path::PathBuf;
use rasslib::store::PassStore;

let p = PathBuf::from("/home/bar/.store");

let store = PassStore::from(&p);
Source

pub fn set_verbose(&mut self, verbose: bool)

Set the verbose printouts for the store.

Source

pub fn absolute_path(&self, entry: &str) -> PathBuf

Returns the absolute_path of a given PassEntry.

Source

pub fn get_location(&self) -> String

Returns the location of the PassStore as String.

Source

pub fn find<S>(&self, query: S) -> Vec<PassTreePath>
where S: Into<String>,

Find and returns a Vector of PassEntrys by its name.

Source

pub fn get<S>(&self, pass: S) -> Option<PassTreePath>
where S: Into<String>,

Get a PassTreePath from the give parameter pass. Returns an

Source

pub fn read(&self, entry: &PassTreePath) -> Option<String>

Reads and returns the content of the given PassEntry. The for the gpg-file related to the PassEntry encrypt.

Source

pub fn insert<VCS, D>(&mut self, vcs: VCS, entry: &str, data: D) -> Result<()>
where D: Into<Vec<u8>>, VCS: VersionControl,

Inserts a new entry into the store. This creates a new encrypted gpg-file and add it to version control system, provided via vcs.

Source

pub fn remove<VCS>(&mut self, vcs: VCS, entry: &PassTreePath) -> Result<()>
where VCS: VersionControl,

Removes a given PassEntry from the store. Therefore the related gpg-file will be removed from the file-system and the internal entry list. Further the vcs will use to commit that change.

Note that the entry passed into the function shall be a copy of the original reference.

Source

pub fn entries<'a>(&'a self) -> &'a PassTree

Gets all entries from the store as a Tree structure.

Source

pub fn print_tree(&self, path: &PassTreePath)

Prints a give path as a tree. Note, if the path does not point to any entry in the store, nothing will be printed!

Source

pub fn grep(&self, searcher: &str, grep_args: &Vec<&str>) -> Result<String>

Executes over all entries in the store with the given search parameters. Take note that grep_args can include all grep parameters which are relevant for a piped grep execution. However, the last parameter shall always be the grep command.

Trait Implementations§

Source§

impl Debug for PassStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
Source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

Source§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
Source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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, Dst> ConvAsUtil<Dst> for T

Source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
Source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
Source§

impl<T> ConvUtil for T

Source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
Source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
Source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
Source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
Source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
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<Src> TryFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
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<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

Source§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
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.
Source§

impl<Src> ValueFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
Source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

Source§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.