Skip to content

Commit 6b42106

Browse files
committed
Bug 1995662 - guard create_login_store_with_nss_keymanager
1 parent 3e6ca41 commit 6b42106

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
- When the keydb feature is enabled, `ensure_nss_initialized` is disabled in
1414
favor of `ensure_nss_initialized_with_profile_dir`.
1515

16+
### Logins
17+
- `create_login_store_with_nss_keymanager` returns an `ApiResult` now, instead
18+
of just panicking.
19+
1620
# v146.0 (_2025-11-10_)
1721

1822
## ✨ What's New ✨

components/logins/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ pub fn create_managed_encdec(key_manager: Arc<dyn KeyManager>) -> Arc<ManagedEnc
5353
pub fn create_login_store_with_static_key_manager(path: String, key: String) -> Arc<LoginStore> {
5454
let encdec: ManagedEncryptorDecryptor =
5555
ManagedEncryptorDecryptor::new(Arc::new(StaticKeyManager::new(key)));
56-
Arc::new(LoginStore::new(path, Arc::new(encdec)).unwrap())
56+
let store = LoginStore::new(path, Arc::new(encdec)).expect("error setting up LoginStore");
57+
Arc::new(store)
5758
}
5859

5960
// Create a LoginStore with NSSKeyManager by passing in a db path and a PrimaryPasswordAuthenticator.
@@ -65,9 +66,10 @@ pub fn create_login_store_with_static_key_manager(path: String, key: String) ->
6566
pub fn create_login_store_with_nss_keymanager(
6667
path: String,
6768
primary_password_authenticator: Arc<dyn PrimaryPasswordAuthenticator>,
68-
) -> Arc<LoginStore> {
69+
) -> ApiResult<Arc<LoginStore>> {
6970
let encdec: ManagedEncryptorDecryptor = ManagedEncryptorDecryptor::new(Arc::new(
7071
NSSKeyManager::new(primary_password_authenticator),
7172
));
72-
Arc::new(LoginStore::new(path, Arc::new(encdec)).unwrap())
73+
let store = LoginStore::new(path, Arc::new(encdec))?;
74+
Ok(Arc::new(store))
7375
}

0 commit comments

Comments
 (0)