[PS-612] Update jslib (#531)
* Update Export model imports * Update for authService.getAuthStatus refactor * Update jslib
This commit is contained in:
parent
c4d586509a
commit
f6c454c970
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 6bcadc4f408db2c150753f53a07d6f8888b6e9ff
|
Subproject commit 1370006f6ea310cf85a12bcbd8213f74f9552c4d
|
40
src/bw.ts
40
src/bw.ts
|
@ -231,6 +231,26 @@ export class Main {
|
||||||
this.cryptoFunctionService
|
this.cryptoFunctionService
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.twoFactorService = new TwoFactorService(this.i18nService, this.platformUtilsService);
|
||||||
|
|
||||||
|
this.authService = new AuthService(
|
||||||
|
this.cryptoService,
|
||||||
|
this.apiService,
|
||||||
|
this.tokenService,
|
||||||
|
this.appIdService,
|
||||||
|
this.platformUtilsService,
|
||||||
|
this.messagingService,
|
||||||
|
this.logService,
|
||||||
|
this.keyConnectorService,
|
||||||
|
this.environmentService,
|
||||||
|
this.stateService,
|
||||||
|
this.twoFactorService,
|
||||||
|
this.i18nService
|
||||||
|
);
|
||||||
|
|
||||||
|
const lockedCallback = async () =>
|
||||||
|
await this.cryptoService.clearStoredKey(KeySuffixOptions.Auto);
|
||||||
|
|
||||||
this.vaultTimeoutService = new VaultTimeoutService(
|
this.vaultTimeoutService = new VaultTimeoutService(
|
||||||
this.cipherService,
|
this.cipherService,
|
||||||
this.folderService,
|
this.folderService,
|
||||||
|
@ -243,7 +263,8 @@ export class Main {
|
||||||
this.policyService,
|
this.policyService,
|
||||||
this.keyConnectorService,
|
this.keyConnectorService,
|
||||||
this.stateService,
|
this.stateService,
|
||||||
async () => await this.cryptoService.clearStoredKey(KeySuffixOptions.Auto),
|
this.authService,
|
||||||
|
lockedCallback,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -294,23 +315,6 @@ export class Main {
|
||||||
this.cryptoFunctionService
|
this.cryptoFunctionService
|
||||||
);
|
);
|
||||||
|
|
||||||
this.twoFactorService = new TwoFactorService(this.i18nService, this.platformUtilsService);
|
|
||||||
|
|
||||||
this.authService = new AuthService(
|
|
||||||
this.cryptoService,
|
|
||||||
this.apiService,
|
|
||||||
this.tokenService,
|
|
||||||
this.appIdService,
|
|
||||||
this.platformUtilsService,
|
|
||||||
this.messagingService,
|
|
||||||
this.logService,
|
|
||||||
this.keyConnectorService,
|
|
||||||
this.environmentService,
|
|
||||||
this.stateService,
|
|
||||||
this.twoFactorService,
|
|
||||||
this.i18nService
|
|
||||||
);
|
|
||||||
|
|
||||||
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
|
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
|
||||||
this.program = new Program(this);
|
this.program = new Program(this);
|
||||||
this.vaultProgram = new VaultProgram(this);
|
this.vaultProgram = new VaultProgram(this);
|
||||||
|
|
|
@ -7,9 +7,9 @@ import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||||
import { StateService } from "jslib-common/abstractions/state.service";
|
import { StateService } from "jslib-common/abstractions/state.service";
|
||||||
import { Utils } from "jslib-common/misc/utils";
|
import { Utils } from "jslib-common/misc/utils";
|
||||||
import { Cipher } from "jslib-common/models/export/cipher";
|
import { CipherExport } from "jslib-common/models/export/cipherExport";
|
||||||
import { Collection } from "jslib-common/models/export/collection";
|
import { CollectionExport } from "jslib-common/models/export/collectionExport";
|
||||||
import { Folder } from "jslib-common/models/export/folder";
|
import { FolderExport } from "jslib-common/models/export/folderExport";
|
||||||
import { CollectionRequest } from "jslib-common/models/request/collectionRequest";
|
import { CollectionRequest } from "jslib-common/models/request/collectionRequest";
|
||||||
import { SelectionReadOnlyRequest } from "jslib-common/models/request/selectionReadOnlyRequest";
|
import { SelectionReadOnlyRequest } from "jslib-common/models/request/selectionReadOnlyRequest";
|
||||||
import { Response } from "jslib-node/cli/models/response";
|
import { Response } from "jslib-node/cli/models/response";
|
||||||
|
@ -72,8 +72,8 @@ export class CreateCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createCipher(req: Cipher) {
|
private async createCipher(req: CipherExport) {
|
||||||
const cipher = await this.cipherService.encrypt(Cipher.toView(req));
|
const cipher = await this.cipherService.encrypt(CipherExport.toView(req));
|
||||||
try {
|
try {
|
||||||
await this.cipherService.saveWithServer(cipher);
|
await this.cipherService.saveWithServer(cipher);
|
||||||
const newCipher = await this.cipherService.get(cipher.id);
|
const newCipher = await this.cipherService.get(cipher.id);
|
||||||
|
@ -145,8 +145,8 @@ export class CreateCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createFolder(req: Folder) {
|
private async createFolder(req: FolderExport) {
|
||||||
const folder = await this.folderService.encrypt(Folder.toView(req));
|
const folder = await this.folderService.encrypt(FolderExport.toView(req));
|
||||||
try {
|
try {
|
||||||
await this.folderService.saveWithServer(folder);
|
await this.folderService.saveWithServer(folder);
|
||||||
const newFolder = await this.folderService.get(folder.id);
|
const newFolder = await this.folderService.get(folder.id);
|
||||||
|
@ -183,7 +183,7 @@ export class CreateCommand {
|
||||||
request.externalId = req.externalId;
|
request.externalId = req.externalId;
|
||||||
request.groups = groups;
|
request.groups = groups;
|
||||||
const response = await this.apiService.postCollection(req.organizationId, request);
|
const response = await this.apiService.postCollection(req.organizationId, request);
|
||||||
const view = Collection.toView(req);
|
const view = CollectionExport.toView(req);
|
||||||
view.id = response.id;
|
view.id = response.id;
|
||||||
const res = new OrganizationCollectionResponse(view, groups);
|
const res = new OrganizationCollectionResponse(view, groups);
|
||||||
return Response.success(res);
|
return Response.success(res);
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { CipherService } from "jslib-common/abstractions/cipher.service";
|
||||||
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||||
import { Utils } from "jslib-common/misc/utils";
|
import { Utils } from "jslib-common/misc/utils";
|
||||||
import { Cipher } from "jslib-common/models/export/cipher";
|
import { CipherExport } from "jslib-common/models/export/cipherExport";
|
||||||
import { Collection } from "jslib-common/models/export/collection";
|
import { CollectionExport } from "jslib-common/models/export/collectionExport";
|
||||||
import { Folder } from "jslib-common/models/export/folder";
|
import { FolderExport } from "jslib-common/models/export/folderExport";
|
||||||
import { CollectionRequest } from "jslib-common/models/request/collectionRequest";
|
import { CollectionRequest } from "jslib-common/models/request/collectionRequest";
|
||||||
import { SelectionReadOnlyRequest } from "jslib-common/models/request/selectionReadOnlyRequest";
|
import { SelectionReadOnlyRequest } from "jslib-common/models/request/selectionReadOnlyRequest";
|
||||||
import { Response } from "jslib-node/cli/models/response";
|
import { Response } from "jslib-node/cli/models/response";
|
||||||
|
@ -69,7 +69,7 @@ export class EditCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async editCipher(id: string, req: Cipher) {
|
private async editCipher(id: string, req: CipherExport) {
|
||||||
const cipher = await this.cipherService.get(id);
|
const cipher = await this.cipherService.get(id);
|
||||||
if (cipher == null) {
|
if (cipher == null) {
|
||||||
return Response.notFound();
|
return Response.notFound();
|
||||||
|
@ -79,7 +79,7 @@ export class EditCommand {
|
||||||
if (cipherView.isDeleted) {
|
if (cipherView.isDeleted) {
|
||||||
return Response.badRequest("You may not edit a deleted item. Use the restore command first.");
|
return Response.badRequest("You may not edit a deleted item. Use the restore command first.");
|
||||||
}
|
}
|
||||||
cipherView = Cipher.toView(req, cipherView);
|
cipherView = CipherExport.toView(req, cipherView);
|
||||||
const encCipher = await this.cipherService.encrypt(cipherView);
|
const encCipher = await this.cipherService.encrypt(cipherView);
|
||||||
try {
|
try {
|
||||||
await this.cipherService.saveWithServer(encCipher);
|
await this.cipherService.saveWithServer(encCipher);
|
||||||
|
@ -115,14 +115,14 @@ export class EditCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async editFolder(id: string, req: Folder) {
|
private async editFolder(id: string, req: FolderExport) {
|
||||||
const folder = await this.folderService.get(id);
|
const folder = await this.folderService.get(id);
|
||||||
if (folder == null) {
|
if (folder == null) {
|
||||||
return Response.notFound();
|
return Response.notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
let folderView = await folder.decrypt();
|
let folderView = await folder.decrypt();
|
||||||
folderView = Folder.toView(req, folderView);
|
folderView = FolderExport.toView(req, folderView);
|
||||||
const encFolder = await this.folderService.encrypt(folderView);
|
const encFolder = await this.folderService.encrypt(folderView);
|
||||||
try {
|
try {
|
||||||
await this.folderService.saveWithServer(encFolder);
|
await this.folderService.saveWithServer(encFolder);
|
||||||
|
@ -167,7 +167,7 @@ export class EditCommand {
|
||||||
request.externalId = req.externalId;
|
request.externalId = req.externalId;
|
||||||
request.groups = groups;
|
request.groups = groups;
|
||||||
const response = await this.apiService.putCollection(req.organizationId, id, request);
|
const response = await this.apiService.putCollection(req.organizationId, id, request);
|
||||||
const view = Collection.toView(req);
|
const view = CollectionExport.toView(req);
|
||||||
view.id = response.id;
|
view.id = response.id;
|
||||||
const res = new OrganizationCollectionResponse(view, groups);
|
const res = new OrganizationCollectionResponse(view, groups);
|
||||||
return Response.success(res);
|
return Response.success(res);
|
||||||
|
|
|
@ -13,15 +13,15 @@ import { SendType } from "jslib-common/enums/sendType";
|
||||||
import { Utils } from "jslib-common/misc/utils";
|
import { Utils } from "jslib-common/misc/utils";
|
||||||
import { EncString } from "jslib-common/models/domain/encString";
|
import { EncString } from "jslib-common/models/domain/encString";
|
||||||
import { Organization } from "jslib-common/models/domain/organization";
|
import { Organization } from "jslib-common/models/domain/organization";
|
||||||
import { Card } from "jslib-common/models/export/card";
|
import { CardExport } from "jslib-common/models/export/cardExport";
|
||||||
import { Cipher } from "jslib-common/models/export/cipher";
|
import { CipherExport } from "jslib-common/models/export/cipherExport";
|
||||||
import { Collection } from "jslib-common/models/export/collection";
|
import { CollectionExport } from "jslib-common/models/export/collectionExport";
|
||||||
import { Field } from "jslib-common/models/export/field";
|
import { FieldExport } from "jslib-common/models/export/fieldExport";
|
||||||
import { Folder } from "jslib-common/models/export/folder";
|
import { FolderExport } from "jslib-common/models/export/folderExport";
|
||||||
import { Identity } from "jslib-common/models/export/identity";
|
import { IdentityExport } from "jslib-common/models/export/identityExport";
|
||||||
import { Login } from "jslib-common/models/export/login";
|
import { LoginExport } from "jslib-common/models/export/loginExport";
|
||||||
import { LoginUri } from "jslib-common/models/export/loginUri";
|
import { LoginUriExport } from "jslib-common/models/export/loginUriExport";
|
||||||
import { SecureNote } from "jslib-common/models/export/secureNote";
|
import { SecureNoteExport } from "jslib-common/models/export/secureNoteExport";
|
||||||
import { ErrorResponse } from "jslib-common/models/response/errorResponse";
|
import { ErrorResponse } from "jslib-common/models/response/errorResponse";
|
||||||
import { CipherView } from "jslib-common/models/view/cipherView";
|
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||||
import { CollectionView } from "jslib-common/models/view/collectionView";
|
import { CollectionView } from "jslib-common/models/view/collectionView";
|
||||||
|
@ -459,31 +459,31 @@ export class GetCommand extends DownloadCommand {
|
||||||
let template: any = null;
|
let template: any = null;
|
||||||
switch (id.toLowerCase()) {
|
switch (id.toLowerCase()) {
|
||||||
case "item":
|
case "item":
|
||||||
template = Cipher.template();
|
template = CipherExport.template();
|
||||||
break;
|
break;
|
||||||
case "item.field":
|
case "item.field":
|
||||||
template = Field.template();
|
template = FieldExport.template();
|
||||||
break;
|
break;
|
||||||
case "item.login":
|
case "item.login":
|
||||||
template = Login.template();
|
template = LoginExport.template();
|
||||||
break;
|
break;
|
||||||
case "item.login.uri":
|
case "item.login.uri":
|
||||||
template = LoginUri.template();
|
template = LoginUriExport.template();
|
||||||
break;
|
break;
|
||||||
case "item.card":
|
case "item.card":
|
||||||
template = Card.template();
|
template = CardExport.template();
|
||||||
break;
|
break;
|
||||||
case "item.identity":
|
case "item.identity":
|
||||||
template = Identity.template();
|
template = IdentityExport.template();
|
||||||
break;
|
break;
|
||||||
case "item.securenote":
|
case "item.securenote":
|
||||||
template = SecureNote.template();
|
template = SecureNoteExport.template();
|
||||||
break;
|
break;
|
||||||
case "folder":
|
case "folder":
|
||||||
template = Folder.template();
|
template = FolderExport.template();
|
||||||
break;
|
break;
|
||||||
case "collection":
|
case "collection":
|
||||||
template = Collection.template();
|
template = CollectionExport.template();
|
||||||
break;
|
break;
|
||||||
case "item-collections":
|
case "item-collections":
|
||||||
template = ["collection-id1", "collection-id2"];
|
template = ["collection-id1", "collection-id2"];
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class ServeCommand {
|
||||||
this.main.environmentService,
|
this.main.environmentService,
|
||||||
this.main.syncService,
|
this.main.syncService,
|
||||||
this.main.stateService,
|
this.main.stateService,
|
||||||
this.main.vaultTimeoutService
|
this.main.authService
|
||||||
);
|
);
|
||||||
this.deleteCommand = new DeleteCommand(
|
this.deleteCommand = new DeleteCommand(
|
||||||
this.main.cipherService,
|
this.main.cipherService,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import { AuthService } from "jslib-common/abstractions/auth.service";
|
||||||
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
||||||
import { StateService } from "jslib-common/abstractions/state.service";
|
import { StateService } from "jslib-common/abstractions/state.service";
|
||||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||||
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
|
import { AuthenticationStatus } from "jslib-common/enums/authenticationStatus";
|
||||||
import { Response } from "jslib-node/cli/models/response";
|
import { Response } from "jslib-node/cli/models/response";
|
||||||
|
|
||||||
import { TemplateResponse } from "../models/response/templateResponse";
|
import { TemplateResponse } from "../models/response/templateResponse";
|
||||||
|
@ -11,7 +12,7 @@ export class StatusCommand {
|
||||||
private envService: EnvironmentService,
|
private envService: EnvironmentService,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private vaultTimeoutService: VaultTimeoutService
|
private authService: AuthService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async run(): Promise<Response> {
|
async run(): Promise<Response> {
|
||||||
|
@ -40,13 +41,14 @@ export class StatusCommand {
|
||||||
return this.envService.getUrls().base;
|
return this.envService.getUrls().base;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async status(): Promise<string> {
|
private async status(): Promise<"unauthenticated" | "locked" | "unlocked"> {
|
||||||
const authed = await this.stateService.getIsAuthenticated();
|
const authStatus = await this.authService.getAuthStatus();
|
||||||
if (!authed) {
|
if (authStatus === AuthenticationStatus.Unlocked) {
|
||||||
|
return "unlocked";
|
||||||
|
} else if (authStatus === AuthenticationStatus.Locked) {
|
||||||
|
return "locked";
|
||||||
|
} else {
|
||||||
return "unauthenticated";
|
return "unauthenticated";
|
||||||
}
|
}
|
||||||
|
|
||||||
const isLocked = await this.vaultTimeoutService.isLocked();
|
|
||||||
return isLocked ? "locked" : "unlocked";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Collection } from "jslib-common/models/export/collection";
|
import { CollectionExport } from "jslib-common/models/export/collectionExport";
|
||||||
|
|
||||||
import { SelectionReadOnly } from "../selectionReadOnly";
|
import { SelectionReadOnly } from "../selectionReadOnly";
|
||||||
|
|
||||||
export class OrganizationCollectionRequest extends Collection {
|
export class OrganizationCollectionRequest extends CollectionExport {
|
||||||
static template(): OrganizationCollectionRequest {
|
static template(): OrganizationCollectionRequest {
|
||||||
const req = new OrganizationCollectionRequest();
|
const req = new OrganizationCollectionRequest();
|
||||||
req.organizationId = "00000000-0000-0000-0000-000000000000";
|
req.organizationId = "00000000-0000-0000-0000-000000000000";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { CipherType } from "jslib-common/enums/cipherType";
|
import { CipherType } from "jslib-common/enums/cipherType";
|
||||||
import { CipherWithIds } from "jslib-common/models/export/cipherWithIds";
|
import { CipherWithIdExport } from "jslib-common/models/export/cipherWithIdsExport";
|
||||||
import { CipherView } from "jslib-common/models/view/cipherView";
|
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||||
import { BaseResponse } from "jslib-node/cli/models/response/baseResponse";
|
import { BaseResponse } from "jslib-node/cli/models/response/baseResponse";
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import { AttachmentResponse } from "./attachmentResponse";
|
||||||
import { LoginResponse } from "./loginResponse";
|
import { LoginResponse } from "./loginResponse";
|
||||||
import { PasswordHistoryResponse } from "./passwordHistoryResponse";
|
import { PasswordHistoryResponse } from "./passwordHistoryResponse";
|
||||||
|
|
||||||
export class CipherResponse extends CipherWithIds implements BaseResponse {
|
export class CipherResponse extends CipherWithIdExport implements BaseResponse {
|
||||||
object: string;
|
object: string;
|
||||||
attachments: AttachmentResponse[];
|
attachments: AttachmentResponse[];
|
||||||
revisionDate: Date;
|
revisionDate: Date;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { CollectionWithId } from "jslib-common/models/export/collectionWithId";
|
import { CollectionWithIdExport } from "jslib-common/models/export/collectionWithIdExport";
|
||||||
import { CollectionView } from "jslib-common/models/view/collectionView";
|
import { CollectionView } from "jslib-common/models/view/collectionView";
|
||||||
import { BaseResponse } from "jslib-node/cli/models/response/baseResponse";
|
import { BaseResponse } from "jslib-node/cli/models/response/baseResponse";
|
||||||
|
|
||||||
export class CollectionResponse extends CollectionWithId implements BaseResponse {
|
export class CollectionResponse extends CollectionWithIdExport implements BaseResponse {
|
||||||
object: string;
|
object: string;
|
||||||
|
|
||||||
constructor(o: CollectionView) {
|
constructor(o: CollectionView) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { FolderWithId } from "jslib-common/models/export/folderWithId";
|
import { FolderWithIdExport } from "jslib-common/models/export/folderWithIdExport";
|
||||||
import { FolderView } from "jslib-common/models/view/folderView";
|
import { FolderView } from "jslib-common/models/view/folderView";
|
||||||
import { BaseResponse } from "jslib-node/cli/models/response/baseResponse";
|
import { BaseResponse } from "jslib-node/cli/models/response/baseResponse";
|
||||||
|
|
||||||
export class FolderResponse extends FolderWithId implements BaseResponse {
|
export class FolderResponse extends FolderWithIdExport implements BaseResponse {
|
||||||
object: string;
|
object: string;
|
||||||
|
|
||||||
constructor(o: FolderView) {
|
constructor(o: FolderView) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Login } from "jslib-common/models/export/login";
|
import { LoginExport } from "jslib-common/models/export/loginExport";
|
||||||
import { LoginView } from "jslib-common/models/view/loginView";
|
import { LoginView } from "jslib-common/models/view/loginView";
|
||||||
|
|
||||||
export class LoginResponse extends Login {
|
export class LoginResponse extends LoginExport {
|
||||||
passwordRevisionDate: Date;
|
passwordRevisionDate: Date;
|
||||||
|
|
||||||
constructor(o: LoginView) {
|
constructor(o: LoginView) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import * as chalk from "chalk";
|
import * as chalk from "chalk";
|
||||||
import * as program from "commander";
|
import * as program from "commander";
|
||||||
|
|
||||||
|
import { AuthenticationStatus } from "jslib-common/enums/authenticationStatus";
|
||||||
import { KeySuffixOptions } from "jslib-common/enums/keySuffixOptions";
|
import { KeySuffixOptions } from "jslib-common/enums/keySuffixOptions";
|
||||||
import { BaseProgram } from "jslib-node/cli/baseProgram";
|
import { BaseProgram } from "jslib-node/cli/baseProgram";
|
||||||
import { LogoutCommand } from "jslib-node/cli/commands/logout.command";
|
import { LogoutCommand } from "jslib-node/cli/commands/logout.command";
|
||||||
|
@ -232,12 +233,15 @@ export class Program extends BaseProgram {
|
||||||
writeLn("", true);
|
writeLn("", true);
|
||||||
})
|
})
|
||||||
.option("--check", "Check lock status.", async () => {
|
.option("--check", "Check lock status.", async () => {
|
||||||
const locked = await this.main.vaultTimeoutService.isLocked();
|
await this.exitIfNotAuthed();
|
||||||
if (!locked) {
|
|
||||||
|
const authStatus = await this.main.authService.getAuthStatus();
|
||||||
|
if (authStatus === AuthenticationStatus.Unlocked) {
|
||||||
const res = new MessageResponse("Vault is unlocked!", null);
|
const res = new MessageResponse("Vault is unlocked!", null);
|
||||||
this.processResponse(Response.success(res), true);
|
this.processResponse(Response.success(res), true);
|
||||||
|
} else {
|
||||||
|
this.processResponse(Response.error("Vault is locked."), true);
|
||||||
}
|
}
|
||||||
this.processResponse(Response.error("Vault is locked."), true);
|
|
||||||
})
|
})
|
||||||
.option("--passwordenv <passwordenv>", "Environment variable storing your password")
|
.option("--passwordenv <passwordenv>", "Environment variable storing your password")
|
||||||
.option(
|
.option(
|
||||||
|
@ -460,7 +464,7 @@ export class Program extends BaseProgram {
|
||||||
this.main.environmentService,
|
this.main.environmentService,
|
||||||
this.main.syncService,
|
this.main.syncService,
|
||||||
this.main.stateService,
|
this.main.stateService,
|
||||||
this.main.vaultTimeoutService
|
this.main.authService
|
||||||
);
|
);
|
||||||
const response = await command.run();
|
const response = await command.run();
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
|
|
Loading…
Reference in New Issue