Skip to content

Commit c99e053

Browse files
committed
expose Logins keydb structs constructors
1 parent a4443d3 commit c99e053

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- add checkpoint API: `set_checkpoint(checkpoint)` and `get_checkpoint()` for desktop's rolling migration
1414
- add `delete_many(ids)` for batch deletion within a single transaction
1515
- Add `count()`, `count_by_origin()` and `count_by_form_action_origin()` methods
16+
- expose constructors for `ManagedEncryptorDecryptor` and `NSSKeyManager`
1617

1718
### Sync Manager
1819
- Added sync settings metrics for mobile. [#6786](https://github.com/mozilla/application-services/pull/6786)

components/logins/src/encryption.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub struct ManagedEncryptorDecryptor {
9494
}
9595

9696
impl ManagedEncryptorDecryptor {
97+
#[uniffi::constructor()]
9798
pub fn new(key_manager: Arc<dyn KeyManager>) -> Self {
9899
Self { key_manager }
99100
}
@@ -232,16 +233,22 @@ pub struct NSSKeyManager {
232233
}
233234

234235
#[cfg(feature = "keydb")]
236+
#[uniffi::export]
235237
impl NSSKeyManager {
236238
/// Initialize new `NSSKeyManager` with a given `PrimaryPasswordAuthenticator`.
237239
/// There must be a previous initializiation of NSS before initializing
238240
/// `NSSKeyManager`, otherwise this panics.
241+
#[uniffi::constructor()]
239242
pub fn new(primary_password_authenticator: Arc<dyn PrimaryPasswordAuthenticator>) -> Self {
240243
assert_nss_initialized();
241244
Self {
242245
primary_password_authenticator,
243246
}
244247
}
248+
249+
pub fn into_dyn_key_manager(self: Arc<Self>) -> Arc<dyn KeyManager> {
250+
self
251+
}
245252
}
246253

247254
/// Identifier for the logins key, under which the key is stored in NSS.

0 commit comments

Comments
 (0)