RustLogins.sys.mjs

class RustLogins.sys.AuthenticationCanceled()

authentication has been cancelled.

class RustLogins.sys.AuthenticationError()

error during authentication (in PrimaryPasswordAuthenticator)

class RustLogins.sys.BulkResultEntry()

A bulk insert result entry, returned by add_many and add_many_with_meta

RustLogins.sys.BulkResultEntry.Error
RustLogins.sys.BulkResultEntry.Success
class RustLogins.sys.DecryptionFailed()

decryption failed

class RustLogins.sys.EncryptionFailed()

encryption failed

class RustLogins.sys.Interrupted()

An operation was interrupted at the request of the consuming app.

class RustLogins.sys.InvalidKey()

Encryption key is not valid.

class RustLogins.sys.InvalidRecord()

The login data supplied is invalid. The reason will indicate what’s wrong with it.

class RustLogins.sys.Login()

A login stored in the database

RustLogins.sys.Login.formActionOrigin

type: string

RustLogins.sys.Login.httpRealm

type: string

RustLogins.sys.Login.id

type: string

RustLogins.sys.Login.origin

type: string

RustLogins.sys.Login.password

type: string

RustLogins.sys.Login.passwordField

type: string

RustLogins.sys.Login.timeCreated

type: number

RustLogins.sys.Login.timeLastBreachAlertDismissed

type: number

RustLogins.sys.Login.timeLastUsed

type: number

RustLogins.sys.Login.timeOfLastBreach

type: number

RustLogins.sys.Login.timePasswordChanged

type: number

RustLogins.sys.Login.timesUsed

type: number

RustLogins.sys.Login.username

type: string

RustLogins.sys.Login.usernameField

type: string

class RustLogins.sys.LoginEntry()

A login entry from the user, not linked to any database record. The add/update APIs input these.

RustLogins.sys.LoginEntry.formActionOrigin

type: string

RustLogins.sys.LoginEntry.httpRealm

type: string

RustLogins.sys.LoginEntry.origin

type: string

RustLogins.sys.LoginEntry.password

type: string

RustLogins.sys.LoginEntry.passwordField

type: string

RustLogins.sys.LoginEntry.username

type: string

RustLogins.sys.LoginEntry.usernameField

type: string

class RustLogins.sys.LoginEntryWithMeta()

A login together with record fields, handed over to the store API; ie a login persisted elsewhere, useful for migrations

RustLogins.sys.LoginEntryWithMeta.entry

type: LoginEntry

RustLogins.sys.LoginEntryWithMeta.meta

type: LoginMeta

class RustLogins.sys.LoginMeta()

Metadata fields managed internally by the library. These are automatically set on add() and updated on operations like touch() and update(). Not included in LoginEntry; use add_with_meta() when importing records with existing metadata.

RustLogins.sys.LoginMeta.id

type: string

RustLogins.sys.LoginMeta.timeCreated

type: number

RustLogins.sys.LoginMeta.timeLastBreachAlertDismissed

type: number

RustLogins.sys.LoginMeta.timeLastUsed

type: number

RustLogins.sys.LoginMeta.timeOfLastBreach

type: number

RustLogins.sys.LoginMeta.timePasswordChanged

type: number

RustLogins.sys.LoginMeta.timesUsed

type: number

class RustLogins.sys.LoginsApiError()

These are the errors returned by our public API.

class RustLogins.sys.LoginsDeletionMetrics()

Metrics tracking deletion of logins that cannot be decrypted, see delete_undecryptable_records_for_remote_replacement for more details

RustLogins.sys.LoginsDeletionMetrics.localDeleted

type: number

RustLogins.sys.LoginsDeletionMetrics.mirrorDeleted

type: number

class RustLogins.sys.MissingKey()

Encryption key is missing.

class RustLogins.sys.NoSuchRecord()

Asking to do something with a guid which doesn’t exist.

class RustLogins.sys.NssAuthenticationError()

NSS error during authentication

class RustLogins.sys.NssKeyManager()

Use the NSSKeyManager to use NSS for key management.

NSS stores keys in key4.db within the profile and wraps the key with a key derived from the primary password, if set. It defers to the provided PrimaryPasswordAuthenticator implementation to handle user authentication. Note that if no primary password is set, the wrapping key is deterministically derived from an empty string.

Make sure to initialize NSS using ensure_initialized_with_profile_dir before creating a NSSKeyManager.

