1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-05 23:53:21 +00:00

Upgrade prettier (#409)

This commit is contained in:
Addison Beck
2024-01-27 15:56:40 -06:00
committed by GitHub
parent 5b7b68f1cb
commit 9c88e66a27
177 changed files with 1154 additions and 1093 deletions

View File

@@ -12,10 +12,10 @@
{{ enforcedPolicyMessage }}
<ul>
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
{{ "policyInEffectMinComplexity" | i18n : getPasswordScoreAlertDisplay() }}
{{ "policyInEffectMinComplexity" | i18n: getPasswordScoreAlertDisplay() }}
</li>
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
{{ "policyInEffectMinLength" | i18n : enforcedPolicyOptions?.minLength.toString() }}
{{ "policyInEffectMinLength" | i18n: enforcedPolicyOptions?.minLength.toString() }}
</li>
<li *ngIf="enforcedPolicyOptions?.requireUpper">
{{ "policyInEffectUppercase" | i18n }}
@@ -27,7 +27,7 @@
{{ "policyInEffectNumbers" | i18n }}
</li>
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
{{ "policyInEffectSpecial" | i18n : "!@#$%^&*" }}
{{ "policyInEffectSpecial" | i18n: "!@#$%^&*" }}
</li>
</ul>
</div>

View File

@@ -19,7 +19,7 @@ export class EnvironmentComponent {
constructor(
protected platformUtilsService: PlatformUtilsService,
protected environmentService: EnvironmentService,
protected i18nService: I18nService
protected i18nService: I18nService,
) {
const urls = this.environmentService.getUrls();

View File

@@ -34,7 +34,10 @@ export class IconComponent implements OnChanges {
private iconsUrl: string;
constructor(environmentService: EnvironmentService, private stateService: StateService) {
constructor(
environmentService: EnvironmentService,
private stateService: StateService,
) {
this.iconsUrl = environmentService.getIconsUrl();
}

View File

@@ -35,7 +35,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
private cd: ChangeDetectorRef,
private el: ElementRef<HTMLElement>,
private focusTrapFactory: ConfigurableFocusTrapFactory,
public modalRef: ModalRef
public modalRef: ModalRef,
) {}
ngAfterViewInit() {
@@ -47,7 +47,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
this.modalRef.created(this.el.nativeElement);
this.focusTrap = this.focusTrapFactory.create(
this.el.nativeElement.querySelector(".modal-dialog")
this.el.nativeElement.querySelector(".modal-dialog"),
);
if (this.el.nativeElement.querySelector("[appAutoFocus]") == null) {
this.focusTrap.focusFirstTabbableElementWhenReady();

View File

@@ -1,12 +1,15 @@
import { InjectFlags, InjectOptions, Injector, ProviderToken } from "@angular/core";
export class ModalInjector implements Injector {
constructor(private _parentInjector: Injector, private _additionalTokens: WeakMap<any, any>) {}
constructor(
private _parentInjector: Injector,
private _additionalTokens: WeakMap<any, any>,
) {}
get<T>(
token: ProviderToken<T>,
notFoundValue: undefined,
options: InjectOptions & { optional?: false }
options: InjectOptions & { optional?: false },
): T;
get<T>(token: ProviderToken<T>, notFoundValue: null, options: InjectOptions): T;
get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;

View File

@@ -19,7 +19,7 @@ export class PasswordRepromptComponent {
private modalRef: ModalRef,
private cryptoService: CryptoService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService
private i18nService: I18nService,
) {}
togglePassword() {
@@ -31,7 +31,7 @@ export class PasswordRepromptComponent {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("invalidMasterPassword")
this.i18nService.t("invalidMasterPassword"),
);
return;
}

View File

@@ -62,7 +62,10 @@ import {
preserveWhitespaces: false,
})
export class BitwardenToast extends BaseToast {
constructor(protected toastrService: ToastrService, public toastPackage: ToastPackage) {
constructor(
protected toastrService: ToastrService,
public toastPackage: ToastPackage,
) {
super(toastrService, toastPackage);
}
}

View File

@@ -10,7 +10,10 @@ export class A11yTitleDirective {
private title: string;
constructor(private el: ElementRef, private renderer: Renderer2) {}
constructor(
private el: ElementRef,
private renderer: Renderer2,
) {}
ngOnInit() {
if (!this.el.nativeElement.hasAttribute("title")) {

View File

@@ -20,7 +20,7 @@ export class ApiActionDirective implements OnChanges {
constructor(
private el: ElementRef,
private validationService: ValidationService,
private logService: LogService
private logService: LogService,
) {}
ngOnChanges(changes: any) {
@@ -43,7 +43,7 @@ export class ApiActionDirective implements OnChanges {
}
this.logService?.error(`Received API exception: ${e}`);
this.validationService.showError(e);
}
},
);
}
}

View File

@@ -13,7 +13,10 @@ export class AutofocusDirective {
private autofocus: boolean;
constructor(private el: ElementRef, private ngZone: NgZone) {}
constructor(
private el: ElementRef,
private ngZone: NgZone,
) {}
ngOnInit() {
if (!Utils.isMobileBrowser && this.autofocus) {

View File

@@ -13,7 +13,7 @@ export class BoxRowDirective implements OnInit {
ngOnInit(): void {
this.formEls = Array.from(
this.el.querySelectorAll('input:not([type="hidden"]), select, textarea')
this.el.querySelectorAll('input:not([type="hidden"]), select, textarea'),
);
this.formEls.forEach((formEl) => {
formEl.addEventListener(
@@ -21,7 +21,7 @@ export class BoxRowDirective implements OnInit {
() => {
this.el.classList.add("active");
},
false
false,
);
formEl.addEventListener(
@@ -29,7 +29,7 @@ export class BoxRowDirective implements OnInit {
() => {
this.el.classList.remove("active");
},
false
false,
);
});
}

View File

@@ -4,7 +4,8 @@ $icomoon-font-path: "/jslib/angular/src/scss/bwicons/fonts/" !default;
// New font sheet? Update the font-face information below
@font-face {
font-family: "#{$icomoon-font-family}";
src: url($icomoon-font-path + "bwi-font.svg") format("svg"),
src:
url($icomoon-font-path + "bwi-font.svg") format("svg"),
url($icomoon-font-path + "bwi-font.ttf") format("truetype"),
url($icomoon-font-path + "bwi-font.woff") format("woff"),
url($icomoon-font-path + "bwi-font.woff2") format("woff2");

View File

@@ -13,7 +13,7 @@ export class AuthGuardService implements CanActivate {
private router: Router,
private messagingService: MessagingService,
private keyConnectorService: KeyConnectorService,
private stateService: StateService
private stateService: StateService,
) {}
async canActivate(route: ActivatedRouteSnapshot, routerState: RouterStateSnapshot) {

View File

@@ -131,7 +131,7 @@ import { ValidationService } from "./validation.service";
i18nService: I18nServiceAbstraction,
injector: Injector,
logService: LogService,
stateService: StateServiceAbstraction
stateService: StateServiceAbstraction,
) =>
new CipherService(
cryptoService,
@@ -141,7 +141,7 @@ import { ValidationService } from "./validation.service";
i18nService,
() => injector.get(SearchServiceAbstraction),
logService,
stateService
stateService,
),
deps: [
CryptoServiceAbstraction,
@@ -209,14 +209,14 @@ import { ValidationService } from "./validation.service";
platformUtilsService: PlatformUtilsServiceAbstraction,
environmentService: EnvironmentServiceAbstraction,
messagingService: MessagingServiceAbstraction,
appIdService: AppIdServiceAbstraction
appIdService: AppIdServiceAbstraction,
) =>
new ApiService(
tokenService,
platformUtilsService,
environmentService,
appIdService,
async (expired: boolean) => messagingService.send("logout", { expired: expired })
async (expired: boolean) => messagingService.send("logout", { expired: expired }),
),
deps: [
TokenServiceAbstraction,
@@ -247,7 +247,7 @@ import { ValidationService } from "./validation.service";
keyConnectorService: KeyConnectorServiceAbstraction,
stateService: StateServiceAbstraction,
organizationService: OrganizationServiceAbstraction,
providerService: ProviderServiceAbstraction
providerService: ProviderServiceAbstraction,
) =>
new SyncService(
apiService,
@@ -264,7 +264,7 @@ import { ValidationService } from "./validation.service";
stateService,
organizationService,
providerService,
async (expired: boolean) => messagingService.send("logout", { expired: expired })
async (expired: boolean) => messagingService.send("logout", { expired: expired }),
),
deps: [
ApiServiceAbstraction,
@@ -302,7 +302,7 @@ import { ValidationService } from "./validation.service";
tokenService: TokenServiceAbstraction,
policyService: PolicyServiceAbstraction,
keyConnectorService: KeyConnectorServiceAbstraction,
stateService: StateServiceAbstraction
stateService: StateServiceAbstraction,
) =>
new VaultTimeoutService(
cipherService,
@@ -318,7 +318,7 @@ import { ValidationService } from "./validation.service";
stateService,
null,
async (userId?: string) =>
messagingService.send("logout", { expired: false, userId: userId })
messagingService.send("logout", { expired: false, userId: userId }),
),
deps: [
CipherServiceAbstraction,
@@ -340,14 +340,14 @@ import { ValidationService } from "./validation.service";
storageService: StorageServiceAbstraction,
secureStorageService: StorageServiceAbstraction,
logService: LogService,
stateMigrationService: StateMigrationServiceAbstraction
stateMigrationService: StateMigrationServiceAbstraction,
) =>
new StateService(
storageService,
secureStorageService,
logService,
stateMigrationService,
new StateFactory(GlobalState, Account)
new StateFactory(GlobalState, Account),
),
deps: [
StorageServiceAbstraction,
@@ -360,12 +360,12 @@ import { ValidationService } from "./validation.service";
provide: StateMigrationServiceAbstraction,
useFactory: (
storageService: StorageServiceAbstraction,
secureStorageService: StorageServiceAbstraction
secureStorageService: StorageServiceAbstraction,
) =>
new StateMigrationService(
storageService,
secureStorageService,
new StateFactory(GlobalState, Account)
new StateFactory(GlobalState, Account),
),
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
},
@@ -384,7 +384,7 @@ import { ValidationService } from "./validation.service";
environmentService: EnvironmentServiceAbstraction,
messagingService: MessagingServiceAbstraction,
logService: LogService,
stateService: StateServiceAbstraction
stateService: StateServiceAbstraction,
) =>
new NotificationsService(
syncService,
@@ -394,7 +394,7 @@ import { ValidationService } from "./validation.service";
environmentService,
async () => messagingService.send("logout", { expired: true }),
logService,
stateService
stateService,
),
deps: [
SyncServiceAbstraction,

View File

@@ -11,7 +11,7 @@ export class LockGuardService implements CanActivate {
constructor(
private vaultTimeoutService: VaultTimeoutService,
private router: Router,
private stateService: StateService
private stateService: StateService,
) {}
async canActivate() {

View File

@@ -31,7 +31,7 @@ export class ModalService {
constructor(
private componentFactoryResolver: ComponentFactoryResolver,
private applicationRef: ApplicationRef,
private injector: Injector
private injector: Injector,
) {
document.addEventListener("keyup", (event) => {
if (event.key === "Escape" && this.modalCount > 0) {
@@ -51,7 +51,7 @@ export class ModalService {
async openViewRef<T>(
componentType: Type<T>,
viewContainerRef: ViewContainerRef,
setComponentParameters: (component: T) => void = null
setComponentParameters: (component: T) => void = null,
): Promise<[ModalRef, T]> {
const [modalRef, modalComponentRef] = this.openInternal(componentType, null, false);
modalComponentRef.instance.setComponentParameters = setComponentParameters;
@@ -76,7 +76,7 @@ export class ModalService {
registerComponentFactoryResolver<T>(
componentType: Type<T>,
componentFactoryResolver: ComponentFactoryResolver
componentFactoryResolver: ComponentFactoryResolver,
): void {
this.factoryResolvers.set(componentType, componentFactoryResolver);
}
@@ -92,7 +92,7 @@ export class ModalService {
protected openInternal(
componentType: Type<any>,
config?: ModalConfig,
attachToDom?: boolean
attachToDom?: boolean,
): [ModalRef, ComponentRef<DynamicModalComponent>] {
const [modalRef, componentRef] = this.createModalComponent(config);
componentRef.instance.childComponentType = componentType;
@@ -143,7 +143,7 @@ export class ModalService {
dialogEl.style.zIndex = `${this.modalCount}050`;
const modals = Array.from(
el.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]')
el.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]'),
);
for (const closeElement of modals) {
closeElement.addEventListener("click", () => {
@@ -163,7 +163,7 @@ export class ModalService {
}
protected createModalComponent(
config: ModalConfig
config: ModalConfig,
): [ModalRef, ComponentRef<DynamicModalComponent>] {
const modalRef = new ModalRef();

View File

@@ -17,7 +17,7 @@ export class PasswordRepromptService implements PasswordRepromptServiceAbstracti
constructor(
private modalService: ModalService,
private keyConnectorService: KeyConnectorService
private keyConnectorService: KeyConnectorService,
) {}
protectedFields() {

View File

@@ -10,7 +10,7 @@ export class UnauthGuardService implements CanActivate {
constructor(
private vaultTimeoutService: VaultTimeoutService,
private router: Router,
private stateService: StateService
private stateService: StateService,
) {}
async canActivate() {

View File

@@ -8,7 +8,7 @@ import { ErrorResponse } from "@/jslib/common/src/models/response/errorResponse"
export class ValidationService {
constructor(
private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService
private platformUtilsService: PlatformUtilsService,
) {}
showError(data: any): string[] {

View File

@@ -65,7 +65,7 @@ describe("ApiLogInStrategy", () => {
stateService,
twoFactorService,
environmentService,
keyConnectorService
keyConnectorService,
);
credentials = new ApiLogInCredentials(apiClientId, apiClientSecret);
@@ -86,7 +86,7 @@ describe("ApiLogInStrategy", () => {
apiTokenRequest.twoFactor.token == null &&
apiTokenRequest.captchaResponse == null
);
})
}),
);
});

View File

@@ -103,7 +103,7 @@ describe("LogInStrategy", () => {
logService,
stateService,
twoFactorService,
authService
authService,
);
credentials = new PasswordLogInCredentials(email, masterPassword);
});
@@ -134,7 +134,7 @@ describe("LogInStrategy", () => {
refreshToken: refreshToken,
},
},
})
}),
);
cryptoService.received(1).setEncKey(encKey);
cryptoService.received(1).setEncPrivateKey(privateKey);
@@ -230,7 +230,7 @@ describe("LogInStrategy", () => {
passwordTokenRequest.twoFactor.token === twoFactorToken &&
passwordTokenRequest.twoFactor.remember === false
);
})
}),
);
});
@@ -240,7 +240,7 @@ describe("LogInStrategy", () => {
credentials.twoFactor = new TokenRequestTwoFactor(
twoFactorProviderType,
twoFactorToken,
twoFactorRemember
twoFactorRemember,
);
await passwordLogInStrategy.logIn(credentials);
@@ -253,7 +253,7 @@ describe("LogInStrategy", () => {
passwordTokenRequest.twoFactor.token === twoFactorToken &&
passwordTokenRequest.twoFactor.remember === twoFactorRemember
);
})
}),
);
});
@@ -263,14 +263,14 @@ describe("LogInStrategy", () => {
email,
masterPasswordHash,
null,
null
null,
);
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
await passwordLogInStrategy.logInTwoFactor(
new TokenRequestTwoFactor(twoFactorProviderType, twoFactorToken, twoFactorRemember),
null
null,
);
apiService.received(1).postIdentityToken(
@@ -281,7 +281,7 @@ describe("LogInStrategy", () => {
passwordTokenRequest.twoFactor.token === twoFactorToken &&
passwordTokenRequest.twoFactor.remember === twoFactorRemember
);
})
}),
);
});
});

View File

@@ -24,8 +24,8 @@ const hashedPassword = "HASHED_PASSWORD";
const localHashedPassword = "LOCAL_HASHED_PASSWORD";
const preloginKey = new SymmetricCryptoKey(
Utils.fromB64ToArray(
"N2KWjlLpfi5uHjv+YcfUKIpZ1l+W+6HRensmIqD+BFYBf6N/dvFpJfWwYnVBdgFCK2tJTAIMLhqzIQQEUmGFgg=="
)
"N2KWjlLpfi5uHjv+YcfUKIpZ1l+W+6HRensmIqD+BFYBf6N/dvFpJfWwYnVBdgFCK2tJTAIMLhqzIQQEUmGFgg==",
),
);
const deviceId = Utils.newGuid();
@@ -76,7 +76,7 @@ describe("PasswordLogInStrategy", () => {
logService,
stateService,
twoFactorService,
authService
authService,
);
credentials = new PasswordLogInCredentials(email, masterPassword);
@@ -97,7 +97,7 @@ describe("PasswordLogInStrategy", () => {
passwordTokenRequest.twoFactor.token == null &&
passwordTokenRequest.captchaResponse == null
);
})
}),
);
});

View File

@@ -66,7 +66,7 @@ describe("SsoLogInStrategy", () => {
logService,
stateService,
twoFactorService,
keyConnectorService
keyConnectorService,
);
credentials = new SsoLogInCredentials(ssoCode, ssoCodeVerifier, ssoRedirectUrl, ssoOrgId);
});
@@ -87,7 +87,7 @@ describe("SsoLogInStrategy", () => {
ssoTokenRequest.twoFactor.provider == null &&
ssoTokenRequest.twoFactor.token == null
);
})
}),
);
});

