Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class KeyringController extends EventEmitter {
async createNewVaultAndKeychain(password) {
await this.createFirstKeyTree(password);
await this.persistAllKeyrings(password);
this.setUnlocked.bind();
this.setUnlocked();
this.fullUpdate();
}

Expand Down
11 changes: 10 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('KeyringController', function () {
});

describe('createNewVaultAndKeychain', function () {
it('should set a vault on the configManager', async function () {
it('should create a new vault', async function () {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unrelated; I just happened to notice a reference to a now-extinct "configManager" abstraction in another test. This was the last remaining reference to it.

keyringController.store.updateState({ vault: null });
assert(!keyringController.store.getState().vault, 'no previous vault');

Expand All @@ -95,6 +95,15 @@ describe('KeyringController', function () {
expect(vault).toBeTruthy();
});

it('should unlock the vault', async function () {
keyringController.store.updateState({ vault: null });
assert(!keyringController.store.getState().vault, 'no previous vault');

await keyringController.createNewVaultAndKeychain(password);
const { isUnlocked } = keyringController.memStore.getState();
expect(isUnlocked).toBe(true);
});

it('should encrypt keyrings with the correct password each time they are persisted', async function () {
keyringController.store.updateState({ vault: null });
assert(!keyringController.store.getState().vault, 'no previous vault');
Expand Down