1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-19 17:53:48 +00:00

Merge commit '8b2dfc6cdcb8ff5b604364c2ea6d343473aee7cd' into feature/workspaces

# Conflicts:
#	common/spec/importers/fsecureFskImporter.spec.ts
#	common/spec/services/cipher.service.spec.ts
#	package-lock.json
#	package.json
This commit is contained in:
Hinton
2022-01-03 12:46:02 +01:00
108 changed files with 11516 additions and 8636 deletions

1182
node/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,10 +25,12 @@
"@types/inquirer": "^7.3.1",
"@types/jasmine": "^3.10.2",
"@types/lowdb": "^1.0.10",
"@types/node": "^14.17.1",
"@types/node": "^16.11.12",
"@types/node-fetch": "^2.5.10",
"jasmine": "^3.10.0",
"jasmine-core": "^3.10.1",
"jasmine-ts-console-reporter": "^3.1.1",
"jsdom": "^19.0.0",
"rimraf": "^3.0.2",
"ttypescript": "^1.5.13",
"typescript": "4.3.5",

View File

@@ -1,15 +1,15 @@
import * as chalk from 'chalk';
import { StateService } from 'jslib-common/abstractions/state.service';
import { Response } from './models/response';
import { ListResponse } from './models/response/listResponse';
import { MessageResponse } from './models/response/messageResponse';
import { StringResponse } from './models/response/stringResponse';
import { UserService } from 'jslib-common/abstractions/user.service';
export abstract class BaseProgram {
constructor(
private userService: UserService,
private stateService: StateService,
private writeLn: (s: string, finalLine: boolean, error: boolean) => void) { }
protected processResponse(response: Response, exitImmediately = false, dataProcessor: () => string = null) {
@@ -92,15 +92,15 @@ export abstract class BaseProgram {
}
protected async exitIfAuthed() {
const authed = await this.userService.isAuthenticated();
const authed = await this.stateService.getIsAuthenticated();
if (authed) {
const email = await this.userService.getEmail();
const email = await this.stateService.getEmail();
this.processResponse(Response.error('You are already logged in as ' + email + '.'), true);
}
}
protected async exitIfNotAuthed() {
const authed = await this.userService.isAuthenticated();
const authed = await this.stateService.getIsAuthenticated();
if (!authed) {
this.processResponse(Response.error('You are not logged in.'), true);
}

View File

@@ -18,8 +18,8 @@ import { KeyConnectorService } from 'jslib-common/abstractions/keyConnector.serv
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
import { StateService } from 'jslib-common/abstractions/state.service';
import { SyncService } from 'jslib-common/abstractions/sync.service';
import { UserService } from 'jslib-common/abstractions/user.service';
import { Response } from '../models/response';
@@ -49,7 +49,7 @@ export class LoginCommand {
protected i18nService: I18nService, protected environmentService: EnvironmentService,
protected passwordGenerationService: PasswordGenerationService,
protected cryptoFunctionService: CryptoFunctionService, protected platformUtilsService: PlatformUtilsService,
protected userService: UserService, protected cryptoService: CryptoService,
protected stateService: StateService, protected cryptoService: CryptoService,
protected policyService: PolicyService, clientId: string, private syncService: SyncService,
protected keyConnectorService: KeyConnectorService) {
this.clientId = clientId;
@@ -300,7 +300,7 @@ export class LoginCommand {
}
if (this.email == null || this.email === 'undefined') {
this.email = await this.userService.getEmail();
this.email = await this.stateService.getEmail();
}
// Get New Master Password
@@ -350,8 +350,8 @@ export class LoginCommand {
// Retrieve details for key generation
const enforcedPolicyOptions = await this.policyService.getMasterPasswordPolicyOptions();
const kdf = await this.userService.getKdf();
const kdfIterations = await this.userService.getKdfIterations();
const kdf = await this.stateService.getKdfType();
const kdfIterations = await this.stateService.getKdfIterations();
if (enforcedPolicyOptions != null &&
!this.policyService.evaluateMasterPassword(