View File

@@ -51,7 +51,7 @@ describe("Cipher Service", () => {
i18nService,
() => searchService,
logService,
stateService
stateService,
);
});

View File

@@ -24,7 +24,7 @@ describe("State Migration Service", () => {
stateMigrationService = new StateMigrationService(
storageService,
secureStorageService,
stateFactory
stateFactory,
);
});
@@ -77,7 +77,7 @@ describe("State Migration Service", () => {
storageService.received(1).save(
"global",
Arg.is((globals: GlobalState) => globals.stateVersion === StateVersion.Four),
Arg.any()
Arg.any(),
);
});
});

View File

@@ -16,7 +16,7 @@ export function GetUniqueString(prefix = "") {
export function BuildTestObject<T, K extends keyof T = keyof T>(
def: Partial<Pick<T, K>> | T,
constructor?: new () => T
constructor?: new () => T,
): T {
return Object.assign(constructor === null ? {} : new constructor(), def) as T;
}

View File

@@ -169,7 +169,7 @@ import { SendAccessView } from "../models/view/sendAccessView";
export abstract class ApiService {
postIdentityToken: (
request: PasswordTokenRequest | SsoTokenRequest | ApiTokenRequest
request: PasswordTokenRequest | SsoTokenRequest | ApiTokenRequest,
) => Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse>;
refreshIdentityToken: () => Promise<any>;
@@ -221,7 +221,7 @@ export abstract class ApiService {
postSendAccess: (
id: string,
request: SendAccessRequest,
apiUrl?: string
apiUrl?: string,
) => Promise<SendAccessResponse>;
getSends: () => Promise<ListResponse<SendResponse>>;
postSend: (request: SendRequest) => Promise<SendResponse>;
@@ -238,7 +238,7 @@ export abstract class ApiService {
getSendFileDownloadData: (
send: SendAccessView,
request: SendAccessRequest,
apiUrl?: string
apiUrl?: string,
) => Promise<SendFileDownloadDataResponse>;
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
@@ -247,7 +247,7 @@ export abstract class ApiService {
getAttachmentData: (
cipherId: string,
attachmentId: string,
emergencyAccessId?: string
emergencyAccessId?: string,
) => Promise<AttachmentResponse>;
getCiphersOrganization: (organizationId: string) => Promise<ListResponse<CipherResponse>>;
postCipher: (request: CipherRequest) => Promise<CipherResponse>;
@@ -268,7 +268,7 @@ export abstract class ApiService {
postImportCiphers: (request: ImportCiphersRequest) => Promise<any>;
postImportOrganizationCiphers: (
organizationId: string,
request: ImportOrganizationCiphersRequest
request: ImportOrganizationCiphersRequest,
) => Promise<any>;
putDeleteCipher: (id: string) => Promise<any>;
putDeleteCipherAdmin: (id: string) => Promise<any>;
@@ -277,7 +277,7 @@ export abstract class ApiService {
putRestoreCipher: (id: string) => Promise<CipherResponse>;
putRestoreCipherAdmin: (id: string) => Promise<CipherResponse>;
putRestoreManyCiphers: (
request: CipherBulkRestoreRequest
request: CipherBulkRestoreRequest,
) => Promise<ListResponse<CipherResponse>>;
/**
@@ -292,7 +292,7 @@ export abstract class ApiService {
postCipherAttachmentAdminLegacy: (id: string, data: FormData) => Promise<CipherResponse>;
postCipherAttachment: (
id: string,
request: AttachmentRequest
request: AttachmentRequest,
) => Promise<AttachmentUploadDataResponse>;
deleteCipherAttachment: (id: string, attachmentId: string) => Promise<any>;
deleteCipherAttachmentAdmin: (id: string, attachmentId: string) => Promise<any>;
@@ -300,40 +300,40 @@ export abstract class ApiService {
id: string,
attachmentId: string,
data: FormData,
organizationId: string
organizationId: string,
) => Promise<any>;
renewAttachmentUploadUrl: (
id: string,
attachmentId: string
attachmentId: string,
) => Promise<AttachmentUploadDataResponse>;
postAttachmentFile: (id: string, attachmentId: string, data: FormData) => Promise<any>;
getCollectionDetails: (
organizationId: string,
id: string
id: string,
) => Promise<CollectionGroupDetailsResponse>;
getUserCollections: () => Promise<ListResponse<CollectionResponse>>;
getCollections: (organizationId: string) => Promise<ListResponse<CollectionResponse>>;
getCollectionUsers: (organizationId: string, id: string) => Promise<SelectionReadOnlyResponse[]>;
postCollection: (
organizationId: string,
request: CollectionRequest
request: CollectionRequest,
) => Promise<CollectionResponse>;
putCollectionUsers: (
organizationId: string,
id: string,
request: SelectionReadOnlyRequest[]
request: SelectionReadOnlyRequest[],
) => Promise<any>;
putCollection: (
organizationId: string,
id: string,
request: CollectionRequest
request: CollectionRequest,
) => Promise<CollectionResponse>;
deleteCollection: (organizationId: string, id: string) => Promise<any>;
deleteCollectionUser: (
organizationId: string,
id: string,
organizationUserId: string
organizationUserId: string,
) => Promise<any>;
getGroupDetails: (organizationId: string, id: string) => Promise<GroupDetailsResponse>;
@@ -351,82 +351,82 @@ export abstract class ApiService {
organizationId: string,
token: string,
email: string,
organizationUserId: string
organizationUserId: string,
) => Promise<ListResponse<PolicyResponse>>;
getPoliciesByInvitedUser: (
organizationId: string,
userId: string
userId: string,
) => Promise<ListResponse<PolicyResponse>>;
putPolicy: (
organizationId: string,
type: PolicyType,
request: PolicyRequest
request: PolicyRequest,
) => Promise<PolicyResponse>;
getOrganizationUser: (
organizationId: string,
id: string
id: string,
) => Promise<OrganizationUserDetailsResponse>;
getOrganizationUserGroups: (organizationId: string, id: string) => Promise<string[]>;
getOrganizationUsers: (
organizationId: string
organizationId: string,
) => Promise<ListResponse<OrganizationUserUserDetailsResponse>>;
getOrganizationUserResetPasswordDetails: (
organizationId: string,
id: string
id: string,
) => Promise<OrganizationUserResetPasswordDetailsReponse>;
postOrganizationUserInvite: (
organizationId: string,
request: OrganizationUserInviteRequest
request: OrganizationUserInviteRequest,
) => Promise<any>;
postOrganizationUserReinvite: (organizationId: string, id: string) => Promise<any>;
postManyOrganizationUserReinvite: (
organizationId: string,
request: OrganizationUserBulkRequest
request: OrganizationUserBulkRequest,
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
postOrganizationUserAccept: (
organizationId: string,
id: string,
request: OrganizationUserAcceptRequest
request: OrganizationUserAcceptRequest,
) => Promise<any>;
postOrganizationUserConfirm: (
organizationId: string,
id: string,
request: OrganizationUserConfirmRequest
request: OrganizationUserConfirmRequest,
) => Promise<any>;
postOrganizationUsersPublicKey: (
organizationId: string,
request: OrganizationUserBulkRequest
request: OrganizationUserBulkRequest,
) => Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>>;
postOrganizationUserBulkConfirm: (
organizationId: string,
request: OrganizationUserBulkConfirmRequest
request: OrganizationUserBulkConfirmRequest,
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
putOrganizationUser: (
organizationId: string,
id: string,
request: OrganizationUserUpdateRequest
request: OrganizationUserUpdateRequest,
) => Promise<any>;
putOrganizationUserGroups: (
organizationId: string,
id: string,
request: OrganizationUserUpdateGroupsRequest
request: OrganizationUserUpdateGroupsRequest,
) => Promise<any>;
putOrganizationUserResetPasswordEnrollment: (
organizationId: string,
userId: string,
request: OrganizationUserResetPasswordEnrollmentRequest
request: OrganizationUserResetPasswordEnrollmentRequest,
) => Promise<any>;
putOrganizationUserResetPassword: (
organizationId: string,
id: string,
request: OrganizationUserResetPasswordRequest
request: OrganizationUserResetPasswordRequest,
) => Promise<any>;
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
deleteManyOrganizationUsers: (
organizationId: string,
request: OrganizationUserBulkRequest
request: OrganizationUserBulkRequest,
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
getSync: () => Promise<SyncResponse>;
@@ -438,43 +438,43 @@ export abstract class ApiService {
getTwoFactorProviders: () => Promise<ListResponse<TwoFactorProviderResponse>>;
getTwoFactorOrganizationProviders: (
organizationId: string
organizationId: string,
) => Promise<ListResponse<TwoFactorProviderResponse>>;
getTwoFactorAuthenticator: (
request: SecretVerificationRequest
request: SecretVerificationRequest,
) => Promise<TwoFactorAuthenticatorResponse>;
getTwoFactorEmail: (request: SecretVerificationRequest) => Promise<TwoFactorEmailResponse>;
getTwoFactorDuo: (request: SecretVerificationRequest) => Promise<TwoFactorDuoResponse>;
getTwoFactorOrganizationDuo: (
organizationId: string,
request: SecretVerificationRequest
request: SecretVerificationRequest,
) => Promise<TwoFactorDuoResponse>;
getTwoFactorYubiKey: (request: SecretVerificationRequest) => Promise<TwoFactorYubiKeyResponse>;
getTwoFactorWebAuthn: (request: SecretVerificationRequest) => Promise<TwoFactorWebAuthnResponse>;
getTwoFactorWebAuthnChallenge: (request: SecretVerificationRequest) => Promise<ChallengeResponse>;
getTwoFactorRecover: (request: SecretVerificationRequest) => Promise<TwoFactorRecoverResponse>;
putTwoFactorAuthenticator: (
request: UpdateTwoFactorAuthenticatorRequest
request: UpdateTwoFactorAuthenticatorRequest,
) => Promise<TwoFactorAuthenticatorResponse>;
putTwoFactorEmail: (request: UpdateTwoFactorEmailRequest) => Promise<TwoFactorEmailResponse>;
putTwoFactorDuo: (request: UpdateTwoFactorDuoRequest) => Promise<TwoFactorDuoResponse>;
putTwoFactorOrganizationDuo: (
organizationId: string,
request: UpdateTwoFactorDuoRequest
request: UpdateTwoFactorDuoRequest,
) => Promise<TwoFactorDuoResponse>;
putTwoFactorYubiKey: (
request: UpdateTwoFactorYubioOtpRequest
request: UpdateTwoFactorYubioOtpRequest,
) => Promise<TwoFactorYubiKeyResponse>;
putTwoFactorWebAuthn: (
request: UpdateTwoFactorWebAuthnRequest
request: UpdateTwoFactorWebAuthnRequest,
) => Promise<TwoFactorWebAuthnResponse>;
deleteTwoFactorWebAuthn: (
request: UpdateTwoFactorWebAuthnDeleteRequest
request: UpdateTwoFactorWebAuthnDeleteRequest,
) => Promise<TwoFactorWebAuthnResponse>;
putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
putTwoFactorOrganizationDisable: (
organizationId: string,
request: TwoFactorProviderRequest
request: TwoFactorProviderRequest,
) => Promise<TwoFactorProviderResponse>;
postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise<any>;
postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise<any>;
@@ -496,7 +496,7 @@ export abstract class ApiService {
postEmergencyAccessTakeover: (id: string) => Promise<EmergencyAccessTakeoverResponse>;
postEmergencyAccessPassword: (
id: string,
request: EmergencyAccessPasswordRequest
request: EmergencyAccessPasswordRequest,
) => Promise<any>;
postEmergencyAccessView: (id: string) => Promise<EmergencyAccessViewResponse>;
@@ -506,13 +506,13 @@ export abstract class ApiService {
getOrganizationLicense: (id: string, installationId: string) => Promise<any>;
getOrganizationTaxInfo: (id: string) => Promise<TaxInfoResponse>;
getOrganizationAutoEnrollStatus: (
identifier: string
identifier: string,
) => Promise<OrganizationAutoEnrollStatusResponse>;
getOrganizationSso: (id: string) => Promise<OrganizationSsoResponse>;
postOrganization: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
putOrganization: (
id: string,
request: OrganizationUpdateRequest
request: OrganizationUpdateRequest,
) => Promise<OrganizationResponse>;
putOrganizationTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise<any>;
postLeaveOrganization: (id: string) => Promise<any>;
@@ -520,23 +520,23 @@ export abstract class ApiService {
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
postOrganizationApiKey: (
id: string,
request: SecretVerificationRequest
request: SecretVerificationRequest,
) => Promise<ApiKeyResponse>;
postOrganizationRotateApiKey: (
id: string,
request: SecretVerificationRequest
request: SecretVerificationRequest,
) => Promise<ApiKeyResponse>;
postOrganizationSso: (
id: string,
request: OrganizationSsoRequest
request: OrganizationSsoRequest,
) => Promise<OrganizationSsoResponse>;
postOrganizationUpgrade: (
id: string,
request: OrganizationUpgradeRequest
request: OrganizationUpgradeRequest,
) => Promise<PaymentResponse>;
postOrganizationUpdateSubscription: (
id: string,
request: OrganizationSubscriptionUpdateRequest
request: OrganizationSubscriptionUpdateRequest,
) => Promise<void>;
postOrganizationSeat: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
@@ -550,7 +550,7 @@ export abstract class ApiService {
getOrganizationKeys: (id: string) => Promise<OrganizationKeysResponse>;
postOrganizationKeys: (
id: string,
request: OrganizationKeysRequest
request: OrganizationKeysRequest,
) => Promise<OrganizationKeysResponse>;
postProviderSetup: (id: string, request: ProviderSetupRequest) => Promise<ProviderResponse>;
@@ -563,46 +563,46 @@ export abstract class ApiService {
postProviderUserReinvite: (providerId: string, id: string) => Promise<any>;
postManyProviderUserReinvite: (
providerId: string,
request: ProviderUserBulkRequest
request: ProviderUserBulkRequest,
) => Promise<ListResponse<ProviderUserBulkResponse>>;
postProviderUserAccept: (
providerId: string,
id: string,
request: ProviderUserAcceptRequest
request: ProviderUserAcceptRequest,
) => Promise<any>;
postProviderUserConfirm: (
providerId: string,
id: string,
request: ProviderUserConfirmRequest
request: ProviderUserConfirmRequest,
) => Promise<any>;
postProviderUsersPublicKey: (
providerId: string,
request: ProviderUserBulkRequest
request: ProviderUserBulkRequest,
) => Promise<ListResponse<ProviderUserBulkPublicKeyResponse>>;
postProviderUserBulkConfirm: (
providerId: string,
request: ProviderUserBulkConfirmRequest
request: ProviderUserBulkConfirmRequest,
) => Promise<ListResponse<ProviderUserBulkResponse>>;
putProviderUser: (
providerId: string,
id: string,
request: ProviderUserUpdateRequest
request: ProviderUserUpdateRequest,
) => Promise<any>;
deleteProviderUser: (organizationId: string, id: string) => Promise<any>;
deleteManyProviderUsers: (
providerId: string,
request: ProviderUserBulkRequest
request: ProviderUserBulkRequest,
) => Promise<ListResponse<ProviderUserBulkResponse>>;
getProviderClients: (
providerId: string
providerId: string,
) => Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
postProviderAddOrganization: (
providerId: string,
request: ProviderAddOrganizationRequest
request: ProviderAddOrganizationRequest,
) => Promise<any>;
postProviderCreateOrganization: (
providerId: string,
request: ProviderOrganizationCreateRequest
request: ProviderOrganizationCreateRequest,
) => Promise<ProviderOrganizationResponse>;
deleteProviderOrganization: (providerId: string, organizationId: string) => Promise<any>;
@@ -611,33 +611,33 @@ export abstract class ApiService {
id: string,
start: string,
end: string,
token: string
token: string,
) => Promise<ListResponse<EventResponse>>;
getEventsOrganization: (
id: string,
start: string,
end: string,
token: string
token: string,
) => Promise<ListResponse<EventResponse>>;
getEventsOrganizationUser: (
organizationId: string,
id: string,
start: string,
end: string,
token: string
token: string,
) => Promise<ListResponse<EventResponse>>;
getEventsProvider: (
id: string,
start: string,
end: string,
token: string
token: string,
) => Promise<ListResponse<EventResponse>>;
getEventsProviderUser: (
providerId: string,
id: string,
start: string,
end: string,
token: string
token: string,
) => Promise<ListResponse<EventResponse>>;
postEventsCollect: (request: EventRequest[]) => Promise<any>;
@@ -659,21 +659,21 @@ export abstract class ApiService {
postCreateSponsorship: (
sponsorshipOrgId: string,
request: OrganizationSponsorshipCreateRequest
request: OrganizationSponsorshipCreateRequest,
) => Promise<void>;
deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise<void>;
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
postPreValidateSponsorshipToken: (sponsorshipToken: string) => Promise<boolean>;
postRedeemSponsorship: (
sponsorshipToken: string,
request: OrganizationSponsorshipRedeemRequest
request: OrganizationSponsorshipRedeemRequest,
) => Promise<void>;
postResendSponsorshipOffer: (sponsoringOrgId: string) => Promise<void>;
getUserKeyFromKeyConnector: (keyConnectorUrl: string) => Promise<KeyConnectorUserKeyResponse>;
postUserKeyToKeyConnector: (
keyConnectorUrl: string,
request: KeyConnectorUserKeyRequest
request: KeyConnectorUserKeyRequest,
) => Promise<void>;
getKeyConnectorAlive: (keyConnectorUrl: string) => Promise<void>;
}

View File

@@ -11,11 +11,11 @@ export abstract class AuthService {
masterPasswordHash: string;
email: string;
logIn: (
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials,
) => Promise<AuthResult>;
logInTwoFactor: (
twoFactor: TokenRequestTwoFactor,
captchaResponse: string
captchaResponse: string,
) => Promise<AuthResult>;
logOut: (callback: () => void) => void;
makePreloginKey: (masterPassword: string, email: string) => Promise<SymmetricCryptoKey>;

View File

@@ -12,7 +12,7 @@ export abstract class CipherService {
encrypt: (
model: CipherView,
key?: SymmetricCryptoKey,
originalCipher?: Cipher
originalCipher?: Cipher,
) => Promise<Cipher>;
encryptFields: (fieldsModel: FieldView[], key: SymmetricCryptoKey) => Promise<Field[]>;
encryptField: (fieldModel: FieldView, key: SymmetricCryptoKey) => Promise<Field>;
@@ -23,7 +23,7 @@ export abstract class CipherService {
getAllDecryptedForUrl: (
url: string,
includeOtherTypes?: CipherType[],
defaultMatch?: UriMatchType
defaultMatch?: UriMatchType,
) => Promise<CipherView[]>;
getAllFromApiForOrganization: (organizationId: string) => Promise<CipherView[]>;
getLastUsedForUrl: (url: string, autofillOnPageLoad: boolean) => Promise<CipherView>;
@@ -37,23 +37,23 @@ export abstract class CipherService {
shareWithServer: (
cipher: CipherView,
organizationId: string,
collectionIds: string[]
collectionIds: string[],
) => Promise<any>;
shareManyWithServer: (
ciphers: CipherView[],
organizationId: string,
collectionIds: string[]
collectionIds: string[],
) => Promise<any>;
saveAttachmentWithServer: (
cipher: Cipher,
unencryptedFile: any,
admin?: boolean
admin?: boolean,
) => Promise<Cipher>;
saveAttachmentRawWithServer: (
cipher: Cipher,
filename: string,
data: ArrayBuffer,
admin?: boolean
admin?: boolean,
) => Promise<Cipher>;
saveCollectionsWithServer: (cipher: Cipher) => Promise<any>;
upsert: (cipher: CipherData | CipherData[]) => Promise<any>;
@@ -72,7 +72,7 @@ export abstract class CipherService {
softDeleteWithServer: (id: string) => Promise<any>;
softDeleteManyWithServer: (ids: string[]) => Promise<any>;
restore: (
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[]
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[],
) => Promise<any>;
restoreWithServer: (id: string) => Promise<any>;
restoreManyWithServer: (ids: string[]) => Promise<any>;

View File

@@ -15,7 +15,7 @@ export abstract class CryptoService {
setEncPrivateKey: (encPrivateKey: string) => Promise<void>;
setOrgKeys: (
orgs: ProfileOrganizationResponse[],
providerOrgs: ProfileProviderOrganizationResponse[]
providerOrgs: ProfileProviderOrganizationResponse[],
) => Promise<void>;
setProviderKeys: (orgs: ProfileProviderResponse[]) => Promise<void>;
getKey: (keySuffix?: KeySuffixOptions, userId?: string) => Promise<SymmetricCryptoKey>;
@@ -46,14 +46,14 @@ export abstract class CryptoService {
password: string,
salt: string,
kdf: KdfType,
kdfIterations: number
kdfIterations: number,
) => Promise<SymmetricCryptoKey>;
makeKeyFromPin: (
pin: string,
salt: string,
kdf: KdfType,
kdfIterations: number,
protectedKeyCs?: EncString
protectedKeyCs?: EncString,
) => Promise<SymmetricCryptoKey>;
makeShareKey: () => Promise<[EncString, SymmetricCryptoKey]>;
makeKeyPair: (key?: SymmetricCryptoKey) => Promise<[string, EncString]>;
@@ -61,18 +61,18 @@ export abstract class CryptoService {
pin: string,
salt: string,
kdf: KdfType,
kdfIterations: number
kdfIterations: number,
) => Promise<SymmetricCryptoKey>;
makeSendKey: (keyMaterial: ArrayBuffer) => Promise<SymmetricCryptoKey>;
hashPassword: (
password: string,
key: SymmetricCryptoKey,
hashPurpose?: HashPurpose
hashPurpose?: HashPurpose,
) => Promise<string>;
makeEncKey: (key: SymmetricCryptoKey) => Promise<[SymmetricCryptoKey, EncString]>;
remakeEncKey: (
key: SymmetricCryptoKey,
encKey?: SymmetricCryptoKey
encKey?: SymmetricCryptoKey,
) => Promise<[SymmetricCryptoKey, EncString]>;
encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncString>;
encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncArrayBuffer>;

View File

@@ -6,35 +6,35 @@ export abstract class CryptoFunctionService {
password: string | ArrayBuffer,
salt: string | ArrayBuffer,
algorithm: "sha256" | "sha512",
iterations: number
iterations: number,
) => Promise<ArrayBuffer>;
hkdf: (
ikm: ArrayBuffer,
salt: string | ArrayBuffer,
info: string | ArrayBuffer,
outputByteSize: number,
algorithm: "sha256" | "sha512"
algorithm: "sha256" | "sha512",
) => Promise<ArrayBuffer>;
hkdfExpand: (
prk: ArrayBuffer,
info: string | ArrayBuffer,
outputByteSize: number,
algorithm: "sha256" | "sha512"
algorithm: "sha256" | "sha512",
) => Promise<ArrayBuffer>;
hash: (
value: string | ArrayBuffer,
algorithm: "sha1" | "sha256" | "sha512" | "md5"
algorithm: "sha1" | "sha256" | "sha512" | "md5",
) => Promise<ArrayBuffer>;
hmac: (
value: ArrayBuffer,
key: ArrayBuffer,
algorithm: "sha1" | "sha256" | "sha512"
algorithm: "sha1" | "sha256" | "sha512",
) => Promise<ArrayBuffer>;
compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise<boolean>;
hmacFast: (
value: ArrayBuffer | string,
key: ArrayBuffer | string,
algorithm: "sha1" | "sha256" | "sha512"
algorithm: "sha1" | "sha256" | "sha512",
) => Promise<ArrayBuffer | string>;
compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise<boolean>;
aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
@@ -42,19 +42,19 @@ export abstract class CryptoFunctionService {
data: string,
iv: string,
mac: string,
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
) => DecryptParameters<ArrayBuffer | string>;
aesDecryptFast: (parameters: DecryptParameters<ArrayBuffer | string>) => Promise<string>;
aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
rsaEncrypt: (
data: ArrayBuffer,
publicKey: ArrayBuffer,
algorithm: "sha1" | "sha256"
algorithm: "sha1" | "sha256",
) => Promise<ArrayBuffer>;
rsaDecrypt: (
data: ArrayBuffer,
privateKey: ArrayBuffer,
algorithm: "sha1" | "sha256"
algorithm: "sha1" | "sha256",
) => Promise<ArrayBuffer>;
rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise<ArrayBuffer>;
rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>;

View File

@@ -7,12 +7,12 @@ export abstract class FileUploadService {
uploadSendFile: (
uploadData: SendFileUploadDataResponse,
fileName: EncString,
encryptedFileData: EncArrayBuffer
encryptedFileData: EncArrayBuffer,
) => Promise<any>;
uploadCipherAttachment: (
admin: boolean,
uploadData: AttachmentUploadDataResponse,
fileName: EncString,
encryptedFileData: EncArrayBuffer
encryptedFileData: EncArrayBuffer,
) => Promise<any>;
}

View File

@@ -9,7 +9,7 @@ export abstract class KeyConnectorService {
userNeedsMigration: () => Promise<boolean>;
convertNewSsoUserToKeyConnector: (
tokenResponse: IdentityTokenResponse,
orgId: string
orgId: string,
) => Promise<void>;
setUsesKeyConnector: (enabled: boolean) => Promise<void>;
setConvertAccountRequired: (status: boolean) => Promise<void>;

View File

@@ -8,7 +8,7 @@ export abstract class PasswordGenerationService {
generatePassphrase: (options: any) => Promise<string>;
getOptions: () => Promise<[any, PasswordGeneratorPolicyOptions]>;
enforcePasswordGeneratorPoliciesOnOptions: (
options: any
options: any,
) => Promise<[any, PasswordGeneratorPolicyOptions]>;
getPasswordGeneratorPolicyOptions: () => Promise<PasswordGeneratorPolicyOptions>;
saveOptions: (options: any) => Promise<any>;

View File

@@ -27,7 +27,7 @@ export abstract class PlatformUtilsService {
type: "error" | "success" | "warning" | "info",
title: string,
text: string | string[],
options?: ToastOptions
options?: ToastOptions,
) => void;
showDialog: (
body: string,
@@ -35,7 +35,7 @@ export abstract class PlatformUtilsService {
confirmText?: string,
cancelText?: string,
type?: string,
bodyIsHtml?: boolean
bodyIsHtml?: boolean,
) => Promise<boolean>;
isDev: () => boolean;
isSelfHost: () => boolean;
@@ -45,7 +45,7 @@ export abstract class PlatformUtilsService {
authenticateBiometric: () => Promise<boolean>;
getDefaultSystemTheme: () => Promise<ThemeType.Light | ThemeType.Dark>;
onDefaultSystemThemeChange: (
callback: (theme: ThemeType.Light | ThemeType.Dark) => unknown
callback: (theme: ThemeType.Light | ThemeType.Dark) => unknown,
) => unknown;
getEffectiveTheme: () => Promise<ThemeType>;
supportsSecureStorage: () => boolean;

View File

@@ -17,16 +17,16 @@ export abstract class PolicyService {
evaluateMasterPassword: (
passwordStrength: number,
newPassword: string,
enforcedPolicyOptions?: MasterPasswordPolicyOptions
enforcedPolicyOptions?: MasterPasswordPolicyOptions,
) => boolean;
getResetPasswordPolicyOptions: (
policies: Policy[],
orgId: string
orgId: string,
) => [ResetPasswordPolicyOptions, boolean];
mapPoliciesFromToken: (policiesResponse: ListResponse<PolicyResponse>) => Policy[];
policyAppliesToUser: (
policyType: PolicyType,
policyFilter?: (policy: Policy) => boolean,
userId?: string
userId?: string,
) => Promise<boolean>;
}

View File

@@ -9,7 +9,7 @@ export abstract class SearchService {
searchCiphers: (
query: string,
filter?: ((cipher: CipherView) => boolean) | ((cipher: CipherView) => boolean)[],
ciphers?: CipherView[]
ciphers?: CipherView[],
) => Promise<CipherView[]>;
searchCiphersBasic: (ciphers: CipherView[], query: string, deleted?: boolean) => CipherView[];
searchSends: (sends: SendView[], query: string) => SendView[];

View File

@@ -10,7 +10,7 @@ export abstract class SendService {
model: SendView,
file: File | ArrayBuffer,
password: string,
key?: SymmetricCryptoKey
key?: SymmetricCryptoKey,
) => Promise<[Send, EncArrayBuffer]>;
get: (id: string) => Promise<Send>;
getAll: () => Promise<Send[]>;

View File

@@ -82,23 +82,23 @@ export abstract class StateService<T extends Account = Account> {
getDecryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise<SymmetricCryptoKey>;
setDecryptedCryptoSymmetricKey: (
value: SymmetricCryptoKey,
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getDecryptedFolders: (options?: StorageOptions) => Promise<FolderView[]>;
setDecryptedFolders: (value: FolderView[], options?: StorageOptions) => Promise<void>;
getDecryptedOrganizationKeys: (
options?: StorageOptions
options?: StorageOptions,
) => Promise<Map<string, SymmetricCryptoKey>>;
setDecryptedOrganizationKeys: (
value: Map<string, SymmetricCryptoKey>,
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getDecryptedPasswordGenerationHistory: (
options?: StorageOptions
options?: StorageOptions,
) => Promise<GeneratedPasswordHistory[]>;
setDecryptedPasswordGenerationHistory: (
value: GeneratedPasswordHistory[],
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getDecryptedPinProtected: (options?: StorageOptions) => Promise<EncString>;
setDecryptedPinProtected: (value: EncString, options?: StorageOptions) => Promise<void>;
@@ -109,7 +109,7 @@ export abstract class StateService<T extends Account = Account> {
getDecryptedProviderKeys: (options?: StorageOptions) => Promise<Map<string, SymmetricCryptoKey>>;
setDecryptedProviderKeys: (
value: Map<string, SymmetricCryptoKey>,
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getDecryptedSends: (options?: StorageOptions) => Promise<SendView[]>;
setDecryptedSends: (value: SendView[], options?: StorageOptions) => Promise<void>;
@@ -126,7 +126,7 @@ export abstract class StateService<T extends Account = Account> {
getDisableChangedPasswordNotification: (options?: StorageOptions) => Promise<boolean>;
setDisableChangedPasswordNotification: (
value: boolean,
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getDisableContextMenuItem: (options?: StorageOptions) => Promise<boolean>;
setDisableContextMenuItem: (value: boolean, options?: StorageOptions) => Promise<void>;
@@ -153,7 +153,7 @@ export abstract class StateService<T extends Account = Account> {
getEnableBrowserIntegrationFingerprint: (options?: StorageOptions) => Promise<boolean>;
setEnableBrowserIntegrationFingerprint: (
value: boolean,
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getEnableCloseToTray: (options?: StorageOptions) => Promise<boolean>;
setEnableCloseToTray: (value: boolean, options?: StorageOptions) => Promise<void>;
@@ -170,38 +170,38 @@ export abstract class StateService<T extends Account = Account> {
getEncryptedCiphers: (options?: StorageOptions) => Promise<{ [id: string]: CipherData }>;
setEncryptedCiphers: (
value: { [id: string]: CipherData },
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getEncryptedCollections: (options?: StorageOptions) => Promise<{ [id: string]: CollectionData }>;
setEncryptedCollections: (
value: { [id: string]: CollectionData },
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getEncryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise<string>;
setEncryptedCryptoSymmetricKey: (value: string, options?: StorageOptions) => Promise<void>;
getEncryptedFolders: (options?: StorageOptions) => Promise<{ [id: string]: FolderData }>;
setEncryptedFolders: (
value: { [id: string]: FolderData },
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getEncryptedOrganizationKeys: (options?: StorageOptions) => Promise<any>;
setEncryptedOrganizationKeys: (
value: Map<string, SymmetricCryptoKey>,
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getEncryptedPasswordGenerationHistory: (
options?: StorageOptions
options?: StorageOptions,
) => Promise<GeneratedPasswordHistory[]>;
setEncryptedPasswordGenerationHistory: (
value: GeneratedPasswordHistory[],
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getEncryptedPinProtected: (options?: StorageOptions) => Promise<string>;
setEncryptedPinProtected: (value: string, options?: StorageOptions) => Promise<void>;
getEncryptedPolicies: (options?: StorageOptions) => Promise<{ [id: string]: PolicyData }>;
setEncryptedPolicies: (
value: { [id: string]: PolicyData },
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getEncryptedPrivateKey: (options?: StorageOptions) => Promise<string>;
setEncryptedPrivateKey: (value: string, options?: StorageOptions) => Promise<void>;
@@ -261,7 +261,7 @@ export abstract class StateService<T extends Account = Account> {
getOrganizations: (options?: StorageOptions) => Promise<{ [id: string]: OrganizationData }>;
setOrganizations: (
value: { [id: string]: OrganizationData },
options?: StorageOptions
options?: StorageOptions,
) => Promise<void>;
getPasswordGenerationOptions: (options?: StorageOptions) => Promise<any>;
setPasswordGenerationOptions: (value: any, options?: StorageOptions) => Promise<void>;

View File

@@ -4,7 +4,7 @@ export abstract class TokenService {
setTokens: (
accessToken: string,
refreshToken: string,
clientIdClientSecret: [string, string]
clientIdClientSecret: [string, string],
) => Promise<any>;
setToken: (token: string) => Promise<any>;
getToken: () => Promise<string>;

View File

@@ -5,7 +5,7 @@ export abstract class UserVerificationService {
buildRequest: <T extends SecretVerificationRequest>(
verification: Verification,
requestClass?: new () => T,
alreadyHashed?: boolean
alreadyHashed?: boolean,
) => Promise<T>;
verifyUser: (verification: Verification) => Promise<boolean>;
requestOTP: () => Promise<void>;

View File

@@ -6,14 +6,14 @@ import { GlobalStateFactory } from "./globalStateFactory";
export class StateFactory<
TGlobal extends GlobalState = GlobalState,
TAccount extends Account = Account
TAccount extends Account = Account,
> {
private globalStateFactory: GlobalStateFactory<TGlobal>;
private accountFactory: AccountFactory<TAccount>;
constructor(
globalStateConstructor: new (init: Partial<TGlobal>) => TGlobal,
accountConstructor: new (init: Partial<TAccount>) => TAccount
accountConstructor: new (init: Partial<TAccount>) => TAccount,
) {
this.globalStateFactory = new GlobalStateFactory(globalStateConstructor);
this.accountFactory = new AccountFactory(accountConstructor);

View File

@@ -9,7 +9,7 @@ export class CaptchaIFrame extends IFrameComponent {
private i18nService: I18nService,
successCallback: (message: string) => any,
errorCallback: (message: string) => any,
infoCallback: (message: string) => any
infoCallback: (message: string) => any,
) {
super(
win,
@@ -26,13 +26,13 @@ export class CaptchaIFrame extends IFrameComponent {
} else {
infoCallback(parsedMessage);
}
}
},
);
}
init(siteKey: string): void {
super.initComponent(
this.createParams({ siteKey: siteKey, locale: this.i18nService.translationLocale }, 1)
this.createParams({ siteKey: siteKey, locale: this.i18nService.translationLocale }, 1),
);
}
}

View File

@@ -10,7 +10,7 @@ export abstract class IFrameComponent {
private iframeId: string,
public successCallback?: (message: string) => any,
public errorCallback?: (message: string) => any,
public infoCallback?: (message: string) => any
public infoCallback?: (message: string) => any,
) {
this.connectorLink = win.document.createElement("a");
}
@@ -35,7 +35,7 @@ export abstract class IFrameComponent {
return btoa(
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
return String.fromCharCode(("0x" + p1) as any);
})
}),
);
}

View File

@@ -2,7 +2,10 @@ import { LinkedIdType } from "../enums/linkedIdType";
import { ItemView } from "../models/view/itemView";
export class LinkedMetadata {
constructor(readonly propertyKey: string, private readonly _i18nKey?: string) {}
constructor(
readonly propertyKey: string,
private readonly _i18nKey?: string,
) {}
get i18nKey() {
return this._i18nKey ?? this.propertyKey;

View File

@@ -29,7 +29,7 @@ export class ApiLogInStrategy extends LogInStrategy {
stateService: StateService,
twoFactorService: TwoFactorService,
private environmentService: EnvironmentService,
private keyConnectorService: KeyConnectorService
private keyConnectorService: KeyConnectorService,
) {
super(
cryptoService,
@@ -40,7 +40,7 @@ export class ApiLogInStrategy extends LogInStrategy {
messagingService,
logService,
stateService,
twoFactorService
twoFactorService,
);
}
@@ -56,7 +56,7 @@ export class ApiLogInStrategy extends LogInStrategy {
credentials.clientId,
credentials.clientSecret,
await this.buildTwoFactor(),
await this.buildDeviceRequest()
await this.buildDeviceRequest(),
);
return this.startLogIn();

View File

@@ -38,16 +38,16 @@ export abstract class LogInStrategy {
protected messagingService: MessagingService,
protected logService: LogService,
protected stateService: StateService,
protected twoFactorService: TwoFactorService
protected twoFactorService: TwoFactorService,
) {}
abstract logIn(
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials,
): Promise<AuthResult>;
async logInTwoFactor(
twoFactor: TokenRequestTwoFactor,
captchaResponse: string = null
captchaResponse: string = null,
): Promise<AuthResult> {
this.tokenRequest.setTwoFactor(twoFactor);
return this.startLogIn();
@@ -113,7 +113,7 @@ export abstract class LogInStrategy {
refreshToken: tokenResponse.refreshToken,
},
},
})
}),
);
}
@@ -132,7 +132,7 @@ export abstract class LogInStrategy {
if (!newSsoUser) {
await this.cryptoService.setEncKey(response.key);
await this.cryptoService.setEncPrivateKey(
response.privateKey ?? (await this.createKeyPairForOldAccount())
response.privateKey ?? (await this.createKeyPairForOldAccount()),
);
}

View File

@@ -41,7 +41,7 @@ export class PasswordLogInStrategy extends LogInStrategy {
logService: LogService,
stateService: StateService,
twoFactorService: TwoFactorService,
private authService: AuthService
private authService: AuthService,
) {
super(
cryptoService,
@@ -52,7 +52,7 @@ export class PasswordLogInStrategy extends LogInStrategy {
messagingService,
logService,
stateService,
twoFactorService
twoFactorService,
);
}
@@ -63,7 +63,7 @@ export class PasswordLogInStrategy extends LogInStrategy {
async logInTwoFactor(
twoFactor: TokenRequestTwoFactor,
captchaResponse: string
captchaResponse: string,
): Promise<AuthResult> {
this.tokenRequest.captchaResponse = captchaResponse ?? this.captchaBypassToken;
return super.logInTwoFactor(twoFactor);
@@ -78,7 +78,7 @@ export class PasswordLogInStrategy extends LogInStrategy {
this.localHashedPassword = await this.cryptoService.hashPassword(
masterPassword,
this.key,
HashPurpose.LocalAuthorization
HashPurpose.LocalAuthorization,
);
const hashedPassword = await this.cryptoService.hashPassword(masterPassword, this.key);
@@ -87,7 +87,7 @@ export class PasswordLogInStrategy extends LogInStrategy {
hashedPassword,
captchaToken,
await this.buildTwoFactor(twoFactor),
await this.buildDeviceRequest()
await this.buildDeviceRequest(),
);
return this.startLogIn();

View File

@@ -28,7 +28,7 @@ export class SsoLogInStrategy extends LogInStrategy {
logService: LogService,
stateService: StateService,
twoFactorService: TwoFactorService,
private keyConnectorService: KeyConnectorService
private keyConnectorService: KeyConnectorService,
) {
super(
cryptoService,
@@ -39,7 +39,7 @@ export class SsoLogInStrategy extends LogInStrategy {
messagingService,
logService,
stateService,
twoFactorService
twoFactorService,
);
}
@@ -62,7 +62,7 @@ export class SsoLogInStrategy extends LogInStrategy {
credentials.codeVerifier,
credentials.redirectUrl,
await this.buildTwoFactor(credentials.twoFactor),
await this.buildDeviceRequest()
await this.buildDeviceRequest(),
);
return this.startLogIn();

View File

@@ -7,7 +7,7 @@ export class ServiceUtils {
parts: string[],
obj: ITreeNodeObject,
parent: ITreeNodeObject,
delimiter: string
delimiter: string,
) {
if (parts.length <= partIndex) {
return;
@@ -31,7 +31,7 @@ export class ServiceUtils {
parts,
obj,
nodeTree[i].node,
delimiter
delimiter,
);
return;
}
@@ -48,14 +48,14 @@ export class ServiceUtils {
[newPartName, ...parts.slice(partIndex + 2)],
obj,
parent,
delimiter
delimiter,
);
}
}
static getTreeNodeObject(
nodeTree: TreeNode<ITreeNodeObject>[],
id: string
id: string,
): TreeNode<ITreeNodeObject> {
for (let i = 0; i < nodeTree.length; i++) {
if (nodeTree[i].node.id === id) {

View File

@@ -8,7 +8,7 @@ export function throttle(limit: number, throttleKey: (args: any[]) => string) {
return <T>(
target: any,
propertyKey: string | symbol,
descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<T>>
descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<T>>,
) => {
const originalMethod: () => Promise<T> = descriptor.value;
const allThrottles = new Map<any, Map<string, (() => void)[]>>();

View File

@@ -1,7 +1,8 @@
/* eslint-disable no-useless-escape */
import { I18nService } from "../abstractions/i18n.service";
import * as tldjs from "tldjs";
import { I18nService } from "../abstractions/i18n.service";
const nodeURL = typeof window === "undefined" ? require("url") : null;
@@ -185,7 +186,7 @@ export class Utils {
static isGuid(id: string) {
return RegExp(
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
"i"
"i",
).test(id);
}
@@ -279,7 +280,7 @@ export class Utils {
}
map.set(
decodeURIComponent(parts[0]).toLowerCase(),
parts[1] == null ? "" : decodeURIComponent(parts[1])
parts[1] == null ? "" : decodeURIComponent(parts[1]),
);
});
return map;
@@ -359,10 +360,10 @@ export class Utils {
((a) => {
if (
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
a
a,
) ||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
a.substr(0, 4)
a.substr(0, 4),
)
) {
mobile = true;

View File

@@ -14,7 +14,7 @@ export class WebAuthnIFrame {
private i18nService: I18nService,
private successCallback: Function, // eslint-disable-line
private errorCallback: Function, // eslint-disable-line
private infoCallback: Function // eslint-disable-line
private infoCallback: Function, // eslint-disable-line
) {
this.connectorLink = win.document.createElement("a");
}
@@ -31,7 +31,7 @@ export class WebAuthnIFrame {
// Firefox fallback which opens the webauthn page in a new tab
params.append("locale", this.i18nService.translationLocale);
this.platformUtilsService.launchUri(
`${this.webVaultUrl}/webauthn-fallback-connector.html?${params}`
`${this.webVaultUrl}/webauthn-fallback-connector.html?${params}`,
);
} else {
this.connectorLink.href = `${this.webVaultUrl}/webauthn-connector.html?${params}`;
@@ -63,7 +63,7 @@ export class WebAuthnIFrame {
return btoa(
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
return String.fromCharCode(("0x" + p1) as any);
})
}),
);
}

View File

@@ -126,10 +126,10 @@ export class SsoConfigApi extends BaseResponse {
this.idpX509PublicCert = this.getResponseProperty("IdpX509PublicCert");
this.idpOutboundSigningAlgorithm = this.getResponseProperty("IdpOutboundSigningAlgorithm");
this.idpAllowUnsolicitedAuthnResponse = this.getResponseProperty(
"IdpAllowUnsolicitedAuthnResponse"
"IdpAllowUnsolicitedAuthnResponse",
);
this.idpDisableOutboundLogoutRequests = this.getResponseProperty(
"IdpDisableOutboundLogoutRequests"
"IdpDisableOutboundLogoutRequests",
);
this.idpWantAuthnRequestsSigned = this.getResponseProperty("IdpWantAuthnRequestsSigned");
}

View File

@@ -32,7 +32,7 @@ export class Attachment extends Domain {
fileName: null,
key: null,
},
["id", "url", "sizeName"]
["id", "url", "sizeName"],
);
}
@@ -43,7 +43,7 @@ export class Attachment extends Domain {
fileName: null,
},
orgId,
encKey
encKey,
);
if (this.key != null) {
@@ -80,7 +80,7 @@ export class Attachment extends Domain {
fileName: null,
key: null,
},
["id", "url", "sizeName"]
["id", "url", "sizeName"],
);
return a;
}

View File

@@ -30,7 +30,7 @@ export class Card extends Domain {
expYear: null,
code: null,
},
[]
[],
);
}
@@ -46,7 +46,7 @@ export class Card extends Domain {
code: null,
},
orgId,
encKey
encKey,
);
}

