LoginStore

Struct LoginStore 

Source
pub struct LoginStore {
    pub db: Mutex<Option<LoginDb>>,
}

Fields§

§db: Mutex<Option<LoginDb>>

Implementations§

Source§

impl LoginStore

Source

pub fn new( path: impl AsRef<Path>, encdec: Arc<dyn EncryptorDecryptor>, ) -> ApiResult<Self>

Source

pub fn new_from_db(db: LoginDb) -> Self

Source

pub fn lock_db(&self) -> Result<MappedMutexGuard<'_, LoginDb>>

Source

pub fn is_empty(&self) -> ApiResult<bool>

Source

pub fn list(&self) -> ApiResult<Vec<Login>>

Source

pub fn list_candidates(&self) -> ApiResult<Vec<LoginCandidate>>

List all logins without decrypting them.

Unlike list() this never touches the encryption key, so consumers which only need the cleartext fields to decide which logins they care about can filter without forcing the user to authenticate. Feed the ids of the matches to get_many().

Source

pub fn count(&self) -> ApiResult<i64>

Source

pub fn count_by_origin(&self, origin: &str) -> ApiResult<i64>

Source

pub fn count_by_form_action_origin( &self, form_action_origin: &str, ) -> ApiResult<i64>

Source

pub fn get(&self, id: &str) -> ApiResult<Option<Login>>

Source

pub fn get_many(&self, ids: Vec<String>) -> ApiResult<Vec<Login>>

Get the logins with the given ids, decrypting them.

This is the other half of list_candidates(): having filtered on the cleartext fields, only pay for decrypting the logins which actually matched. Ids we don’t have a login for are skipped; a login we can’t decrypt fails the call, as it does for list().

Source

pub fn get_by_base_domain(&self, base_domain: &str) -> ApiResult<Vec<Login>>

Source

pub fn has_logins_by_base_domain(&self, base_domain: &str) -> ApiResult<bool>

Source

pub fn find_login_to_update( &self, entry: LoginEntry, ) -> ApiResult<Option<Login>>

Source

pub fn touch(&self, id: &str) -> ApiResult<()>

Source

pub fn are_potentially_vulnerable_passwords( &self, ids: Vec<String>, ) -> ApiResult<Vec<String>>

Source

pub fn is_potentially_vulnerable_password(&self, id: &str) -> ApiResult<bool>

Source

pub fn record_potentially_vulnerable_passwords( &self, passwords: Vec<String>, ) -> ApiResult<()>

Source

pub fn reset_all_breaches(&self) -> ApiResult<()>

Source

pub fn record_breach_alert_dismissal(&self, id: &str) -> ApiResult<()>

Source

pub fn record_breach_alert_dismissal_time( &self, id: &str, timestamp: i64, ) -> ApiResult<()>

Source

pub fn delete(&self, id: &str) -> ApiResult<bool>

Source

pub fn delete_many(&self, ids: Vec<String>) -> ApiResult<Vec<bool>>

Source

pub fn delete_all(&self) -> ApiResult<Vec<String>>

Source

pub fn delete_all_except_fxa(&self) -> ApiResult<Vec<String>>

Source

pub fn delete_undecryptable_records_for_remote_replacement( self: Arc<Self>, ) -> ApiResult<LoginsDeletionMetrics>

Source

pub fn wipe_local(&self) -> ApiResult<()>

Source

pub fn wipe_local_except_fxa(&self) -> ApiResult<()>

Source

pub fn reset(self: Arc<Self>) -> ApiResult<()>

Source

pub fn update(&self, id: &str, entry: LoginEntry) -> ApiResult<Login>

Source

pub fn add(&self, entry: LoginEntry) -> ApiResult<Login>

Source

pub fn add_many( &self, entries: Vec<LoginEntry>, ) -> ApiResult<Vec<BulkResultEntry>>

Source

pub fn add_with_meta( &self, entry_with_meta: LoginEntryWithMeta, ) -> ApiResult<Login>

This method is intended to preserve metadata (LoginMeta) during a migration. In normal operation, this method should not be used; instead, use add(entry), which manages the corresponding fields itself.

Source

pub fn add_many_with_meta( &self, entries_with_meta: Vec<LoginEntryWithMeta>, ) -> ApiResult<Vec<BulkResultEntry>>

Source

pub fn add_or_update(&self, entry: LoginEntry) -> ApiResult<Login>

Source

pub fn run_maintenance( &self, options: Option<RunMaintenanceOptions>, ) -> ApiResult<()>

Source

pub fn shutdown(&self)

Source

pub fn register_with_sync_manager(self: Arc<Self>)

Source

pub fn create_logins_sync_engine( self: Arc<Self>, ) -> ApiResult<Box<dyn SyncEngine>>

Source§

impl LoginStore

Source

pub fn bridged_engine(self: Arc<Self>) -> Result<Arc<LoginsBridgedEngine>>

Returns a bridged sync engine for Desktop for this store.

Unlike Tabs, constructing a LoginsSyncEngine locks the DB and can fail, so this is fallible (and exposed as [Throws] in the UDL). The internal error is surfaced via anyhow, which UniFFI maps onto LoginsApiError through From<anyhow::Error>.

Trait Implementations§

Source§

impl<UT> LiftRef<UT> for LoginStore

Source§

impl<UT> LowerError<UT> for LoginStore

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for LoginStore

Source§

type ReturnType = <Arc<LoginStore> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for LoginStore

Source§

const TYPE_ID_META: MetadataBuffer

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.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

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
§

impl<T> ErasedDestructor for T
where T: 'static,