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
formActionOrigin
- RustLogins.sys.Login.httpRealm
httpRealm
- RustLogins.sys.Login.id
id
- RustLogins.sys.Login.origin
origin
- RustLogins.sys.Login.password
password
- RustLogins.sys.Login.passwordField
passwordField
- RustLogins.sys.Login.timeCreated
timeCreated
- RustLogins.sys.Login.timeLastUsed
timeLastUsed
- RustLogins.sys.Login.timePasswordChanged
timePasswordChanged
- RustLogins.sys.Login.timesUsed
timesUsed
- RustLogins.sys.Login.username
username
- RustLogins.sys.Login.usernameField
usernameField
- 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
formActionOrigin
- RustLogins.sys.LoginEntry.httpRealm
httpRealm
- RustLogins.sys.LoginEntry.origin
origin
- RustLogins.sys.LoginEntry.password
password
- RustLogins.sys.LoginEntry.passwordField
passwordField
- RustLogins.sys.LoginEntry.username
username
- RustLogins.sys.LoginEntry.usernameField
usernameField
- 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
entry
- RustLogins.sys.LoginEntryWithMeta.meta
meta
- class RustLogins.sys.LoginMeta()
Login data specific to database records. The add_with_record API inputs this.
- RustLogins.sys.LoginMeta.id
id
- RustLogins.sys.LoginMeta.timeCreated
timeCreated
- RustLogins.sys.LoginMeta.timeLastUsed
timeLastUsed
- RustLogins.sys.LoginMeta.timePasswordChanged
timePasswordChanged
- RustLogins.sys.LoginMeta.timesUsed
timesUsed
- 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
localDeleted
- RustLogins.sys.LoginsDeletionMetrics.mirrorDeleted
mirrorDeleted
- 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 –