View File

@@ -55,7 +55,7 @@ export class Cipher extends Domain {
name: null,
notes: null,
},
["id", "userId", "organizationId", "folderId"]
["id", "userId", "organizationId", "folderId"],
);
this.type = obj.type;
@@ -119,7 +119,7 @@ export class Cipher extends Domain {
notes: null,
},
this.organizationId,
encKey
encKey,
);
switch (this.type) {

View File

@@ -29,7 +29,7 @@ export class Collection extends Domain {
readOnly: null,
hidePasswords: null,
},
["id", "organizationId", "externalId", "readOnly", "hidePasswords"]
["id", "organizationId", "externalId", "readOnly", "hidePasswords"],
);
}
@@ -39,7 +39,7 @@ export class Collection extends Domain {
{
name: null,
},
this.organizationId
this.organizationId,
);
}
}

View File

@@ -8,7 +8,7 @@ export default class Domain {
domain: D,
dataObj: any,
map: any,
notEncList: any[] = []
notEncList: any[] = [],
) {
for (const prop in map) {
// eslint-disable-next-line
@@ -28,7 +28,7 @@ export default class Domain {
domain: D,
dataObj: any,
map: any,
notEncStringList: any[] = []
notEncStringList: any[] = [],
) {
for (const prop in map) {
// eslint-disable-next-line
@@ -49,7 +49,7 @@ export default class Domain {
viewModel: T,
map: any,
orgId: string,
key: SymmetricCryptoKey = null
key: SymmetricCryptoKey = null,
): Promise<T> {
const promises = [];
const self: any = this;

View File

@@ -16,7 +16,7 @@ export class EncString {
encryptedStringOrType: string | EncryptionType,
data?: string,
iv?: string,
mac?: string
mac?: string,
) {
if (data != null) {
// data and header

View File

@@ -28,7 +28,7 @@ export class Field extends Domain {
name: null,
value: null,
},
[]
[],
);
}
@@ -40,7 +40,7 @@ export class Field extends Domain {
value: null,
},
orgId,
encKey
encKey,
);
}
@@ -55,7 +55,7 @@ export class Field extends Domain {
type: null,
linkedId: null,
},
["type", "linkedId"]
["type", "linkedId"],
);
return f;
}

View File

@@ -22,7 +22,7 @@ export class Folder extends Domain {
id: null,
name: null,
},
["id"]
["id"],
);
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
@@ -34,7 +34,7 @@ export class Folder extends Domain {
{
name: null,
},
null
null,
);
}
}

