mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
fix cli crypto service calls
This commit is contained in:
@@ -334,7 +334,7 @@ export class Main {
|
||||
);
|
||||
|
||||
const lockedCallback = async () =>
|
||||
await this.cryptoService.clearStoredKey(KeySuffixOptions.Auto);
|
||||
await this.cryptoService.clearStoredUserKey(KeySuffixOptions.Auto);
|
||||
|
||||
this.vaultTimeoutSettingsService = new VaultTimeoutSettingsService(
|
||||
this.cryptoService,
|
||||
|
||||
@@ -421,11 +421,14 @@ export class ServeCommand {
|
||||
this.processResponse(res, Response.error("You are not logged in."));
|
||||
return true;
|
||||
}
|
||||
if (await this.main.cryptoService.hasKeyInMemory()) {
|
||||
if (await this.main.cryptoService.hasUserKeyInMemory()) {
|
||||
return false;
|
||||
} else if (await this.main.cryptoService.hasKeyStored(KeySuffixOptions.Auto)) {
|
||||
} else if (await this.main.cryptoService.hasUserKeyStored(KeySuffixOptions.Auto)) {
|
||||
// load key into memory
|
||||
await this.main.cryptoService.getKey();
|
||||
const userAutoKey = await this.main.cryptoService.getUserKeyFromStorage(
|
||||
KeySuffixOptions.Auto
|
||||
);
|
||||
await this.main.cryptoService.setUserKey(userAutoKey);
|
||||
return false;
|
||||
}
|
||||
this.processResponse(res, Response.error("Vault is locked."));
|
||||
|
||||
@@ -597,11 +597,14 @@ export class Program {
|
||||
|
||||
protected async exitIfLocked() {
|
||||
await this.exitIfNotAuthed();
|
||||
if (await this.main.cryptoService.hasKeyInMemory()) {
|
||||
if (await this.main.cryptoService.hasUserKeyInMemory()) {
|
||||
return;
|
||||
} else if (await this.main.cryptoService.hasKeyStored(KeySuffixOptions.Auto)) {
|
||||
} else if (await this.main.cryptoService.hasUserKeyStored(KeySuffixOptions.Auto)) {
|
||||
// load key into memory
|
||||
await this.main.cryptoService.getKey();
|
||||
const userAutoKey = await this.main.cryptoService.getUserKeyFromStorage(
|
||||
KeySuffixOptions.Auto
|
||||
);
|
||||
await this.main.cryptoService.setUserKey(userAutoKey);
|
||||
} else if (process.env.BW_NOINTERACTION !== "true") {
|
||||
// must unlock
|
||||
if (await this.main.keyConnectorService.getUsesKeyConnector()) {
|
||||
|
||||
Reference in New Issue
Block a user