SecretService

Struct SecretService 

Source
pub struct SecretService<'a> { /* private fields */ }
Expand description

Secret Service Struct.

This the main entry point for usage of the library.

Creating a new SecretService will also initialize dbus and negotiate a new cryptographic session (EncryptionType::Plain or EncryptionType::Dh)

Implementations§

Source§

impl<'a> SecretService<'a>

Source

pub fn connect(encryption: EncryptionType) -> Result<SecretService<'a>, Error>

Create a new SecretService instance.

This will initialize its own connection to the session bus.

Source

pub fn connect_with_existing( encryption: EncryptionType, session_conn: Connection, ) -> Result<SecretService<'a>, Error>

Creates a new SecretService instance, utilizing an existing connection handle.

session_conn should be connected to the session/user message bus.

Source

pub fn get_all_collections(&'a self) -> Result<Vec<Collection<'a>>, Error>

Get all collections

Source

pub fn get_collection_by_alias( &'a self, alias: &str, ) -> Result<Collection<'a>, Error>

Get collection by alias.

Most common would be the default alias, but there is also a specific method for getting the collection by default alias.

Source

pub fn get_default_collection(&'a self) -> Result<Collection<'a>, Error>

Get default collection. (The collection whose alias is default)

Source

pub fn get_any_collection(&'a self) -> Result<Collection<'a>, Error>

Get any collection. First tries default collection, then session collection, then the first collection when it gets all collections.

Source

pub fn create_collection( &'a self, label: &str, alias: &str, ) -> Result<Collection<'a>, Error>

Creates a new collection with a label and an alias.

Source

pub fn search_items( &'a self, attributes: HashMap<&str, &str>, ) -> Result<SearchItemsResult<Item<'a>>, Error>

Searches all items by attributes

Source

pub fn unlock_all(&'a self, items: &[&Item<'_>]) -> Result<(), Error>

Unlock all items in a batch

Source

pub fn get_item_by_path( &'a self, item_path: OwnedObjectPath, ) -> Result<Item<'a>, Error>

Source

pub fn get_collection_by_path( &'a self, collection_path: OwnedObjectPath, ) -> Result<Collection<'a>, Error>

Auto Trait Implementations§

§

impl<'a> Freeze for SecretService<'a>

§

impl<'a> !RefUnwindSafe for SecretService<'a>

§

impl<'a> Send for SecretService<'a>

§

impl<'a> Sync for SecretService<'a>

§

impl<'a> Unpin for SecretService<'a>

§

impl<'a> !UnwindSafe for SecretService<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more