View File

@@ -54,7 +54,7 @@ export class Identity extends Domain {
passportNumber: null,
licenseNumber: null,
},
[]
[],
);
}
@@ -82,7 +82,7 @@ export class Identity extends Domain {
licenseNumber: null,
},
orgId,
encKey
encKey,
);
}

View File

@@ -8,7 +8,7 @@ export class PasswordLogInCredentials {
public email: string,
public masterPassword: string,
public captchaToken?: string,
public twoFactor?: TokenRequestTwoFactor
public twoFactor?: TokenRequestTwoFactor,
) {}
}
@@ -20,12 +20,15 @@ export class SsoLogInCredentials {
public codeVerifier: string,
public redirectUrl: string,
public orgId: string,
public twoFactor?: TokenRequestTwoFactor
public twoFactor?: TokenRequestTwoFactor,
) {}
}
export class ApiLogInCredentials {
readonly type = AuthenticationType.Api;
constructor(public clientId: string, public clientSecret: string) {}
constructor(
public clientId: string,
public clientSecret: string,
) {}
}

View File

@@ -31,7 +31,7 @@ export class Login extends Domain {
password: null,
totp: null,
},
[]
[],
);
if (obj.uris) {
@@ -51,7 +51,7 @@ export class Login extends Domain {
totp: null,
},
orgId,
encKey
encKey,
);
if (this.uris != null) {

View File

@@ -23,7 +23,7 @@ export class LoginUri extends Domain {
{
uri: null,
},
[]
[],
);
}
@@ -34,7 +34,7 @@ export class LoginUri extends Domain {
uri: null,
},
orgId,
encKey
encKey,
);
}
@@ -47,7 +47,7 @@ export class LoginUri extends Domain {
uri: null,
match: null,
},
["match"]
["match"],
);
return u;
}

