mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
set user key once we detect session key (#9084)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as chalk from "chalk";
|
||||
import { program, Command, OptionValues } from "commander";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||
|
||||
@@ -63,8 +64,16 @@ export class Program {
|
||||
process.env.BW_NOINTERACTION = "true";
|
||||
});
|
||||
|
||||
program.on("option:session", (key) => {
|
||||
program.on("option:session", async (key) => {
|
||||
process.env.BW_SESSION = key;
|
||||
|
||||
// once we have the session key, we can set the user key in memory
|
||||
const activeAccount = await firstValueFrom(this.main.accountService.activeAccount$);
|
||||
if (activeAccount) {
|
||||
await this.main.userAutoUnlockKeyService.setUserKeyInMemoryIfAutoUserKeySet(
|
||||
activeAccount.id,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
program.on("command:*", () => {
|
||||
|
||||
Reference in New Issue
Block a user