android-components / mozilla.components.service.sync.logins / AsyncLoginsStorageAdapter

AsyncLoginsStorageAdapter

open class AsyncLoginsStorageAdapter<T : LoginsStorage> : AsyncLoginsStorage, AutoCloseable (source)

A helper class to wrap a synchronous LoginsStorage implementation and make it asynchronous.

Constructors

<init>

AsyncLoginsStorageAdapter(wrapped: T)

A helper class to wrap a synchronous LoginsStorage implementation and make it asynchronous.

Functions

add

open fun add(login: ServerPassword): Deferred<String>

Inserts the provided login into the database, returning it's id.

close

open fun close(): Unit

delete

open fun delete(id: String): Deferred<Boolean>

Deletes the password with the given ID.

get

open fun get(id: String): Deferred<ServerPassword?>

Fetches a password from the underlying storage layer by ID.

isLocked

open fun isLocked(): Boolean

Returns true if the storage is locked, false otherwise.

list

open fun list(): Deferred<List<ServerPassword>>

Fetches the full list of passwords from the underlying storage layer.

lock

open fun lock(): Deferred<Unit>

Locks the logins storage.

reset

open fun reset(): Deferred<Unit>

Deletes all locally stored login sync metadata.

sync

open fun sync(syncInfo: SyncUnlockInfo): Deferred<Unit>

Synchronizes the logins storage layer with a remote layer.

touch

open fun touch(id: String): Deferred<Unit>

Marks the login with the given ID as in-use.

unlock

open fun unlock(encryptionKey: String): Deferred<Unit>

Unlocks the logins storage using the provided key.

update

open fun update(login: ServerPassword): Deferred<Unit>

Updates the fields in the provided record.

wipe

open fun wipe(): Deferred<Unit>

Deletes all locally stored login data. It is unlikely you need to use this.

Companion Object Functions

forDatabase

fun forDatabase(dbPath: String): AsyncLoginsStorageAdapter<DatabaseLoginsStorage>

Creates an AsyncLoginsStorage that is backed by a DatabaseLoginsStorage.

inMemory

fun inMemory(items: List<ServerPassword>): AsyncLoginsStorageAdapter<MemoryLoginsStorage>

Creates an AsyncLoginsStorage that is backed by a MemoryLoginsStorage.