View File

@@ -28,7 +28,7 @@ export class Password extends Domain {
password: null,
},
orgId,
encKey
encKey,
);
}

View File

@@ -45,7 +45,7 @@ export class Send extends Domain {
notes: null,
key: null,
},
["id", "accessId", "userId"]
["id", "accessId", "userId"],
);
this.type = obj.type;
@@ -95,7 +95,7 @@ export class Send extends Domain {
notes: null,
},
null,
model.cryptoKey
model.cryptoKey,
);
switch (this.type) {

View File

@@ -32,7 +32,7 @@ export class SendAccess extends Domain {
expirationDate: null,
creatorIdentifier: null,
},
["id", "expirationDate", "creatorIdentifier"]
["id", "expirationDate", "creatorIdentifier"],
);
this.type = obj.type;
@@ -58,7 +58,7 @@ export class SendAccess extends Domain {
name: null,
},
null,
key
key,
);
switch (this.type) {

View File

@@ -26,7 +26,7 @@ export class SendFile extends Domain {
sizeName: null,
fileName: null,
},
["id", "sizeName"]
["id", "sizeName"],
);
}
@@ -37,7 +37,7 @@ export class SendFile extends Domain {
fileName: null,
},
null,
key
key,
);
return view;
}

View File

@@ -22,7 +22,7 @@ export class SendText extends Domain {
{
text: null,
},
[]
[],
);
}
@@ -33,7 +33,7 @@ export class SendText extends Domain {
text: null,
},
null,
key
key,
);
}
}