# Examples ```no_run use async_trait::async_trait; use logins::encryption::KeyManager; use logins::{PrimaryPasswordAuthenticator, LoginsApiError, NSSKeyManager}; use std::sync::Arc;

struct MyPrimaryPasswordAuthenticator {}

#[async_trait] impl PrimaryPasswordAuthenticator for MyPrimaryPasswordAuthenticator { async fn get_primary_password(&self) -> Result<String, LoginsApiError> { // Most likely, you would want to prompt for a password. // let password = prompt_string(“primary password”).unwrap_or_default(); Ok(“secret”.to_string()) }

async fn on_authentication_success(&self) -> Result<(), LoginsApiError> { println!(“success”); Ok(()) }

async fn on_authentication_failure(&self) -> Result<(), LoginsApiError> { println!(“this did not work, please try again:”); Ok(()) } } let key_manager = NSSKeyManager::new(Arc::new(MyPrimaryPasswordAuthenticator {})); assert_eq!(key_manager.get_key().unwrap().len(), 63); ```

RustLogins.sys.NssKeyManager.intoDynKeyManager()

intoDynKeyManager

Returns:

KeyManager

static RustLogins.sys.NssKeyManager.init(primaryPasswordAuthenticator)

Initialize new NSSKeyManager with a given PrimaryPasswordAuthenticator. There must be a previous initializiation of NSS before initializing NSSKeyManager, otherwise this panics.

Arguments:
  • primaryPasswordAuthenticator (PrimaryPasswordAuthenticator)

Returns:

NssKeyManager

class RustLogins.sys.NssUninitialized()

NSS not initialized.

class RustLogins.sys.PrimaryPasswordAuthenticator()

PrimaryPasswordAuthenticator is used in conjunction with NSSKeyManager to provide the primary password and the success or failure actions of the authentication process.

RustLogins.sys.PrimaryPasswordAuthenticator.getPrimaryPassword()

Get a primary password for authentication, otherwise return the AuthenticationCancelled error to cancel the authentication process.

Returns:

Promise.<string> – }

RustLogins.sys.PrimaryPasswordAuthenticator.onAuthenticationFailure()

onAuthenticationFailure

RustLogins.sys.PrimaryPasswordAuthenticator.onAuthenticationSuccess()

onAuthenticationSuccess

class RustLogins.sys.SyncAuthInvalid()

Sync reported that authentication failed and the user should re-enter their FxA password.

class RustLogins.sys.UnexpectedLoginsApiError()

something internal went wrong which doesn’t have a public error value because the consuming app can not reasonably take any action to resolve it. The underlying error will have been logged and reported. (ideally would just be Unexpected, but that would be a breaking change)

RustLogins.sys.checkCanary(canary, text, encryptionKey)

Check that key is still valid using the output of create_canary.

Arguments:
  • canary (string)

  • text (string)

  • encryptionKey (string)

Returns:

boolean

RustLogins.sys.createCanary(text, encryptionKey)

Create a “canary” string, which can be used to test if the encryption

Arguments:
  • text (string)

  • encryptionKey (string)

Returns:

string

RustLogins.sys.createKey()

We expose the crypto primitives on the namespace Create a new, random, encryption key.

Returns:

string

RustLogins.sys.createLoginStoreWithNssKeymanager(path, primaryPasswordAuthenticator)

createLoginStoreWithNssKeymanager

Arguments:
  • path (string)

  • primaryPasswordAuthenticator (PrimaryPasswordAuthenticator)

Returns:

LoginStore

RustLogins.sys.createLoginStoreWithStaticKeyManager(path, key)

Create a LoginStore with StaticKeyManager by passing in a db path and a static key

Arguments:
  • path (string)

  • key (string)

Returns:

LoginStore

RustLogins.sys.createManagedEncdec(keyManager)

Similar to create_static_key_manager above, create a ManagedEncryptorDecryptor by passing in a KeyManager

Arguments:
  • keyManager (KeyManager)

Returns:

EncryptorDecryptor

RustLogins.sys.createStaticKeyManager(key)

Utility function to create a StaticKeyManager to be used for the time being until support lands for [trait implementation of an UniFFI interface](https://mozilla.github.io/uniffi-rs/next/proc_macro/index.html#structs-implementing-traits) in UniFFI.

Arguments:
  • key (string)

Returns:

KeyManager