Skip to content

Commit 90f0de0

Browse files
committed
util: fix credentialStore overwriting persisted data
1 parent d1d6c6a commit 90f0de0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/util/credentialStore.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ export default class LncCredentialStore implements CredentialStore {
4343
*/
4444
constructor(namespace?: string, password?: string) {
4545
if (namespace) this.namespace = namespace;
46-
if (password) this.password = password;
4746

4847
// load data stored in localStorage
4948
this._load();
49+
50+
// set the password after loading the data, otherwise the data will be
51+
// overwritten because the password setter checks for the existence of
52+
// persisted data.
53+
if (password) this.password = password;
5054
}
5155

5256
//

0 commit comments

Comments
 (0)