View File

@@ -50,7 +50,7 @@ export class SortedCiphersCache {
setTimeout(() => {
this.sortedCiphersByUrl.delete(url);
this.timeouts.delete(url);
}, CacheTTL)
}, CacheTTL),
);
}
}
@@ -68,7 +68,7 @@ class Ciphers {
getLastLaunched() {
const usedCiphers = this.ciphers.filter((cipher) => cipher.localData?.lastLaunched);
const sortedCiphers = usedCiphers.sort(
(x, y) => y.localData.lastLaunched.valueOf() - x.localData.lastLaunched.valueOf()
(x, y) => y.localData.lastLaunched.valueOf() - x.localData.lastLaunched.valueOf(),
);
return sortedCiphers[0];
}

View File

@@ -3,7 +3,7 @@ import { GlobalState } from "./globalState";
export class State<
TGlobalState extends GlobalState = GlobalState,
TAccount extends Account = Account
TAccount extends Account = Account,
> {
accounts: { [userId: string]: TAccount } = {};
globals: TGlobalState;

View File

@@ -13,7 +13,7 @@ export class SetKeyConnectorKeyRequest {
kdf: KdfType,
kdfIterations: number,
orgIdentifier: string,
keys: KeysRequest
keys: KeysRequest,
) {
this.key = key;
this.kdf = kdf;

View File

@@ -8,7 +8,7 @@ export class ApiTokenRequest extends TokenRequest {
public clientId: string,
public clientSecret: string,
protected twoFactor: TokenRequestTwoFactor,
device?: DeviceRequest
device?: DeviceRequest,
) {
super(twoFactor, device);
}

View File

@@ -12,7 +12,7 @@ export class PasswordTokenRequest extends TokenRequest implements CaptchaProtect
public masterPasswordHash: string,
public captchaResponse: string,
protected twoFactor: TokenRequestTwoFactor,
device?: DeviceRequest
device?: DeviceRequest,
) {
super(twoFactor, device);
}

View File

@@ -9,7 +9,7 @@ export class SsoTokenRequest extends TokenRequest {
public codeVerifier: string,
public redirectUri: string,
protected twoFactor: TokenRequestTwoFactor,
device?: DeviceRequest
device?: DeviceRequest,
) {
super(twoFactor, device);
}

View File

@@ -5,7 +5,10 @@ import { TokenRequestTwoFactor } from "./tokenRequestTwoFactor";
export abstract class TokenRequest {
protected device?: DeviceRequest;
constructor(protected twoFactor: TokenRequestTwoFactor, device?: DeviceRequest) {
constructor(
protected twoFactor: TokenRequestTwoFactor,
device?: DeviceRequest,
) {
this.device = device != null ? device : null;
}

View File

@@ -4,6 +4,6 @@ export class TokenRequestTwoFactor {
constructor(
public provider: TwoFactorProviderType = null,
public token: string = null,
public remember: boolean = false
public remember: boolean = false,
) {}
}

View File

@@ -16,7 +16,7 @@ export class OrganizationImportRequest {
overwriteExisting: boolean;
largeImport: boolean;
}
| ImportDirectoryRequest
| ImportDirectoryRequest,
) {
if (model instanceof ImportDirectoryRequest) {
this.groups = model.groups.map((g) => new OrganizationImportGroupRequest(g));

View File

@@ -1,3 +1,6 @@
export class OrganizationSubscriptionUpdateRequest {
constructor(public seatAdjustment: number, public maxAutoscaleSeats?: number) {}
constructor(
public seatAdjustment: number,
public maxAutoscaleSeats?: number,
) {}
}

View File

@@ -3,6 +3,6 @@ import { OrganizationCreateRequest } from "../organizationCreateRequest";
export class ProviderOrganizationCreateRequest {
constructor(
public clientOwnerEmail: string,
public organizationCreateRequest: OrganizationCreateRequest
public organizationCreateRequest: OrganizationCreateRequest,
) {}
}

View File

@@ -19,7 +19,7 @@ export class RegisterRequest implements CaptchaProtectedRequest {
public kdf: KdfType,
public kdfIterations: number,
public referenceData: ReferenceEventRequest,
public captchaResponse: string
public captchaResponse: string,
) {
this.masterPasswordHint = masterPasswordHint ? masterPasswordHint : null;
}

View File

@@ -18,7 +18,7 @@ export class SetPasswordRequest {
kdf: KdfType,
kdfIterations: number,
orgIdentifier: string,
keys: KeysRequest
keys: KeysRequest,
) {
this.masterPasswordHash = masterPasswordHash;
this.key = key;

View File

@@ -8,7 +8,7 @@ export abstract class BaseResponse {
protected getResponseProperty(
propertyName: string,
response: any = null,
exactName = false
exactName = false,
): any {
if (propertyName == null || propertyName === "") {
throw new Error("propertyName must not be null/empty.");

View File

@@ -11,7 +11,7 @@ export class DomainsResponse extends BaseResponse {
const globalEquivalentDomains = this.getResponseProperty("GlobalEquivalentDomains");
if (globalEquivalentDomains != null) {
this.globalEquivalentDomains = globalEquivalentDomains.map(
(d: any) => new GlobalDomainResponse(d)
(d: any) => new GlobalDomainResponse(d),
);
} else {
this.globalEquivalentDomains = [];

View File

@@ -48,7 +48,7 @@ export class ProfileResponse extends BaseResponse {
const providerOrganizations = this.getResponseProperty("ProviderOrganizations");
if (providerOrganizations != null) {
this.providerOrganizations = providerOrganizations.map(
(o: any) => new ProfileProviderOrganizationResponse(o)
(o: any) => new ProfileProviderOrganizationResponse(o),
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@ const PwnedPasswordsApi = "https://api.pwnedpasswords.com/range/";
export class AuditService implements AuditServiceAbstraction {
constructor(
private cryptoFunctionService: CryptoFunctionService,
private apiService: ApiService
private apiService: ApiService,
) {}
@throttle(100, () => "passwordLeaked")

View File

@@ -55,11 +55,11 @@ export class AuthService implements AuthServiceAbstraction {
protected environmentService: EnvironmentService,
protected stateService: StateService,
protected twoFactorService: TwoFactorService,
protected i18nService: I18nService
protected i18nService: I18nService,
) {}
async logIn(
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials,
): Promise<AuthResult> {
this.clearState();
@@ -76,7 +76,7 @@ export class AuthService implements AuthServiceAbstraction {
this.logService,
this.stateService,
this.twoFactorService,
this
this,
);
} else if (credentials.type === AuthenticationType.Sso) {
strategy = new SsoLogInStrategy(
@@ -89,7 +89,7 @@ export class AuthService implements AuthServiceAbstraction {
this.logService,
this.stateService,
this.twoFactorService,
this.keyConnectorService
this.keyConnectorService,
);
} else if (credentials.type === AuthenticationType.Api) {
strategy = new ApiLogInStrategy(
@@ -103,7 +103,7 @@ export class AuthService implements AuthServiceAbstraction {
this.stateService,
this.twoFactorService,
this.environmentService,
this.keyConnectorService
this.keyConnectorService,
);
}
@@ -117,7 +117,7 @@ export class AuthService implements AuthServiceAbstraction {
async logInTwoFactor(
twoFactor: TokenRequestTwoFactor,
captchaResponse: string
captchaResponse: string,
): Promise<AuthResult> {
if (this.logInStrategy == null) {
throw new Error(this.i18nService.t("sessionTimeout"));

View File

@@ -40,7 +40,7 @@ export class AzureFileUploadService {
private async azureUploadBlocks(
url: string,
data: EncArrayBuffer,
renewalCallback: () => Promise<string>
renewalCallback: () => Promise<string>,
) {
const baseUrl = Utils.getUrl(url);
const blockSize = this.getMaxBlockSize(baseUrl.searchParams.get("sv"));
@@ -50,7 +50,7 @@ export class AzureFileUploadService {
if (numBlocks > MAX_BLOCKS_PER_BLOB) {
throw new Error(
`Cannot upload file, exceeds maximum size of ${blockSize * MAX_BLOCKS_PER_BLOB}`
`Cannot upload file, exceeds maximum size of ${blockSize * MAX_BLOCKS_PER_BLOB}`,
);
}
@@ -120,7 +120,7 @@ export class AzureFileUploadService {
private async renewUrlIfNecessary(
url: string,
renewalCallback: () => Promise<string>
renewalCallback: () => Promise<string>,
): Promise<string> {
const urlObject = Utils.getUrl(url);
const expiry = new Date(urlObject.searchParams.get("se") ?? "");

View File

@@ -8,7 +8,7 @@ export class BitwardenFileUploadService {
async upload(
encryptedFileName: string,
encryptedFileData: EncArrayBuffer,
apiCall: (fd: FormData) => Promise<any>
apiCall: (fd: FormData) => Promise<any>,
) {
const fd = new FormData();
try {
@@ -22,7 +22,7 @@ export class BitwardenFileUploadService {
{
filepath: encryptedFileName,
contentType: "application/octet-stream",
} as any
} as any,
);
} else {
throw e;

View File

@@ -50,7 +50,7 @@ const DomainMatchBlacklist = new Map<string, Set<string>>([
export class CipherService implements CipherServiceAbstraction {
private sortedCiphersCache: SortedCiphersCache = new SortedCiphersCache(
this.sortCiphersByLastUsed
this.sortCiphersByLastUsed,
);
constructor(
@@ -61,7 +61,7 @@ export class CipherService implements CipherServiceAbstraction {
private i18nService: I18nService,
private searchService: () => SearchService,
private logService: LogService,
private stateService: StateService
private stateService: StateService,
) {}
async getDecryptedCipherCache(): Promise<CipherView[]> {
@@ -87,7 +87,7 @@ export class CipherService implements CipherServiceAbstraction {
async encrypt(
model: CipherView,
key?: SymmetricCryptoKey,
originalCipher: Cipher = null
originalCipher: Cipher = null,
): Promise<Cipher> {
// Adjust password history
if (model.id != null) {
@@ -118,13 +118,13 @@ export class CipherService implements CipherServiceAbstraction {
f.name != null &&
f.name !== "" &&
f.value != null &&
f.value !== ""
f.value !== "",
);
const hiddenFields =
model.fields == null
? []
: model.fields.filter(
(f) => f.type === FieldType.Hidden && f.name != null && f.name !== ""
(f) => f.type === FieldType.Hidden && f.name != null && f.name !== "",
);
existingHiddenFields.forEach((ef) => {
const matchedField = hiddenFields.find((f) => f.name === ef.name);
@@ -169,7 +169,7 @@ export class CipherService implements CipherServiceAbstraction {
name: null,
notes: null,
},
key
key,
),
this.encryptCipherData(cipher, model, key),
this.encryptFields(model.fields, key).then((fields) => {
@@ -188,7 +188,7 @@ export class CipherService implements CipherServiceAbstraction {
async encryptAttachments(
attachmentsModel: AttachmentView[],
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): Promise<Attachment[]> {
if (attachmentsModel == null || attachmentsModel.length === 0) {
return null;
@@ -208,7 +208,7 @@ export class CipherService implements CipherServiceAbstraction {
{
fileName: null,
},
key
key,
).then(async () => {
if (model.key != null) {
attachment.key = await this.cryptoService.encrypt(model.key.key, key);
@@ -254,7 +254,7 @@ export class CipherService implements CipherServiceAbstraction {
name: null,
value: null,
},
key
key,
);
return field;
@@ -262,7 +262,7 @@ export class CipherService implements CipherServiceAbstraction {
async encryptPasswordHistories(
phModels: PasswordHistoryView[],
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): Promise<Password[]> {
if (!phModels || !phModels.length) {
return null;
@@ -281,7 +281,7 @@ export class CipherService implements CipherServiceAbstraction {
async encryptPasswordHistory(
phModel: PasswordHistoryView,
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): Promise<Password> {
const ph = new Password();
ph.lastUsedDate = phModel.lastUsedDate;
@@ -292,7 +292,7 @@ export class CipherService implements CipherServiceAbstraction {
{
password: null,
},
key
key,
);
return ph;
@@ -377,7 +377,7 @@ export class CipherService implements CipherServiceAbstraction {
async getAllDecryptedForUrl(
url: string,
includeOtherTypes?: CipherType[],
defaultMatch: UriMatchType = null
defaultMatch: UriMatchType = null,
): Promise<CipherView[]> {
if (url == null && includeOtherTypes == null) {
return Promise.resolve([]);
@@ -608,7 +608,7 @@ export class CipherService implements CipherServiceAbstraction {
const data = new CipherData(
response,
await this.stateService.getUserId(),
cipher.collectionIds
cipher.collectionIds,
);
await this.upsert(data);
}
@@ -616,14 +616,14 @@ export class CipherService implements CipherServiceAbstraction {
async shareWithServer(
cipher: CipherView,
organizationId: string,
collectionIds: string[]
collectionIds: string[],
): Promise<any> {
const attachmentPromises: Promise<any>[] = [];
if (cipher.attachments != null) {
cipher.attachments.forEach((attachment) => {
if (attachment.key == null) {
attachmentPromises.push(
this.shareAttachmentWithServer(attachment, cipher.id, organizationId)
this.shareAttachmentWithServer(attachment, cipher.id, organizationId),
);
}
});
@@ -642,7 +642,7 @@ export class CipherService implements CipherServiceAbstraction {
async shareManyWithServer(
ciphers: CipherView[],
organizationId: string,
collectionIds: string[]
collectionIds: string[],
): Promise<any> {
const promises: Promise<any>[] = [];
const encCiphers: Cipher[] = [];
@@ -652,7 +652,7 @@ export class CipherService implements CipherServiceAbstraction {
promises.push(
this.encrypt(cipher).then((c) => {
encCiphers.push(c);
})
}),
);
}
await Promise.all(promises);
@@ -680,7 +680,7 @@ export class CipherService implements CipherServiceAbstraction {
cipher,
unencryptedFile.name,
evt.target.result,
admin
admin,
);
resolve(cData);
} catch (e) {
@@ -697,7 +697,7 @@ export class CipherService implements CipherServiceAbstraction {
cipher: Cipher,
filename: string,
data: ArrayBuffer,
admin = false
admin = false,
): Promise<Cipher> {
const key = await this.cryptoService.getOrgKey(cipher.organizationId);
const encFileName = await this.cryptoService.encrypt(filename, key);
@@ -720,7 +720,7 @@ export class CipherService implements CipherServiceAbstraction {
admin,
uploadDataResponse,
encFileName,
encData
encData,
);
} catch (e) {
if (
@@ -732,7 +732,7 @@ export class CipherService implements CipherServiceAbstraction {
cipher.id,
encFileName,
encData,
dataEncKey[1]
dataEncKey[1],
);
} else if (e instanceof ErrorResponse) {
throw new Error((e as ErrorResponse).getSingleMessage());
@@ -744,7 +744,7 @@ export class CipherService implements CipherServiceAbstraction {
const cData = new CipherData(
response,
await this.stateService.getUserId(),
cipher.collectionIds
cipher.collectionIds,
);
if (!admin) {
await this.upsert(cData);
@@ -761,7 +761,7 @@ export class CipherService implements CipherServiceAbstraction {
cipherId: string,
encFileName: EncString,
encData: EncArrayBuffer,
key: EncString
key: EncString,
) {
const fd = new FormData();
try {
@@ -777,7 +777,7 @@ export class CipherService implements CipherServiceAbstraction {
{
filepath: encFileName.encryptedString,
contentType: "application/octet-stream",
} as any
} as any,
);
} else {
throw e;
@@ -1014,7 +1014,7 @@ export class CipherService implements CipherServiceAbstraction {
}
async restore(
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[]
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[],
) {
const ciphers = await this.stateService.getEncryptedCiphers();
if (ciphers == null) {
@@ -1058,10 +1058,10 @@ export class CipherService implements CipherServiceAbstraction {
private async shareAttachmentWithServer(
attachmentView: AttachmentView,
cipherId: string,
organizationId: string
organizationId: string,
): Promise<any> {
const attachmentResponse = await this.apiService.nativeFetch(
new Request(attachmentView.url, { cache: "no-store" })
new Request(attachmentView.url, { cache: "no-store" }),
);
if (attachmentResponse.status !== 200) {
throw Error("Failed to download attachment: " + attachmentResponse.status.toString());
@@ -1089,7 +1089,7 @@ export class CipherService implements CipherServiceAbstraction {
{
filepath: encFileName.encryptedString,
contentType: "application/octet-stream",
} as any
} as any,
);
} else {
throw e;
@@ -1101,7 +1101,7 @@ export class CipherService implements CipherServiceAbstraction {
cipherId,
attachmentView.id,
fd,
organizationId
organizationId,
);
} catch (e) {
throw new Error((e as ErrorResponse).getSingleMessage());
@@ -1112,7 +1112,7 @@ export class CipherService implements CipherServiceAbstraction {
model: V,
obj: D,
map: any,
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): Promise<void> {
const promises = [];
const self = this;
@@ -1156,7 +1156,7 @@ export class CipherService implements CipherServiceAbstraction {
password: null,
totp: null,
},
key
key,
);
if (model.login.uris != null) {
@@ -1170,7 +1170,7 @@ export class CipherService implements CipherServiceAbstraction {
{
uri: null,
},
key
key,
);
cipher.login.uris.push(loginUri);
}
@@ -1193,7 +1193,7 @@ export class CipherService implements CipherServiceAbstraction {
expYear: null,
code: null,
},
key
key,
);
return;
case CipherType.Identity:
@@ -1221,7 +1221,7 @@ export class CipherService implements CipherServiceAbstraction {
passportNumber: null,
licenseNumber: null,
},
key
key,
);
return;
default:
@@ -1233,7 +1233,7 @@ export class CipherService implements CipherServiceAbstraction {
url: string,
lastUsed: boolean,
lastLaunched: boolean,
autofillOnPageLoad: boolean
autofillOnPageLoad: boolean,
): Promise<CipherView> {
const cacheKey = autofillOnPageLoad ? "autofillOnPageLoad-" + url : url;
@@ -1248,7 +1248,7 @@ export class CipherService implements CipherServiceAbstraction {
ciphers = ciphers.filter(
(cipher) =>
cipher.login.autofillOnPageLoad ||
(cipher.login.autofillOnPageLoad == null && autofillOnPageLoadDefault !== false)
(cipher.login.autofillOnPageLoad == null && autofillOnPageLoadDefault !== false),
);
if (ciphers.length === 0) {
return null;

View File

@@ -15,7 +15,7 @@ export class CollectionService implements CollectionServiceAbstraction {
constructor(
private cryptoService: CryptoService,
private i18nService: I18nService,
private stateService: StateService
private stateService: StateService,
) {}
async clearCache(userId?: string): Promise<void> {

View File

@@ -8,7 +8,7 @@ export class ConsoleLogService implements LogServiceAbstraction {
constructor(
protected isDev: boolean,
protected filter: (level: LogLevelType) => boolean = null
protected filter: (level: LogLevelType) => boolean = null,
) {}
debug(message: string) {

View File

@@ -25,7 +25,7 @@ export class CryptoService implements CryptoServiceAbstraction {
private cryptoFunctionService: CryptoFunctionService,
protected platformUtilService: PlatformUtilsService,
protected logService: LogService,
protected stateService: StateService
protected stateService: StateService,
) {}
async setKey(key: SymmetricCryptoKey, userId?: string): Promise<any> {
@@ -57,7 +57,7 @@ export class CryptoService implements CryptoServiceAbstraction {
async setOrgKeys(
orgs: ProfileOrganizationResponse[],
providerOrgs: ProfileProviderOrganizationResponse[]
providerOrgs: ProfileProviderOrganizationResponse[],
): Promise<void> {
const orgKeys: any = {};
orgs.forEach((org) => {
@@ -105,7 +105,7 @@ export class CryptoService implements CryptoServiceAbstraction {
async getKeyFromStorage(
keySuffix: KeySuffixOptions,
userId?: string
userId?: string,
): Promise<SymmetricCryptoKey> {
const key = await this.retrieveKeyFromStorage(keySuffix, userId);
if (key != null) {
@@ -132,7 +132,7 @@ export class CryptoService implements CryptoServiceAbstraction {
const localKeyHash = await this.hashPassword(
masterPassword,
key,
HashPurpose.LocalAuthorization
HashPurpose.LocalAuthorization,
);
if (localKeyHash != null && storedKeyHash === localKeyHash) {
return true;
@@ -142,7 +142,7 @@ export class CryptoService implements CryptoServiceAbstraction {
const serverKeyHash = await this.hashPassword(
masterPassword,
key,
HashPurpose.ServerAuthorization
HashPurpose.ServerAuthorization,
);
if (serverKeyHash != null && storedKeyHash === serverKeyHash) {
await this.setKeyHash(localKeyHash);
@@ -202,7 +202,7 @@ export class CryptoService implements CryptoServiceAbstraction {
keyFingerprint,
userId,
32,
"sha256"
"sha256",
);
return this.hashPhrase(userFingerprint);
}
@@ -400,7 +400,7 @@ export class CryptoService implements CryptoServiceAbstraction {
password: string,
salt: string,
kdf: KdfType,
kdfIterations: number
kdfIterations: number,
): Promise<SymmetricCryptoKey> {
let key: ArrayBuffer = null;
if (kdf == null || kdf === KdfType.PBKDF2_SHA256) {
@@ -421,7 +421,7 @@ export class CryptoService implements CryptoServiceAbstraction {
salt: string,
kdf: KdfType,
kdfIterations: number,
protectedKeyCs: EncString = null
protectedKeyCs: EncString = null,
): Promise<SymmetricCryptoKey> {
if (protectedKeyCs == null) {
const pinProtectedKey = await this.stateService.getEncryptedPinProtected();
@@ -453,7 +453,7 @@ export class CryptoService implements CryptoServiceAbstraction {
pin: string,
salt: string,
kdf: KdfType,
kdfIterations: number
kdfIterations: number,
): Promise<SymmetricCryptoKey> {
const pinKey = await this.makeKey(pin, salt, kdf, kdfIterations);
return await this.stretchKey(pinKey);
@@ -465,7 +465,7 @@ export class CryptoService implements CryptoServiceAbstraction {
"bitwarden-send",
"send",
64,
"sha256"
"sha256",
);
return new SymmetricCryptoKey(sendKey);
}
@@ -473,7 +473,7 @@ export class CryptoService implements CryptoServiceAbstraction {
async hashPassword(
password: string,
key: SymmetricCryptoKey,
hashPurpose?: HashPurpose
hashPurpose?: HashPurpose,
): Promise<string> {
if (key == null) {
key = await this.getKey();
@@ -495,7 +495,7 @@ export class CryptoService implements CryptoServiceAbstraction {
async remakeEncKey(
key: SymmetricCryptoKey,
encKey?: SymmetricCryptoKey
encKey?: SymmetricCryptoKey,
): Promise<[SymmetricCryptoKey, EncString]> {
if (encKey == null) {
encKey = await this.getEncKey();
@@ -623,7 +623,7 @@ export class CryptoService implements CryptoServiceAbstraction {
encString.data,
encString.iv,
encString.mac,
key
key,
);
}
@@ -668,7 +668,7 @@ export class CryptoService implements CryptoServiceAbstraction {
ctBytes.buffer,
ivBytes.buffer,
macBytes != null ? macBytes.buffer : null,
key
key,
);
}
@@ -775,7 +775,7 @@ export class CryptoService implements CryptoServiceAbstraction {
data: string,
iv: string,
mac: string,
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): Promise<string> {
const keyForEnc = await this.getKeyForEncryption(key);
const theKey = await this.resolveLegacyKey(encType, keyForEnc);
@@ -795,7 +795,7 @@ export class CryptoService implements CryptoServiceAbstraction {
const computedMac = await this.cryptoFunctionService.hmacFast(
fastParams.macData,
fastParams.macKey,
"sha256"
"sha256",
);
const macsEqual = await this.cryptoFunctionService.compareFast(fastParams.mac, computedMac);
if (!macsEqual) {
@@ -812,7 +812,7 @@ export class CryptoService implements CryptoServiceAbstraction {
data: ArrayBuffer,
iv: ArrayBuffer,
mac: ArrayBuffer,
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): Promise<ArrayBuffer> {
const keyForEnc = await this.getKeyForEncryption(key);
const theKey = await this.resolveLegacyKey(encType, keyForEnc);
@@ -832,7 +832,7 @@ export class CryptoService implements CryptoServiceAbstraction {
const computedMac = await this.cryptoFunctionService.hmac(
macData.buffer,
theKey.macKey,
"sha256"
"sha256",
);
if (computedMac === null) {
return null;
@@ -863,7 +863,7 @@ export class CryptoService implements CryptoServiceAbstraction {
private async resolveLegacyKey(
encType: EncryptionType,
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): Promise<SymmetricCryptoKey> {
if (
encType === EncryptionType.AesCbc128_HmacSha256_B64 &&
@@ -912,7 +912,7 @@ export class CryptoService implements CryptoServiceAbstraction {
private async buildEncKey(
key: SymmetricCryptoKey,
encKey: ArrayBuffer
encKey: ArrayBuffer,
): Promise<[SymmetricCryptoKey, EncString]> {
let encKeyEnc: EncString = null;
if (key.key.byteLength === 32) {

View File

@@ -27,7 +27,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
distinctUntilChanged((oldUserId: string, newUserId: string) => oldUserId == newUserId),
concatMap(async () => {
await this.setUrlsFromStorage();
})
}),
)
.subscribe();
}

View File

@@ -16,7 +16,7 @@ export class EventService implements EventServiceAbstraction {
private cipherService: CipherService,
private stateService: StateService,
private logService: LogService,
private organizationService: OrganizationService
private organizationService: OrganizationService,
) {}
init(checkOnInterval: boolean) {
@@ -34,7 +34,7 @@ export class EventService implements EventServiceAbstraction {
async collect(
eventType: EventType,
cipherId: string = null,
uploadImmediately = false
uploadImmediately = false,
): Promise<any> {
const authed = await this.stateService.getIsAuthenticated();
if (!authed) {

View File

@@ -14,7 +14,10 @@ export class FileUploadService implements FileUploadServiceAbstraction {
private azureFileUploadService: AzureFileUploadService;
private bitwardenFileUploadService: BitwardenFileUploadService;
constructor(private logService: LogService, private apiService: ApiService) {
constructor(
private logService: LogService,
private apiService: ApiService,
) {
this.azureFileUploadService = new AzureFileUploadService(logService);
this.bitwardenFileUploadService = new BitwardenFileUploadService(apiService);
}
@@ -22,7 +25,7 @@ export class FileUploadService implements FileUploadServiceAbstraction {
async uploadSendFile(
uploadData: SendFileUploadDataResponse,
fileName: EncString,
encryptedFileData: EncArrayBuffer
encryptedFileData: EncArrayBuffer,
) {
try {
switch (uploadData.fileUploadType) {
@@ -34,22 +37,22 @@ export class FileUploadService implements FileUploadServiceAbstraction {
this.apiService.postSendFile(
uploadData.sendResponse.id,
uploadData.sendResponse.file.id,
fd
)
fd,
),
);
break;
case FileUploadType.Azure: {
const renewalCallback = async () => {
const renewalResponse = await this.apiService.renewSendFileUploadUrl(
uploadData.sendResponse.id,
uploadData.sendResponse.file.id
uploadData.sendResponse.file.id,
);
return renewalResponse.url;
};
await this.azureFileUploadService.upload(
uploadData.url,
encryptedFileData,
renewalCallback
renewalCallback,
);
break;
}
@@ -66,7 +69,7 @@ export class FileUploadService implements FileUploadServiceAbstraction {
admin: boolean,
uploadData: AttachmentUploadDataResponse,
encryptedFileName: EncString,
encryptedFileData: EncArrayBuffer
encryptedFileData: EncArrayBuffer,
) {
const response = admin ? uploadData.cipherMiniResponse : uploadData.cipherResponse;
try {
@@ -75,21 +78,21 @@ export class FileUploadService implements FileUploadServiceAbstraction {
await this.bitwardenFileUploadService.upload(
encryptedFileName.encryptedString,
encryptedFileData,
(fd) => this.apiService.postAttachmentFile(response.id, uploadData.attachmentId, fd)
(fd) => this.apiService.postAttachmentFile(response.id, uploadData.attachmentId, fd),
);
break;
case FileUploadType.Azure: {
const renewalCallback = async () => {
const renewalResponse = await this.apiService.renewAttachmentUploadUrl(
response.id,
uploadData.attachmentId
uploadData.attachmentId,
);
return renewalResponse.url;
};
await this.azureFileUploadService.upload(
uploadData.url,
encryptedFileData,
renewalCallback
renewalCallback,
);
break;
}

View File

@@ -23,7 +23,7 @@ export class FolderService implements FolderServiceAbstraction {
private apiService: ApiService,
private i18nService: I18nService,
private cipherService: CipherService,
private stateService: StateService
private stateService: StateService,
) {}
async clearCache(userId?: string): Promise<void> {

Some files were not shown because too many files have changed in this diff Show More