From 9c88e66a27efbb966abf87dec6d986e00bf999da Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Sat, 27 Jan 2024 15:56:40 -0600 Subject: [PATCH] Upgrade prettier (#409) --- .../src/components/callout.component.html | 6 +- .../src/components/environment.component.ts | 2 +- .../angular/src/components/icon.component.ts | 5 +- .../modal/dynamic-modal.component.ts | 4 +- .../src/components/modal/modal-injector.ts | 7 +- .../components/password-reprompt.component.ts | 4 +- .../src/components/toastr.component.ts | 5 +- .../src/directives/a11y-title.directive.ts | 5 +- .../src/directives/api-action.directive.ts | 4 +- .../src/directives/autofocus.directive.ts | 5 +- .../src/directives/box-row.directive.ts | 6 +- .../src/scss/bwicons/styles/style.scss | 3 +- .../src/services/auth-guard.service.ts | 2 +- .../src/services/jslib-services.module.ts | 28 +- .../src/services/lock-guard.service.ts | 2 +- jslib/angular/src/services/modal.service.ts | 12 +- .../src/services/passwordReprompt.service.ts | 2 +- .../src/services/unauth-guard.service.ts | 2 +- .../src/services/validation.service.ts | 2 +- .../logInStrategies/apiLogIn.strategy.spec.ts | 4 +- .../logInStrategies/logIn.strategy.spec.ts | 16 +- .../passwordLogIn.strategy.spec.ts | 8 +- .../logInStrategies/ssoLogIn.strategy.spec.ts | 4 +- .../spec/services/cipher.service.spec.ts | 2 +- .../spec/services/stateMigration.service.ts | 4 +- jslib/common/spec/utils.ts | 2 +- jslib/common/src/abstractions/api.service.ts | 134 ++--- jslib/common/src/abstractions/auth.service.ts | 4 +- .../common/src/abstractions/cipher.service.ts | 14 +- .../common/src/abstractions/crypto.service.ts | 12 +- .../abstractions/cryptoFunction.service.ts | 18 +- .../src/abstractions/fileUpload.service.ts | 4 +- .../src/abstractions/keyConnector.service.ts | 2 +- .../passwordGeneration.service.ts | 2 +- .../src/abstractions/platformUtils.service.ts | 6 +- .../common/src/abstractions/policy.service.ts | 6 +- .../common/src/abstractions/search.service.ts | 2 +- jslib/common/src/abstractions/send.service.ts | 2 +- .../common/src/abstractions/state.service.ts | 32 +- .../common/src/abstractions/token.service.ts | 2 +- .../abstractions/userVerification.service.ts | 2 +- jslib/common/src/factories/stateFactory.ts | 4 +- jslib/common/src/misc/captcha_iframe.ts | 6 +- jslib/common/src/misc/iframe_component.ts | 4 +- .../src/misc/linkedFieldOption.decorator.ts | 5 +- .../misc/logInStrategies/apiLogin.strategy.ts | 6 +- .../misc/logInStrategies/logIn.strategy.ts | 10 +- .../logInStrategies/passwordLogin.strategy.ts | 10 +- .../misc/logInStrategies/ssoLogin.strategy.ts | 6 +- jslib/common/src/misc/serviceUtils.ts | 8 +- jslib/common/src/misc/throttle.ts | 2 +- jslib/common/src/misc/utils.ts | 11 +- jslib/common/src/misc/webauthn_iframe.ts | 6 +- jslib/common/src/models/api/ssoConfigApi.ts | 4 +- jslib/common/src/models/domain/attachment.ts | 6 +- jslib/common/src/models/domain/card.ts | 4 +- jslib/common/src/models/domain/cipher.ts | 4 +- jslib/common/src/models/domain/collection.ts | 4 +- jslib/common/src/models/domain/domainBase.ts | 6 +- jslib/common/src/models/domain/encString.ts | 2 +- jslib/common/src/models/domain/field.ts | 6 +- jslib/common/src/models/domain/folder.ts | 4 +- jslib/common/src/models/domain/identity.ts | 4 +- .../src/models/domain/logInCredentials.ts | 9 +- jslib/common/src/models/domain/login.ts | 4 +- jslib/common/src/models/domain/loginUri.ts | 6 +- jslib/common/src/models/domain/password.ts | 2 +- jslib/common/src/models/domain/send.ts | 4 +- jslib/common/src/models/domain/sendAccess.ts | 4 +- jslib/common/src/models/domain/sendFile.ts | 4 +- jslib/common/src/models/domain/sendText.ts | 4 +- .../src/models/domain/sortedCiphersCache.ts | 4 +- jslib/common/src/models/domain/state.ts | 2 +- .../account/setKeyConnectorKeyRequest.ts | 2 +- .../request/identityToken/apiTokenRequest.ts | 2 +- .../identityToken/passwordTokenRequest.ts | 2 +- .../request/identityToken/ssoTokenRequest.ts | 2 +- .../request/identityToken/tokenRequest.ts | 5 +- .../identityToken/tokenRequestTwoFactor.ts | 2 +- .../request/organizationImportRequest.ts | 2 +- .../organizationSubscriptionUpdateRequest.ts | 5 +- .../providerOrganizationCreateRequest.ts | 2 +- .../src/models/request/registerRequest.ts | 2 +- .../src/models/request/setPasswordRequest.ts | 2 +- .../src/models/response/baseResponse.ts | 2 +- .../src/models/response/domainsResponse.ts | 2 +- .../src/models/response/profileResponse.ts | 2 +- jslib/common/src/services/api.service.ts | 334 ++++++------ jslib/common/src/services/audit.service.ts | 2 +- jslib/common/src/services/auth.service.ts | 12 +- .../src/services/azureFileUpload.service.ts | 14 +- .../services/bitwardenFileUpload.service.ts | 4 +- jslib/common/src/services/cipher.service.ts | 74 +-- .../common/src/services/collection.service.ts | 2 +- .../common/src/services/consoleLog.service.ts | 2 +- jslib/common/src/services/crypto.service.ts | 40 +- .../src/services/environment.service.ts | 2 +- jslib/common/src/services/event.service.ts | 4 +- .../common/src/services/fileUpload.service.ts | 23 +- jslib/common/src/services/folder.service.ts | 2 +- jslib/common/src/services/i18n.service.ts | 4 +- .../src/services/keyConnector.service.ts | 10 +- .../src/services/notifications.service.ts | 10 +- .../src/services/organization.service.ts | 2 +- .../services/passwordGeneration.service.ts | 8 +- jslib/common/src/services/policy.service.ts | 14 +- jslib/common/src/services/search.service.ts | 4 +- jslib/common/src/services/send.service.ts | 18 +- jslib/common/src/services/state.service.ts | 488 +++++++++--------- .../src/services/stateMigration.service.ts | 18 +- jslib/common/src/services/sync.service.ts | 2 +- jslib/common/src/services/system.service.ts | 2 +- jslib/common/src/services/token.service.ts | 2 +- jslib/common/src/services/totp.service.ts | 4 +- .../common/src/services/twoFactor.service.ts | 2 +- .../src/services/userVerification.service.ts | 6 +- .../services/usernameGeneration.service.ts | 5 +- .../src/services/vaultTimeout.service.ts | 2 +- jslib/electron/src/baseMenu.ts | 5 +- .../src/services/electronCrypto.service.ts | 4 +- .../src/services/electronLog.service.ts | 5 +- .../services/electronMainMessaging.service.ts | 9 +- .../services/electronPlatformUtils.service.ts | 8 +- jslib/electron/src/tray.main.ts | 4 +- jslib/electron/src/updater.main.ts | 4 +- jslib/electron/src/window.main.ts | 6 +- .../nodeCryptoFunction.service.spec.ts | 40 +- jslib/node/src/cli/baseProgram.ts | 4 +- jslib/node/src/cli/commands/login.command.ts | 42 +- jslib/node/src/cli/commands/logout.command.ts | 2 +- jslib/node/src/cli/commands/update.command.ts | 4 +- jslib/node/src/cli/models/response.ts | 4 +- .../cli/services/cliPlatformUtils.service.ts | 9 +- .../node/src/services/lowdbStorage.service.ts | 8 +- jslib/node/src/services/nodeApi.service.ts | 4 +- .../services/nodeCryptoFunction.service.ts | 20 +- package-lock.json | 12 +- package.json | 3 +- scripts/sign.js | 2 +- src/abstractions/state.service.ts | 4 +- src/app/accounts/apiKey.component.ts | 14 +- src/app/accounts/environment.component.ts | 2 +- src/app/app.component.ts | 6 +- src/app/services/auth-guard.service.ts | 5 +- src/app/services/launch-guard.service.ts | 5 +- src/app/services/services.module.ts | 16 +- src/app/tabs/dashboard.component.html | 4 +- src/app/tabs/dashboard.component.ts | 6 +- src/app/tabs/more.component.html | 2 +- src/app/tabs/more.component.ts | 4 +- src/app/tabs/settings.component.ts | 4 +- src/bwdc.ts | 34 +- src/commands/clearCache.command.ts | 5 +- src/commands/config.command.ts | 4 +- src/commands/lastSync.command.ts | 2 +- src/commands/sync.command.ts | 7 +- src/commands/test.command.ts | 7 +- src/index.html | 2 +- src/main.ts | 12 +- src/main/menu.main.ts | 4 +- src/main/messaging.main.ts | 2 +- .../organizationLogIn.strategy.ts | 4 +- src/program.ts | 12 +- src/services/auth.service.ts | 6 +- src/services/azure-directory.service.ts | 14 +- src/services/baseDirectory.service.ts | 2 +- src/services/gsuite-directory.service.ts | 8 +- src/services/i18n.service.ts | 2 +- src/services/ldap-directory.service.ts | 12 +- src/services/lowdbStorage.service.ts | 2 +- src/services/okta-directory.service.ts | 14 +- src/services/onelogin-directory.service.ts | 8 +- src/services/state.service.ts | 86 +-- src/services/stateMigration.service.ts | 8 +- src/services/sync.service.ts | 12 +- src/utils.ts | 2 +- webpack.renderer.js | 2 +- 177 files changed, 1154 insertions(+), 1093 deletions(-) diff --git a/jslib/angular/src/components/callout.component.html b/jslib/angular/src/components/callout.component.html index 55e9510c..a049d5cb 100644 --- a/jslib/angular/src/components/callout.component.html +++ b/jslib/angular/src/components/callout.component.html @@ -12,10 +12,10 @@ {{ enforcedPolicyMessage }} diff --git a/jslib/angular/src/components/environment.component.ts b/jslib/angular/src/components/environment.component.ts index 17fa2ceb..96d77205 100644 --- a/jslib/angular/src/components/environment.component.ts +++ b/jslib/angular/src/components/environment.component.ts @@ -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(); diff --git a/jslib/angular/src/components/icon.component.ts b/jslib/angular/src/components/icon.component.ts index 2fa45197..1af48983 100644 --- a/jslib/angular/src/components/icon.component.ts +++ b/jslib/angular/src/components/icon.component.ts @@ -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(); } diff --git a/jslib/angular/src/components/modal/dynamic-modal.component.ts b/jslib/angular/src/components/modal/dynamic-modal.component.ts index 46ad38c0..c44cf333 100644 --- a/jslib/angular/src/components/modal/dynamic-modal.component.ts +++ b/jslib/angular/src/components/modal/dynamic-modal.component.ts @@ -35,7 +35,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy { private cd: ChangeDetectorRef, private el: ElementRef, 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(); diff --git a/jslib/angular/src/components/modal/modal-injector.ts b/jslib/angular/src/components/modal/modal-injector.ts index da66ea9c..d1f6ac8d 100644 --- a/jslib/angular/src/components/modal/modal-injector.ts +++ b/jslib/angular/src/components/modal/modal-injector.ts @@ -1,12 +1,15 @@ import { InjectFlags, InjectOptions, Injector, ProviderToken } from "@angular/core"; export class ModalInjector implements Injector { - constructor(private _parentInjector: Injector, private _additionalTokens: WeakMap) {} + constructor( + private _parentInjector: Injector, + private _additionalTokens: WeakMap, + ) {} get( token: ProviderToken, notFoundValue: undefined, - options: InjectOptions & { optional?: false } + options: InjectOptions & { optional?: false }, ): T; get(token: ProviderToken, notFoundValue: null, options: InjectOptions): T; get(token: ProviderToken, notFoundValue?: T, options?: InjectOptions | InjectFlags): T; diff --git a/jslib/angular/src/components/password-reprompt.component.ts b/jslib/angular/src/components/password-reprompt.component.ts index ef36218e..0ff6005b 100644 --- a/jslib/angular/src/components/password-reprompt.component.ts +++ b/jslib/angular/src/components/password-reprompt.component.ts @@ -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; } diff --git a/jslib/angular/src/components/toastr.component.ts b/jslib/angular/src/components/toastr.component.ts index 0e4ea4ea..bfe20ed8 100644 --- a/jslib/angular/src/components/toastr.component.ts +++ b/jslib/angular/src/components/toastr.component.ts @@ -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); } } diff --git a/jslib/angular/src/directives/a11y-title.directive.ts b/jslib/angular/src/directives/a11y-title.directive.ts index 20e53a55..a47b00f1 100644 --- a/jslib/angular/src/directives/a11y-title.directive.ts +++ b/jslib/angular/src/directives/a11y-title.directive.ts @@ -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")) { diff --git a/jslib/angular/src/directives/api-action.directive.ts b/jslib/angular/src/directives/api-action.directive.ts index 25dba7f2..51a2b4f0 100644 --- a/jslib/angular/src/directives/api-action.directive.ts +++ b/jslib/angular/src/directives/api-action.directive.ts @@ -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); - } + }, ); } } diff --git a/jslib/angular/src/directives/autofocus.directive.ts b/jslib/angular/src/directives/autofocus.directive.ts index f7b60b1f..0f939a60 100644 --- a/jslib/angular/src/directives/autofocus.directive.ts +++ b/jslib/angular/src/directives/autofocus.directive.ts @@ -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) { diff --git a/jslib/angular/src/directives/box-row.directive.ts b/jslib/angular/src/directives/box-row.directive.ts index 9ae94314..4392f3d0 100644 --- a/jslib/angular/src/directives/box-row.directive.ts +++ b/jslib/angular/src/directives/box-row.directive.ts @@ -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, ); }); } diff --git a/jslib/angular/src/scss/bwicons/styles/style.scss b/jslib/angular/src/scss/bwicons/styles/style.scss index 17a33e10..f1bad514 100644 --- a/jslib/angular/src/scss/bwicons/styles/style.scss +++ b/jslib/angular/src/scss/bwicons/styles/style.scss @@ -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"); diff --git a/jslib/angular/src/services/auth-guard.service.ts b/jslib/angular/src/services/auth-guard.service.ts index ea16b739..ad03159c 100644 --- a/jslib/angular/src/services/auth-guard.service.ts +++ b/jslib/angular/src/services/auth-guard.service.ts @@ -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) { diff --git a/jslib/angular/src/services/jslib-services.module.ts b/jslib/angular/src/services/jslib-services.module.ts index 14dbb4ff..65e91c7c 100644 --- a/jslib/angular/src/services/jslib-services.module.ts +++ b/jslib/angular/src/services/jslib-services.module.ts @@ -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, diff --git a/jslib/angular/src/services/lock-guard.service.ts b/jslib/angular/src/services/lock-guard.service.ts index 926fc521..622e4ab7 100644 --- a/jslib/angular/src/services/lock-guard.service.ts +++ b/jslib/angular/src/services/lock-guard.service.ts @@ -11,7 +11,7 @@ export class LockGuardService implements CanActivate { constructor( private vaultTimeoutService: VaultTimeoutService, private router: Router, - private stateService: StateService + private stateService: StateService, ) {} async canActivate() { diff --git a/jslib/angular/src/services/modal.service.ts b/jslib/angular/src/services/modal.service.ts index aecc84c6..7c06c2e0 100644 --- a/jslib/angular/src/services/modal.service.ts +++ b/jslib/angular/src/services/modal.service.ts @@ -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( componentType: Type, 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( componentType: Type, - componentFactoryResolver: ComponentFactoryResolver + componentFactoryResolver: ComponentFactoryResolver, ): void { this.factoryResolvers.set(componentType, componentFactoryResolver); } @@ -92,7 +92,7 @@ export class ModalService { protected openInternal( componentType: Type, config?: ModalConfig, - attachToDom?: boolean + attachToDom?: boolean, ): [ModalRef, ComponentRef] { 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] { const modalRef = new ModalRef(); diff --git a/jslib/angular/src/services/passwordReprompt.service.ts b/jslib/angular/src/services/passwordReprompt.service.ts index 99db5437..3051780c 100644 --- a/jslib/angular/src/services/passwordReprompt.service.ts +++ b/jslib/angular/src/services/passwordReprompt.service.ts @@ -17,7 +17,7 @@ export class PasswordRepromptService implements PasswordRepromptServiceAbstracti constructor( private modalService: ModalService, - private keyConnectorService: KeyConnectorService + private keyConnectorService: KeyConnectorService, ) {} protectedFields() { diff --git a/jslib/angular/src/services/unauth-guard.service.ts b/jslib/angular/src/services/unauth-guard.service.ts index 264677e7..683efe22 100644 --- a/jslib/angular/src/services/unauth-guard.service.ts +++ b/jslib/angular/src/services/unauth-guard.service.ts @@ -10,7 +10,7 @@ export class UnauthGuardService implements CanActivate { constructor( private vaultTimeoutService: VaultTimeoutService, private router: Router, - private stateService: StateService + private stateService: StateService, ) {} async canActivate() { diff --git a/jslib/angular/src/services/validation.service.ts b/jslib/angular/src/services/validation.service.ts index 85c5a0d5..b0e5516c 100644 --- a/jslib/angular/src/services/validation.service.ts +++ b/jslib/angular/src/services/validation.service.ts @@ -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[] { diff --git a/jslib/common/spec/misc/logInStrategies/apiLogIn.strategy.spec.ts b/jslib/common/spec/misc/logInStrategies/apiLogIn.strategy.spec.ts index 37b19f84..78fa3d01 100644 --- a/jslib/common/spec/misc/logInStrategies/apiLogIn.strategy.spec.ts +++ b/jslib/common/spec/misc/logInStrategies/apiLogIn.strategy.spec.ts @@ -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 ); - }) + }), ); }); diff --git a/jslib/common/spec/misc/logInStrategies/logIn.strategy.spec.ts b/jslib/common/spec/misc/logInStrategies/logIn.strategy.spec.ts index 9cffb31b..c8a90220 100644 --- a/jslib/common/spec/misc/logInStrategies/logIn.strategy.spec.ts +++ b/jslib/common/spec/misc/logInStrategies/logIn.strategy.spec.ts @@ -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 ); - }) + }), ); }); }); diff --git a/jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts b/jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts index 9e95f7f2..e36fde21 100644 --- a/jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts +++ b/jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts @@ -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 ); - }) + }), ); }); diff --git a/jslib/common/spec/misc/logInStrategies/ssoLogIn.strategy.spec.ts b/jslib/common/spec/misc/logInStrategies/ssoLogIn.strategy.spec.ts index 25fc4ba0..eb38fa39 100644 --- a/jslib/common/spec/misc/logInStrategies/ssoLogIn.strategy.spec.ts +++ b/jslib/common/spec/misc/logInStrategies/ssoLogIn.strategy.spec.ts @@ -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 ); - }) + }), ); }); diff --git a/jslib/common/spec/services/cipher.service.spec.ts b/jslib/common/spec/services/cipher.service.spec.ts index f36612f2..5ab62d4f 100644 --- a/jslib/common/spec/services/cipher.service.spec.ts +++ b/jslib/common/spec/services/cipher.service.spec.ts @@ -51,7 +51,7 @@ describe("Cipher Service", () => { i18nService, () => searchService, logService, - stateService + stateService, ); }); diff --git a/jslib/common/spec/services/stateMigration.service.ts b/jslib/common/spec/services/stateMigration.service.ts index 32b65bd7..11d0ec45 100644 --- a/jslib/common/spec/services/stateMigration.service.ts +++ b/jslib/common/spec/services/stateMigration.service.ts @@ -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(), ); }); }); diff --git a/jslib/common/spec/utils.ts b/jslib/common/spec/utils.ts index e16bcb49..56340841 100644 --- a/jslib/common/spec/utils.ts +++ b/jslib/common/spec/utils.ts @@ -16,7 +16,7 @@ export function GetUniqueString(prefix = "") { export function BuildTestObject( def: Partial> | T, - constructor?: new () => T + constructor?: new () => T, ): T { return Object.assign(constructor === null ? {} : new constructor(), def) as T; } diff --git a/jslib/common/src/abstractions/api.service.ts b/jslib/common/src/abstractions/api.service.ts index c9970ce8..18562740 100644 --- a/jslib/common/src/abstractions/api.service.ts +++ b/jslib/common/src/abstractions/api.service.ts @@ -169,7 +169,7 @@ import { SendAccessView } from "../models/view/sendAccessView"; export abstract class ApiService { postIdentityToken: ( - request: PasswordTokenRequest | SsoTokenRequest | ApiTokenRequest + request: PasswordTokenRequest | SsoTokenRequest | ApiTokenRequest, ) => Promise; refreshIdentityToken: () => Promise; @@ -221,7 +221,7 @@ export abstract class ApiService { postSendAccess: ( id: string, request: SendAccessRequest, - apiUrl?: string + apiUrl?: string, ) => Promise; getSends: () => Promise>; postSend: (request: SendRequest) => Promise; @@ -238,7 +238,7 @@ export abstract class ApiService { getSendFileDownloadData: ( send: SendAccessView, request: SendAccessRequest, - apiUrl?: string + apiUrl?: string, ) => Promise; renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise; @@ -247,7 +247,7 @@ export abstract class ApiService { getAttachmentData: ( cipherId: string, attachmentId: string, - emergencyAccessId?: string + emergencyAccessId?: string, ) => Promise; getCiphersOrganization: (organizationId: string) => Promise>; postCipher: (request: CipherRequest) => Promise; @@ -268,7 +268,7 @@ export abstract class ApiService { postImportCiphers: (request: ImportCiphersRequest) => Promise; postImportOrganizationCiphers: ( organizationId: string, - request: ImportOrganizationCiphersRequest + request: ImportOrganizationCiphersRequest, ) => Promise; putDeleteCipher: (id: string) => Promise; putDeleteCipherAdmin: (id: string) => Promise; @@ -277,7 +277,7 @@ export abstract class ApiService { putRestoreCipher: (id: string) => Promise; putRestoreCipherAdmin: (id: string) => Promise; putRestoreManyCiphers: ( - request: CipherBulkRestoreRequest + request: CipherBulkRestoreRequest, ) => Promise>; /** @@ -292,7 +292,7 @@ export abstract class ApiService { postCipherAttachmentAdminLegacy: (id: string, data: FormData) => Promise; postCipherAttachment: ( id: string, - request: AttachmentRequest + request: AttachmentRequest, ) => Promise; deleteCipherAttachment: (id: string, attachmentId: string) => Promise; deleteCipherAttachmentAdmin: (id: string, attachmentId: string) => Promise; @@ -300,40 +300,40 @@ export abstract class ApiService { id: string, attachmentId: string, data: FormData, - organizationId: string + organizationId: string, ) => Promise; renewAttachmentUploadUrl: ( id: string, - attachmentId: string + attachmentId: string, ) => Promise; postAttachmentFile: (id: string, attachmentId: string, data: FormData) => Promise; getCollectionDetails: ( organizationId: string, - id: string + id: string, ) => Promise; getUserCollections: () => Promise>; getCollections: (organizationId: string) => Promise>; getCollectionUsers: (organizationId: string, id: string) => Promise; postCollection: ( organizationId: string, - request: CollectionRequest + request: CollectionRequest, ) => Promise; putCollectionUsers: ( organizationId: string, id: string, - request: SelectionReadOnlyRequest[] + request: SelectionReadOnlyRequest[], ) => Promise; putCollection: ( organizationId: string, id: string, - request: CollectionRequest + request: CollectionRequest, ) => Promise; deleteCollection: (organizationId: string, id: string) => Promise; deleteCollectionUser: ( organizationId: string, id: string, - organizationUserId: string + organizationUserId: string, ) => Promise; getGroupDetails: (organizationId: string, id: string) => Promise; @@ -351,82 +351,82 @@ export abstract class ApiService { organizationId: string, token: string, email: string, - organizationUserId: string + organizationUserId: string, ) => Promise>; getPoliciesByInvitedUser: ( organizationId: string, - userId: string + userId: string, ) => Promise>; putPolicy: ( organizationId: string, type: PolicyType, - request: PolicyRequest + request: PolicyRequest, ) => Promise; getOrganizationUser: ( organizationId: string, - id: string + id: string, ) => Promise; getOrganizationUserGroups: (organizationId: string, id: string) => Promise; getOrganizationUsers: ( - organizationId: string + organizationId: string, ) => Promise>; getOrganizationUserResetPasswordDetails: ( organizationId: string, - id: string + id: string, ) => Promise; postOrganizationUserInvite: ( organizationId: string, - request: OrganizationUserInviteRequest + request: OrganizationUserInviteRequest, ) => Promise; postOrganizationUserReinvite: (organizationId: string, id: string) => Promise; postManyOrganizationUserReinvite: ( organizationId: string, - request: OrganizationUserBulkRequest + request: OrganizationUserBulkRequest, ) => Promise>; postOrganizationUserAccept: ( organizationId: string, id: string, - request: OrganizationUserAcceptRequest + request: OrganizationUserAcceptRequest, ) => Promise; postOrganizationUserConfirm: ( organizationId: string, id: string, - request: OrganizationUserConfirmRequest + request: OrganizationUserConfirmRequest, ) => Promise; postOrganizationUsersPublicKey: ( organizationId: string, - request: OrganizationUserBulkRequest + request: OrganizationUserBulkRequest, ) => Promise>; postOrganizationUserBulkConfirm: ( organizationId: string, - request: OrganizationUserBulkConfirmRequest + request: OrganizationUserBulkConfirmRequest, ) => Promise>; putOrganizationUser: ( organizationId: string, id: string, - request: OrganizationUserUpdateRequest + request: OrganizationUserUpdateRequest, ) => Promise; putOrganizationUserGroups: ( organizationId: string, id: string, - request: OrganizationUserUpdateGroupsRequest + request: OrganizationUserUpdateGroupsRequest, ) => Promise; putOrganizationUserResetPasswordEnrollment: ( organizationId: string, userId: string, - request: OrganizationUserResetPasswordEnrollmentRequest + request: OrganizationUserResetPasswordEnrollmentRequest, ) => Promise; putOrganizationUserResetPassword: ( organizationId: string, id: string, - request: OrganizationUserResetPasswordRequest + request: OrganizationUserResetPasswordRequest, ) => Promise; deleteOrganizationUser: (organizationId: string, id: string) => Promise; deleteManyOrganizationUsers: ( organizationId: string, - request: OrganizationUserBulkRequest + request: OrganizationUserBulkRequest, ) => Promise>; getSync: () => Promise; @@ -438,43 +438,43 @@ export abstract class ApiService { getTwoFactorProviders: () => Promise>; getTwoFactorOrganizationProviders: ( - organizationId: string + organizationId: string, ) => Promise>; getTwoFactorAuthenticator: ( - request: SecretVerificationRequest + request: SecretVerificationRequest, ) => Promise; getTwoFactorEmail: (request: SecretVerificationRequest) => Promise; getTwoFactorDuo: (request: SecretVerificationRequest) => Promise; getTwoFactorOrganizationDuo: ( organizationId: string, - request: SecretVerificationRequest + request: SecretVerificationRequest, ) => Promise; getTwoFactorYubiKey: (request: SecretVerificationRequest) => Promise; getTwoFactorWebAuthn: (request: SecretVerificationRequest) => Promise; getTwoFactorWebAuthnChallenge: (request: SecretVerificationRequest) => Promise; getTwoFactorRecover: (request: SecretVerificationRequest) => Promise; putTwoFactorAuthenticator: ( - request: UpdateTwoFactorAuthenticatorRequest + request: UpdateTwoFactorAuthenticatorRequest, ) => Promise; putTwoFactorEmail: (request: UpdateTwoFactorEmailRequest) => Promise; putTwoFactorDuo: (request: UpdateTwoFactorDuoRequest) => Promise; putTwoFactorOrganizationDuo: ( organizationId: string, - request: UpdateTwoFactorDuoRequest + request: UpdateTwoFactorDuoRequest, ) => Promise; putTwoFactorYubiKey: ( - request: UpdateTwoFactorYubioOtpRequest + request: UpdateTwoFactorYubioOtpRequest, ) => Promise; putTwoFactorWebAuthn: ( - request: UpdateTwoFactorWebAuthnRequest + request: UpdateTwoFactorWebAuthnRequest, ) => Promise; deleteTwoFactorWebAuthn: ( - request: UpdateTwoFactorWebAuthnDeleteRequest + request: UpdateTwoFactorWebAuthnDeleteRequest, ) => Promise; putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise; putTwoFactorOrganizationDisable: ( organizationId: string, - request: TwoFactorProviderRequest + request: TwoFactorProviderRequest, ) => Promise; postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise; postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise; @@ -496,7 +496,7 @@ export abstract class ApiService { postEmergencyAccessTakeover: (id: string) => Promise; postEmergencyAccessPassword: ( id: string, - request: EmergencyAccessPasswordRequest + request: EmergencyAccessPasswordRequest, ) => Promise; postEmergencyAccessView: (id: string) => Promise; @@ -506,13 +506,13 @@ export abstract class ApiService { getOrganizationLicense: (id: string, installationId: string) => Promise; getOrganizationTaxInfo: (id: string) => Promise; getOrganizationAutoEnrollStatus: ( - identifier: string + identifier: string, ) => Promise; getOrganizationSso: (id: string) => Promise; postOrganization: (request: OrganizationCreateRequest) => Promise; putOrganization: ( id: string, - request: OrganizationUpdateRequest + request: OrganizationUpdateRequest, ) => Promise; putOrganizationTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise; postLeaveOrganization: (id: string) => Promise; @@ -520,23 +520,23 @@ export abstract class ApiService { postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise; postOrganizationApiKey: ( id: string, - request: SecretVerificationRequest + request: SecretVerificationRequest, ) => Promise; postOrganizationRotateApiKey: ( id: string, - request: SecretVerificationRequest + request: SecretVerificationRequest, ) => Promise; postOrganizationSso: ( id: string, - request: OrganizationSsoRequest + request: OrganizationSsoRequest, ) => Promise; postOrganizationUpgrade: ( id: string, - request: OrganizationUpgradeRequest + request: OrganizationUpgradeRequest, ) => Promise; postOrganizationUpdateSubscription: ( id: string, - request: OrganizationSubscriptionUpdateRequest + request: OrganizationSubscriptionUpdateRequest, ) => Promise; postOrganizationSeat: (id: string, request: SeatRequest) => Promise; postOrganizationStorage: (id: string, request: StorageRequest) => Promise; @@ -550,7 +550,7 @@ export abstract class ApiService { getOrganizationKeys: (id: string) => Promise; postOrganizationKeys: ( id: string, - request: OrganizationKeysRequest + request: OrganizationKeysRequest, ) => Promise; postProviderSetup: (id: string, request: ProviderSetupRequest) => Promise; @@ -563,46 +563,46 @@ export abstract class ApiService { postProviderUserReinvite: (providerId: string, id: string) => Promise; postManyProviderUserReinvite: ( providerId: string, - request: ProviderUserBulkRequest + request: ProviderUserBulkRequest, ) => Promise>; postProviderUserAccept: ( providerId: string, id: string, - request: ProviderUserAcceptRequest + request: ProviderUserAcceptRequest, ) => Promise; postProviderUserConfirm: ( providerId: string, id: string, - request: ProviderUserConfirmRequest + request: ProviderUserConfirmRequest, ) => Promise; postProviderUsersPublicKey: ( providerId: string, - request: ProviderUserBulkRequest + request: ProviderUserBulkRequest, ) => Promise>; postProviderUserBulkConfirm: ( providerId: string, - request: ProviderUserBulkConfirmRequest + request: ProviderUserBulkConfirmRequest, ) => Promise>; putProviderUser: ( providerId: string, id: string, - request: ProviderUserUpdateRequest + request: ProviderUserUpdateRequest, ) => Promise; deleteProviderUser: (organizationId: string, id: string) => Promise; deleteManyProviderUsers: ( providerId: string, - request: ProviderUserBulkRequest + request: ProviderUserBulkRequest, ) => Promise>; getProviderClients: ( - providerId: string + providerId: string, ) => Promise>; postProviderAddOrganization: ( providerId: string, - request: ProviderAddOrganizationRequest + request: ProviderAddOrganizationRequest, ) => Promise; postProviderCreateOrganization: ( providerId: string, - request: ProviderOrganizationCreateRequest + request: ProviderOrganizationCreateRequest, ) => Promise; deleteProviderOrganization: (providerId: string, organizationId: string) => Promise; @@ -611,33 +611,33 @@ export abstract class ApiService { id: string, start: string, end: string, - token: string + token: string, ) => Promise>; getEventsOrganization: ( id: string, start: string, end: string, - token: string + token: string, ) => Promise>; getEventsOrganizationUser: ( organizationId: string, id: string, start: string, end: string, - token: string + token: string, ) => Promise>; getEventsProvider: ( id: string, start: string, end: string, - token: string + token: string, ) => Promise>; getEventsProviderUser: ( providerId: string, id: string, start: string, end: string, - token: string + token: string, ) => Promise>; postEventsCollect: (request: EventRequest[]) => Promise; @@ -659,21 +659,21 @@ export abstract class ApiService { postCreateSponsorship: ( sponsorshipOrgId: string, - request: OrganizationSponsorshipCreateRequest + request: OrganizationSponsorshipCreateRequest, ) => Promise; deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise; deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise; postPreValidateSponsorshipToken: (sponsorshipToken: string) => Promise; postRedeemSponsorship: ( sponsorshipToken: string, - request: OrganizationSponsorshipRedeemRequest + request: OrganizationSponsorshipRedeemRequest, ) => Promise; postResendSponsorshipOffer: (sponsoringOrgId: string) => Promise; getUserKeyFromKeyConnector: (keyConnectorUrl: string) => Promise; postUserKeyToKeyConnector: ( keyConnectorUrl: string, - request: KeyConnectorUserKeyRequest + request: KeyConnectorUserKeyRequest, ) => Promise; getKeyConnectorAlive: (keyConnectorUrl: string) => Promise; } diff --git a/jslib/common/src/abstractions/auth.service.ts b/jslib/common/src/abstractions/auth.service.ts index bebac730..1be0b2fe 100644 --- a/jslib/common/src/abstractions/auth.service.ts +++ b/jslib/common/src/abstractions/auth.service.ts @@ -11,11 +11,11 @@ export abstract class AuthService { masterPasswordHash: string; email: string; logIn: ( - credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials + credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials, ) => Promise; logInTwoFactor: ( twoFactor: TokenRequestTwoFactor, - captchaResponse: string + captchaResponse: string, ) => Promise; logOut: (callback: () => void) => void; makePreloginKey: (masterPassword: string, email: string) => Promise; diff --git a/jslib/common/src/abstractions/cipher.service.ts b/jslib/common/src/abstractions/cipher.service.ts index a87a6f0a..5ae5a006 100644 --- a/jslib/common/src/abstractions/cipher.service.ts +++ b/jslib/common/src/abstractions/cipher.service.ts @@ -12,7 +12,7 @@ export abstract class CipherService { encrypt: ( model: CipherView, key?: SymmetricCryptoKey, - originalCipher?: Cipher + originalCipher?: Cipher, ) => Promise; encryptFields: (fieldsModel: FieldView[], key: SymmetricCryptoKey) => Promise; encryptField: (fieldModel: FieldView, key: SymmetricCryptoKey) => Promise; @@ -23,7 +23,7 @@ export abstract class CipherService { getAllDecryptedForUrl: ( url: string, includeOtherTypes?: CipherType[], - defaultMatch?: UriMatchType + defaultMatch?: UriMatchType, ) => Promise; getAllFromApiForOrganization: (organizationId: string) => Promise; getLastUsedForUrl: (url: string, autofillOnPageLoad: boolean) => Promise; @@ -37,23 +37,23 @@ export abstract class CipherService { shareWithServer: ( cipher: CipherView, organizationId: string, - collectionIds: string[] + collectionIds: string[], ) => Promise; shareManyWithServer: ( ciphers: CipherView[], organizationId: string, - collectionIds: string[] + collectionIds: string[], ) => Promise; saveAttachmentWithServer: ( cipher: Cipher, unencryptedFile: any, - admin?: boolean + admin?: boolean, ) => Promise; saveAttachmentRawWithServer: ( cipher: Cipher, filename: string, data: ArrayBuffer, - admin?: boolean + admin?: boolean, ) => Promise; saveCollectionsWithServer: (cipher: Cipher) => Promise; upsert: (cipher: CipherData | CipherData[]) => Promise; @@ -72,7 +72,7 @@ export abstract class CipherService { softDeleteWithServer: (id: string) => Promise; softDeleteManyWithServer: (ids: string[]) => Promise; restore: ( - cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[] + cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[], ) => Promise; restoreWithServer: (id: string) => Promise; restoreManyWithServer: (ids: string[]) => Promise; diff --git a/jslib/common/src/abstractions/crypto.service.ts b/jslib/common/src/abstractions/crypto.service.ts index bc61ba7e..2cd0cd9a 100644 --- a/jslib/common/src/abstractions/crypto.service.ts +++ b/jslib/common/src/abstractions/crypto.service.ts @@ -15,7 +15,7 @@ export abstract class CryptoService { setEncPrivateKey: (encPrivateKey: string) => Promise; setOrgKeys: ( orgs: ProfileOrganizationResponse[], - providerOrgs: ProfileProviderOrganizationResponse[] + providerOrgs: ProfileProviderOrganizationResponse[], ) => Promise; setProviderKeys: (orgs: ProfileProviderResponse[]) => Promise; getKey: (keySuffix?: KeySuffixOptions, userId?: string) => Promise; @@ -46,14 +46,14 @@ export abstract class CryptoService { password: string, salt: string, kdf: KdfType, - kdfIterations: number + kdfIterations: number, ) => Promise; makeKeyFromPin: ( pin: string, salt: string, kdf: KdfType, kdfIterations: number, - protectedKeyCs?: EncString + protectedKeyCs?: EncString, ) => Promise; 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; makeSendKey: (keyMaterial: ArrayBuffer) => Promise; hashPassword: ( password: string, key: SymmetricCryptoKey, - hashPurpose?: HashPurpose + hashPurpose?: HashPurpose, ) => Promise; makeEncKey: (key: SymmetricCryptoKey) => Promise<[SymmetricCryptoKey, EncString]>; remakeEncKey: ( key: SymmetricCryptoKey, - encKey?: SymmetricCryptoKey + encKey?: SymmetricCryptoKey, ) => Promise<[SymmetricCryptoKey, EncString]>; encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise; encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise; diff --git a/jslib/common/src/abstractions/cryptoFunction.service.ts b/jslib/common/src/abstractions/cryptoFunction.service.ts index 21ed33cb..d305717c 100644 --- a/jslib/common/src/abstractions/cryptoFunction.service.ts +++ b/jslib/common/src/abstractions/cryptoFunction.service.ts @@ -6,35 +6,35 @@ export abstract class CryptoFunctionService { password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: "sha256" | "sha512", - iterations: number + iterations: number, ) => Promise; hkdf: ( ikm: ArrayBuffer, salt: string | ArrayBuffer, info: string | ArrayBuffer, outputByteSize: number, - algorithm: "sha256" | "sha512" + algorithm: "sha256" | "sha512", ) => Promise; hkdfExpand: ( prk: ArrayBuffer, info: string | ArrayBuffer, outputByteSize: number, - algorithm: "sha256" | "sha512" + algorithm: "sha256" | "sha512", ) => Promise; hash: ( value: string | ArrayBuffer, - algorithm: "sha1" | "sha256" | "sha512" | "md5" + algorithm: "sha1" | "sha256" | "sha512" | "md5", ) => Promise; hmac: ( value: ArrayBuffer, key: ArrayBuffer, - algorithm: "sha1" | "sha256" | "sha512" + algorithm: "sha1" | "sha256" | "sha512", ) => Promise; compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise; hmacFast: ( value: ArrayBuffer | string, key: ArrayBuffer | string, - algorithm: "sha1" | "sha256" | "sha512" + algorithm: "sha1" | "sha256" | "sha512", ) => Promise; compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise; aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise; @@ -42,19 +42,19 @@ export abstract class CryptoFunctionService { data: string, iv: string, mac: string, - key: SymmetricCryptoKey + key: SymmetricCryptoKey, ) => DecryptParameters; aesDecryptFast: (parameters: DecryptParameters) => Promise; aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise; rsaEncrypt: ( data: ArrayBuffer, publicKey: ArrayBuffer, - algorithm: "sha1" | "sha256" + algorithm: "sha1" | "sha256", ) => Promise; rsaDecrypt: ( data: ArrayBuffer, privateKey: ArrayBuffer, - algorithm: "sha1" | "sha256" + algorithm: "sha1" | "sha256", ) => Promise; rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise; rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>; diff --git a/jslib/common/src/abstractions/fileUpload.service.ts b/jslib/common/src/abstractions/fileUpload.service.ts index fcd3c22c..6918347e 100644 --- a/jslib/common/src/abstractions/fileUpload.service.ts +++ b/jslib/common/src/abstractions/fileUpload.service.ts @@ -7,12 +7,12 @@ export abstract class FileUploadService { uploadSendFile: ( uploadData: SendFileUploadDataResponse, fileName: EncString, - encryptedFileData: EncArrayBuffer + encryptedFileData: EncArrayBuffer, ) => Promise; uploadCipherAttachment: ( admin: boolean, uploadData: AttachmentUploadDataResponse, fileName: EncString, - encryptedFileData: EncArrayBuffer + encryptedFileData: EncArrayBuffer, ) => Promise; } diff --git a/jslib/common/src/abstractions/keyConnector.service.ts b/jslib/common/src/abstractions/keyConnector.service.ts index b8f3bf7c..1e4ee928 100644 --- a/jslib/common/src/abstractions/keyConnector.service.ts +++ b/jslib/common/src/abstractions/keyConnector.service.ts @@ -9,7 +9,7 @@ export abstract class KeyConnectorService { userNeedsMigration: () => Promise; convertNewSsoUserToKeyConnector: ( tokenResponse: IdentityTokenResponse, - orgId: string + orgId: string, ) => Promise; setUsesKeyConnector: (enabled: boolean) => Promise; setConvertAccountRequired: (status: boolean) => Promise; diff --git a/jslib/common/src/abstractions/passwordGeneration.service.ts b/jslib/common/src/abstractions/passwordGeneration.service.ts index 82bc021f..615a32b0 100644 --- a/jslib/common/src/abstractions/passwordGeneration.service.ts +++ b/jslib/common/src/abstractions/passwordGeneration.service.ts @@ -8,7 +8,7 @@ export abstract class PasswordGenerationService { generatePassphrase: (options: any) => Promise; getOptions: () => Promise<[any, PasswordGeneratorPolicyOptions]>; enforcePasswordGeneratorPoliciesOnOptions: ( - options: any + options: any, ) => Promise<[any, PasswordGeneratorPolicyOptions]>; getPasswordGeneratorPolicyOptions: () => Promise; saveOptions: (options: any) => Promise; diff --git a/jslib/common/src/abstractions/platformUtils.service.ts b/jslib/common/src/abstractions/platformUtils.service.ts index 4a014868..608bd582 100644 --- a/jslib/common/src/abstractions/platformUtils.service.ts +++ b/jslib/common/src/abstractions/platformUtils.service.ts @@ -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; isDev: () => boolean; isSelfHost: () => boolean; @@ -45,7 +45,7 @@ export abstract class PlatformUtilsService { authenticateBiometric: () => Promise; getDefaultSystemTheme: () => Promise; onDefaultSystemThemeChange: ( - callback: (theme: ThemeType.Light | ThemeType.Dark) => unknown + callback: (theme: ThemeType.Light | ThemeType.Dark) => unknown, ) => unknown; getEffectiveTheme: () => Promise; supportsSecureStorage: () => boolean; diff --git a/jslib/common/src/abstractions/policy.service.ts b/jslib/common/src/abstractions/policy.service.ts index 24dcc996..bcf56ad4 100644 --- a/jslib/common/src/abstractions/policy.service.ts +++ b/jslib/common/src/abstractions/policy.service.ts @@ -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) => Policy[]; policyAppliesToUser: ( policyType: PolicyType, policyFilter?: (policy: Policy) => boolean, - userId?: string + userId?: string, ) => Promise; } diff --git a/jslib/common/src/abstractions/search.service.ts b/jslib/common/src/abstractions/search.service.ts index 9c2b0eeb..cfe569a2 100644 --- a/jslib/common/src/abstractions/search.service.ts +++ b/jslib/common/src/abstractions/search.service.ts @@ -9,7 +9,7 @@ export abstract class SearchService { searchCiphers: ( query: string, filter?: ((cipher: CipherView) => boolean) | ((cipher: CipherView) => boolean)[], - ciphers?: CipherView[] + ciphers?: CipherView[], ) => Promise; searchCiphersBasic: (ciphers: CipherView[], query: string, deleted?: boolean) => CipherView[]; searchSends: (sends: SendView[], query: string) => SendView[]; diff --git a/jslib/common/src/abstractions/send.service.ts b/jslib/common/src/abstractions/send.service.ts index 3331e41e..0bf5d485 100644 --- a/jslib/common/src/abstractions/send.service.ts +++ b/jslib/common/src/abstractions/send.service.ts @@ -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; getAll: () => Promise; diff --git a/jslib/common/src/abstractions/state.service.ts b/jslib/common/src/abstractions/state.service.ts index e74470bd..b789bae2 100644 --- a/jslib/common/src/abstractions/state.service.ts +++ b/jslib/common/src/abstractions/state.service.ts @@ -82,23 +82,23 @@ export abstract class StateService { getDecryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise; setDecryptedCryptoSymmetricKey: ( value: SymmetricCryptoKey, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getDecryptedFolders: (options?: StorageOptions) => Promise; setDecryptedFolders: (value: FolderView[], options?: StorageOptions) => Promise; getDecryptedOrganizationKeys: ( - options?: StorageOptions + options?: StorageOptions, ) => Promise>; setDecryptedOrganizationKeys: ( value: Map, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getDecryptedPasswordGenerationHistory: ( - options?: StorageOptions + options?: StorageOptions, ) => Promise; setDecryptedPasswordGenerationHistory: ( value: GeneratedPasswordHistory[], - options?: StorageOptions + options?: StorageOptions, ) => Promise; getDecryptedPinProtected: (options?: StorageOptions) => Promise; setDecryptedPinProtected: (value: EncString, options?: StorageOptions) => Promise; @@ -109,7 +109,7 @@ export abstract class StateService { getDecryptedProviderKeys: (options?: StorageOptions) => Promise>; setDecryptedProviderKeys: ( value: Map, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getDecryptedSends: (options?: StorageOptions) => Promise; setDecryptedSends: (value: SendView[], options?: StorageOptions) => Promise; @@ -126,7 +126,7 @@ export abstract class StateService { getDisableChangedPasswordNotification: (options?: StorageOptions) => Promise; setDisableChangedPasswordNotification: ( value: boolean, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getDisableContextMenuItem: (options?: StorageOptions) => Promise; setDisableContextMenuItem: (value: boolean, options?: StorageOptions) => Promise; @@ -153,7 +153,7 @@ export abstract class StateService { getEnableBrowserIntegrationFingerprint: (options?: StorageOptions) => Promise; setEnableBrowserIntegrationFingerprint: ( value: boolean, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getEnableCloseToTray: (options?: StorageOptions) => Promise; setEnableCloseToTray: (value: boolean, options?: StorageOptions) => Promise; @@ -170,38 +170,38 @@ export abstract class StateService { getEncryptedCiphers: (options?: StorageOptions) => Promise<{ [id: string]: CipherData }>; setEncryptedCiphers: ( value: { [id: string]: CipherData }, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getEncryptedCollections: (options?: StorageOptions) => Promise<{ [id: string]: CollectionData }>; setEncryptedCollections: ( value: { [id: string]: CollectionData }, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getEncryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise; setEncryptedCryptoSymmetricKey: (value: string, options?: StorageOptions) => Promise; getEncryptedFolders: (options?: StorageOptions) => Promise<{ [id: string]: FolderData }>; setEncryptedFolders: ( value: { [id: string]: FolderData }, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getEncryptedOrganizationKeys: (options?: StorageOptions) => Promise; setEncryptedOrganizationKeys: ( value: Map, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getEncryptedPasswordGenerationHistory: ( - options?: StorageOptions + options?: StorageOptions, ) => Promise; setEncryptedPasswordGenerationHistory: ( value: GeneratedPasswordHistory[], - options?: StorageOptions + options?: StorageOptions, ) => Promise; getEncryptedPinProtected: (options?: StorageOptions) => Promise; setEncryptedPinProtected: (value: string, options?: StorageOptions) => Promise; getEncryptedPolicies: (options?: StorageOptions) => Promise<{ [id: string]: PolicyData }>; setEncryptedPolicies: ( value: { [id: string]: PolicyData }, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getEncryptedPrivateKey: (options?: StorageOptions) => Promise; setEncryptedPrivateKey: (value: string, options?: StorageOptions) => Promise; @@ -261,7 +261,7 @@ export abstract class StateService { getOrganizations: (options?: StorageOptions) => Promise<{ [id: string]: OrganizationData }>; setOrganizations: ( value: { [id: string]: OrganizationData }, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getPasswordGenerationOptions: (options?: StorageOptions) => Promise; setPasswordGenerationOptions: (value: any, options?: StorageOptions) => Promise; diff --git a/jslib/common/src/abstractions/token.service.ts b/jslib/common/src/abstractions/token.service.ts index f0470494..c4fcf635 100644 --- a/jslib/common/src/abstractions/token.service.ts +++ b/jslib/common/src/abstractions/token.service.ts @@ -4,7 +4,7 @@ export abstract class TokenService { setTokens: ( accessToken: string, refreshToken: string, - clientIdClientSecret: [string, string] + clientIdClientSecret: [string, string], ) => Promise; setToken: (token: string) => Promise; getToken: () => Promise; diff --git a/jslib/common/src/abstractions/userVerification.service.ts b/jslib/common/src/abstractions/userVerification.service.ts index ebd7d1f3..56a0a08f 100644 --- a/jslib/common/src/abstractions/userVerification.service.ts +++ b/jslib/common/src/abstractions/userVerification.service.ts @@ -5,7 +5,7 @@ export abstract class UserVerificationService { buildRequest: ( verification: Verification, requestClass?: new () => T, - alreadyHashed?: boolean + alreadyHashed?: boolean, ) => Promise; verifyUser: (verification: Verification) => Promise; requestOTP: () => Promise; diff --git a/jslib/common/src/factories/stateFactory.ts b/jslib/common/src/factories/stateFactory.ts index 203ae672..95846348 100644 --- a/jslib/common/src/factories/stateFactory.ts +++ b/jslib/common/src/factories/stateFactory.ts @@ -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; private accountFactory: AccountFactory; constructor( globalStateConstructor: new (init: Partial) => TGlobal, - accountConstructor: new (init: Partial) => TAccount + accountConstructor: new (init: Partial) => TAccount, ) { this.globalStateFactory = new GlobalStateFactory(globalStateConstructor); this.accountFactory = new AccountFactory(accountConstructor); diff --git a/jslib/common/src/misc/captcha_iframe.ts b/jslib/common/src/misc/captcha_iframe.ts index ca422fc0..8c9182bc 100644 --- a/jslib/common/src/misc/captcha_iframe.ts +++ b/jslib/common/src/misc/captcha_iframe.ts @@ -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), ); } } diff --git a/jslib/common/src/misc/iframe_component.ts b/jslib/common/src/misc/iframe_component.ts index 2cd702ad..3d2d3c7a 100644 --- a/jslib/common/src/misc/iframe_component.ts +++ b/jslib/common/src/misc/iframe_component.ts @@ -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); - }) + }), ); } diff --git a/jslib/common/src/misc/linkedFieldOption.decorator.ts b/jslib/common/src/misc/linkedFieldOption.decorator.ts index 43836318..a3739837 100644 --- a/jslib/common/src/misc/linkedFieldOption.decorator.ts +++ b/jslib/common/src/misc/linkedFieldOption.decorator.ts @@ -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; diff --git a/jslib/common/src/misc/logInStrategies/apiLogin.strategy.ts b/jslib/common/src/misc/logInStrategies/apiLogin.strategy.ts index 89ebc379..8333c5d9 100644 --- a/jslib/common/src/misc/logInStrategies/apiLogin.strategy.ts +++ b/jslib/common/src/misc/logInStrategies/apiLogin.strategy.ts @@ -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(); diff --git a/jslib/common/src/misc/logInStrategies/logIn.strategy.ts b/jslib/common/src/misc/logInStrategies/logIn.strategy.ts index a58a7bc8..6c846571 100644 --- a/jslib/common/src/misc/logInStrategies/logIn.strategy.ts +++ b/jslib/common/src/misc/logInStrategies/logIn.strategy.ts @@ -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; async logInTwoFactor( twoFactor: TokenRequestTwoFactor, - captchaResponse: string = null + captchaResponse: string = null, ): Promise { 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()), ); } diff --git a/jslib/common/src/misc/logInStrategies/passwordLogin.strategy.ts b/jslib/common/src/misc/logInStrategies/passwordLogin.strategy.ts index 81947e56..24a51608 100644 --- a/jslib/common/src/misc/logInStrategies/passwordLogin.strategy.ts +++ b/jslib/common/src/misc/logInStrategies/passwordLogin.strategy.ts @@ -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 { 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(); diff --git a/jslib/common/src/misc/logInStrategies/ssoLogin.strategy.ts b/jslib/common/src/misc/logInStrategies/ssoLogin.strategy.ts index e56bd7a3..d7eb925d 100644 --- a/jslib/common/src/misc/logInStrategies/ssoLogin.strategy.ts +++ b/jslib/common/src/misc/logInStrategies/ssoLogin.strategy.ts @@ -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(); diff --git a/jslib/common/src/misc/serviceUtils.ts b/jslib/common/src/misc/serviceUtils.ts index b6c05092..cef7739d 100644 --- a/jslib/common/src/misc/serviceUtils.ts +++ b/jslib/common/src/misc/serviceUtils.ts @@ -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[], - id: string + id: string, ): TreeNode { for (let i = 0; i < nodeTree.length; i++) { if (nodeTree[i].node.id === id) { diff --git a/jslib/common/src/misc/throttle.ts b/jslib/common/src/misc/throttle.ts index 852ee999..dbbbd576 100644 --- a/jslib/common/src/misc/throttle.ts +++ b/jslib/common/src/misc/throttle.ts @@ -8,7 +8,7 @@ export function throttle(limit: number, throttleKey: (args: any[]) => string) { return ( target: any, propertyKey: string | symbol, - descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise> + descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise>, ) => { const originalMethod: () => Promise = descriptor.value; const allThrottles = new Map void)[]>>(); diff --git a/jslib/common/src/misc/utils.ts b/jslib/common/src/misc/utils.ts index 1d96e082..0580af97 100644 --- a/jslib/common/src/misc/utils.ts +++ b/jslib/common/src/misc/utils.ts @@ -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; diff --git a/jslib/common/src/misc/webauthn_iframe.ts b/jslib/common/src/misc/webauthn_iframe.ts index 969dde04..fe538e3c 100644 --- a/jslib/common/src/misc/webauthn_iframe.ts +++ b/jslib/common/src/misc/webauthn_iframe.ts @@ -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); - }) + }), ); } diff --git a/jslib/common/src/models/api/ssoConfigApi.ts b/jslib/common/src/models/api/ssoConfigApi.ts index 0767f3d6..0264caaf 100644 --- a/jslib/common/src/models/api/ssoConfigApi.ts +++ b/jslib/common/src/models/api/ssoConfigApi.ts @@ -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"); } diff --git a/jslib/common/src/models/domain/attachment.ts b/jslib/common/src/models/domain/attachment.ts index cbfffdcf..0d5ef2c0 100644 --- a/jslib/common/src/models/domain/attachment.ts +++ b/jslib/common/src/models/domain/attachment.ts @@ -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; } diff --git a/jslib/common/src/models/domain/card.ts b/jslib/common/src/models/domain/card.ts index 59f73f90..6679c41b 100644 --- a/jslib/common/src/models/domain/card.ts +++ b/jslib/common/src/models/domain/card.ts @@ -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, ); } diff --git a/jslib/common/src/models/domain/cipher.ts b/jslib/common/src/models/domain/cipher.ts index 23f98686..f9225822 100644 --- a/jslib/common/src/models/domain/cipher.ts +++ b/jslib/common/src/models/domain/cipher.ts @@ -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) { diff --git a/jslib/common/src/models/domain/collection.ts b/jslib/common/src/models/domain/collection.ts index 6f737cd4..ac7661a0 100644 --- a/jslib/common/src/models/domain/collection.ts +++ b/jslib/common/src/models/domain/collection.ts @@ -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, ); } } diff --git a/jslib/common/src/models/domain/domainBase.ts b/jslib/common/src/models/domain/domainBase.ts index 0c9e5ad6..f730620b 100644 --- a/jslib/common/src/models/domain/domainBase.ts +++ b/jslib/common/src/models/domain/domainBase.ts @@ -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 { const promises = []; const self: any = this; diff --git a/jslib/common/src/models/domain/encString.ts b/jslib/common/src/models/domain/encString.ts index 74ae8370..87bd035a 100644 --- a/jslib/common/src/models/domain/encString.ts +++ b/jslib/common/src/models/domain/encString.ts @@ -16,7 +16,7 @@ export class EncString { encryptedStringOrType: string | EncryptionType, data?: string, iv?: string, - mac?: string + mac?: string, ) { if (data != null) { // data and header diff --git a/jslib/common/src/models/domain/field.ts b/jslib/common/src/models/domain/field.ts index 71dc615a..537f561a 100644 --- a/jslib/common/src/models/domain/field.ts +++ b/jslib/common/src/models/domain/field.ts @@ -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; } diff --git a/jslib/common/src/models/domain/folder.ts b/jslib/common/src/models/domain/folder.ts index 8596e94d..a4c4f95d 100644 --- a/jslib/common/src/models/domain/folder.ts +++ b/jslib/common/src/models/domain/folder.ts @@ -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, ); } } diff --git a/jslib/common/src/models/domain/identity.ts b/jslib/common/src/models/domain/identity.ts index 4af22849..0510cb92 100644 --- a/jslib/common/src/models/domain/identity.ts +++ b/jslib/common/src/models/domain/identity.ts @@ -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, ); } diff --git a/jslib/common/src/models/domain/logInCredentials.ts b/jslib/common/src/models/domain/logInCredentials.ts index c1e23610..e6dc2f88 100644 --- a/jslib/common/src/models/domain/logInCredentials.ts +++ b/jslib/common/src/models/domain/logInCredentials.ts @@ -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, + ) {} } diff --git a/jslib/common/src/models/domain/login.ts b/jslib/common/src/models/domain/login.ts index 76ba4020..01b71014 100644 --- a/jslib/common/src/models/domain/login.ts +++ b/jslib/common/src/models/domain/login.ts @@ -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) { diff --git a/jslib/common/src/models/domain/loginUri.ts b/jslib/common/src/models/domain/loginUri.ts index 9bd78c65..c8ee528d 100644 --- a/jslib/common/src/models/domain/loginUri.ts +++ b/jslib/common/src/models/domain/loginUri.ts @@ -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; } diff --git a/jslib/common/src/models/domain/password.ts b/jslib/common/src/models/domain/password.ts index ae47b18d..638e606a 100644 --- a/jslib/common/src/models/domain/password.ts +++ b/jslib/common/src/models/domain/password.ts @@ -28,7 +28,7 @@ export class Password extends Domain { password: null, }, orgId, - encKey + encKey, ); } diff --git a/jslib/common/src/models/domain/send.ts b/jslib/common/src/models/domain/send.ts index c2e769ec..df8b208e 100644 --- a/jslib/common/src/models/domain/send.ts +++ b/jslib/common/src/models/domain/send.ts @@ -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) { diff --git a/jslib/common/src/models/domain/sendAccess.ts b/jslib/common/src/models/domain/sendAccess.ts index dab68cc6..aef6a2a1 100644 --- a/jslib/common/src/models/domain/sendAccess.ts +++ b/jslib/common/src/models/domain/sendAccess.ts @@ -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) { diff --git a/jslib/common/src/models/domain/sendFile.ts b/jslib/common/src/models/domain/sendFile.ts index 17799407..1cd9ffd1 100644 --- a/jslib/common/src/models/domain/sendFile.ts +++ b/jslib/common/src/models/domain/sendFile.ts @@ -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; } diff --git a/jslib/common/src/models/domain/sendText.ts b/jslib/common/src/models/domain/sendText.ts index 523e5ee5..46140da8 100644 --- a/jslib/common/src/models/domain/sendText.ts +++ b/jslib/common/src/models/domain/sendText.ts @@ -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, ); } } diff --git a/jslib/common/src/models/domain/sortedCiphersCache.ts b/jslib/common/src/models/domain/sortedCiphersCache.ts index 8c32744e..510b422a 100644 --- a/jslib/common/src/models/domain/sortedCiphersCache.ts +++ b/jslib/common/src/models/domain/sortedCiphersCache.ts @@ -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]; } diff --git a/jslib/common/src/models/domain/state.ts b/jslib/common/src/models/domain/state.ts index f5a2c046..db3e4bcb 100644 --- a/jslib/common/src/models/domain/state.ts +++ b/jslib/common/src/models/domain/state.ts @@ -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; diff --git a/jslib/common/src/models/request/account/setKeyConnectorKeyRequest.ts b/jslib/common/src/models/request/account/setKeyConnectorKeyRequest.ts index a84cc7ef..849dc56c 100644 --- a/jslib/common/src/models/request/account/setKeyConnectorKeyRequest.ts +++ b/jslib/common/src/models/request/account/setKeyConnectorKeyRequest.ts @@ -13,7 +13,7 @@ export class SetKeyConnectorKeyRequest { kdf: KdfType, kdfIterations: number, orgIdentifier: string, - keys: KeysRequest + keys: KeysRequest, ) { this.key = key; this.kdf = kdf; diff --git a/jslib/common/src/models/request/identityToken/apiTokenRequest.ts b/jslib/common/src/models/request/identityToken/apiTokenRequest.ts index 247ba174..d9700a0c 100644 --- a/jslib/common/src/models/request/identityToken/apiTokenRequest.ts +++ b/jslib/common/src/models/request/identityToken/apiTokenRequest.ts @@ -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); } diff --git a/jslib/common/src/models/request/identityToken/passwordTokenRequest.ts b/jslib/common/src/models/request/identityToken/passwordTokenRequest.ts index eda10037..d1e2671b 100644 --- a/jslib/common/src/models/request/identityToken/passwordTokenRequest.ts +++ b/jslib/common/src/models/request/identityToken/passwordTokenRequest.ts @@ -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); } diff --git a/jslib/common/src/models/request/identityToken/ssoTokenRequest.ts b/jslib/common/src/models/request/identityToken/ssoTokenRequest.ts index c7697c2f..94d8df32 100644 --- a/jslib/common/src/models/request/identityToken/ssoTokenRequest.ts +++ b/jslib/common/src/models/request/identityToken/ssoTokenRequest.ts @@ -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); } diff --git a/jslib/common/src/models/request/identityToken/tokenRequest.ts b/jslib/common/src/models/request/identityToken/tokenRequest.ts index 82a4a394..1dc1d4ce 100644 --- a/jslib/common/src/models/request/identityToken/tokenRequest.ts +++ b/jslib/common/src/models/request/identityToken/tokenRequest.ts @@ -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; } diff --git a/jslib/common/src/models/request/identityToken/tokenRequestTwoFactor.ts b/jslib/common/src/models/request/identityToken/tokenRequestTwoFactor.ts index 95f688c8..032dc63a 100644 --- a/jslib/common/src/models/request/identityToken/tokenRequestTwoFactor.ts +++ b/jslib/common/src/models/request/identityToken/tokenRequestTwoFactor.ts @@ -4,6 +4,6 @@ export class TokenRequestTwoFactor { constructor( public provider: TwoFactorProviderType = null, public token: string = null, - public remember: boolean = false + public remember: boolean = false, ) {} } diff --git a/jslib/common/src/models/request/organizationImportRequest.ts b/jslib/common/src/models/request/organizationImportRequest.ts index af7db2be..feb00cac 100644 --- a/jslib/common/src/models/request/organizationImportRequest.ts +++ b/jslib/common/src/models/request/organizationImportRequest.ts @@ -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)); diff --git a/jslib/common/src/models/request/organizationSubscriptionUpdateRequest.ts b/jslib/common/src/models/request/organizationSubscriptionUpdateRequest.ts index 9db3d4be..23abd1d6 100644 --- a/jslib/common/src/models/request/organizationSubscriptionUpdateRequest.ts +++ b/jslib/common/src/models/request/organizationSubscriptionUpdateRequest.ts @@ -1,3 +1,6 @@ export class OrganizationSubscriptionUpdateRequest { - constructor(public seatAdjustment: number, public maxAutoscaleSeats?: number) {} + constructor( + public seatAdjustment: number, + public maxAutoscaleSeats?: number, + ) {} } diff --git a/jslib/common/src/models/request/provider/providerOrganizationCreateRequest.ts b/jslib/common/src/models/request/provider/providerOrganizationCreateRequest.ts index 8d02f530..4c1bc365 100644 --- a/jslib/common/src/models/request/provider/providerOrganizationCreateRequest.ts +++ b/jslib/common/src/models/request/provider/providerOrganizationCreateRequest.ts @@ -3,6 +3,6 @@ import { OrganizationCreateRequest } from "../organizationCreateRequest"; export class ProviderOrganizationCreateRequest { constructor( public clientOwnerEmail: string, - public organizationCreateRequest: OrganizationCreateRequest + public organizationCreateRequest: OrganizationCreateRequest, ) {} } diff --git a/jslib/common/src/models/request/registerRequest.ts b/jslib/common/src/models/request/registerRequest.ts index 8650c5c5..75af9746 100644 --- a/jslib/common/src/models/request/registerRequest.ts +++ b/jslib/common/src/models/request/registerRequest.ts @@ -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; } diff --git a/jslib/common/src/models/request/setPasswordRequest.ts b/jslib/common/src/models/request/setPasswordRequest.ts index 919a132f..62b6c8ca 100644 --- a/jslib/common/src/models/request/setPasswordRequest.ts +++ b/jslib/common/src/models/request/setPasswordRequest.ts @@ -18,7 +18,7 @@ export class SetPasswordRequest { kdf: KdfType, kdfIterations: number, orgIdentifier: string, - keys: KeysRequest + keys: KeysRequest, ) { this.masterPasswordHash = masterPasswordHash; this.key = key; diff --git a/jslib/common/src/models/response/baseResponse.ts b/jslib/common/src/models/response/baseResponse.ts index 8c599fba..95a6dab8 100644 --- a/jslib/common/src/models/response/baseResponse.ts +++ b/jslib/common/src/models/response/baseResponse.ts @@ -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."); diff --git a/jslib/common/src/models/response/domainsResponse.ts b/jslib/common/src/models/response/domainsResponse.ts index 3014c2f2..8da762c1 100644 --- a/jslib/common/src/models/response/domainsResponse.ts +++ b/jslib/common/src/models/response/domainsResponse.ts @@ -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 = []; diff --git a/jslib/common/src/models/response/profileResponse.ts b/jslib/common/src/models/response/profileResponse.ts index 2c3e66fb..71939dc4 100644 --- a/jslib/common/src/models/response/profileResponse.ts +++ b/jslib/common/src/models/response/profileResponse.ts @@ -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), ); } } diff --git a/jslib/common/src/services/api.service.ts b/jslib/common/src/services/api.service.ts index b9edf7b5..b12b773e 100644 --- a/jslib/common/src/services/api.service.ts +++ b/jslib/common/src/services/api.service.ts @@ -189,7 +189,7 @@ export class ApiService implements ApiServiceAbstraction { private environmentService: EnvironmentService, private appIdService: AppIdService, private logoutCallback: (expired: boolean) => Promise, - private customUserAgent: string = null + private customUserAgent: string = null, ) { this.device = platformUtilsService.getDevice(); this.deviceType = this.device.toString(); @@ -211,7 +211,7 @@ export class ApiService implements ApiServiceAbstraction { // Auth APIs async postIdentityToken( - request: ApiTokenRequest | PasswordTokenRequest | SsoTokenRequest + request: ApiTokenRequest | PasswordTokenRequest | SsoTokenRequest, ): Promise { const headers = new Headers({ "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", @@ -235,7 +235,7 @@ export class ApiService implements ApiServiceAbstraction { cache: "no-store", headers: headers, method: "POST", - }) + }), ); let responseJson: any = null; @@ -313,7 +313,7 @@ export class ApiService implements ApiServiceAbstraction { true, this.platformUtilsService.isDev() ? this.environmentService.getIdentityUrl() - : this.environmentService.getApiUrl() + : this.environmentService.getApiUrl(), ); return new PreloginResponse(r); } @@ -364,7 +364,7 @@ export class ApiService implements ApiServiceAbstraction { false, this.platformUtilsService.isDev() ? this.environmentService.getIdentityUrl() - : this.environmentService.getApiUrl() + : this.environmentService.getApiUrl(), ); } @@ -445,7 +445,7 @@ export class ApiService implements ApiServiceAbstraction { async postUserRotateApiKey( id: string, - request: SecretVerificationRequest + request: SecretVerificationRequest, ): Promise { const r = await this.send("POST", "/accounts/rotate-api-key", request, true, true); return new ApiKeyResponse(r); @@ -498,7 +498,7 @@ export class ApiService implements ApiServiceAbstraction { async postSendAccess( id: string, request: SendAccessRequest, - apiUrl?: string + apiUrl?: string, ): Promise { const addSendIdHeader = (headers: Headers) => { headers.set("Send-Id", id); @@ -510,7 +510,7 @@ export class ApiService implements ApiServiceAbstraction { false, true, apiUrl, - addSendIdHeader + addSendIdHeader, ); return new SendAccessResponse(r); } @@ -518,7 +518,7 @@ export class ApiService implements ApiServiceAbstraction { async getSendFileDownloadData( send: SendAccessView, request: SendAccessRequest, - apiUrl?: string + apiUrl?: string, ): Promise { const addSendIdHeader = (headers: Headers) => { headers.set("Send-Id", send.id); @@ -530,7 +530,7 @@ export class ApiService implements ApiServiceAbstraction { false, true, apiUrl, - addSendIdHeader + addSendIdHeader, ); return new SendFileDownloadDataResponse(r); } @@ -552,7 +552,7 @@ export class ApiService implements ApiServiceAbstraction { async renewSendFileUploadUrl( sendId: string, - fileId: string + fileId: string, ): Promise { const r = await this.send("GET", "/sends/" + sendId + "/file/" + fileId, null, true, true); return new SendFileUploadDataResponse(r); @@ -603,7 +603,7 @@ export class ApiService implements ApiServiceAbstraction { "/ciphers/organization-details?organizationId=" + organizationId, null, true, - true + true, ); return new ListResponse(r, CipherResponse); } @@ -672,7 +672,7 @@ export class ApiService implements ApiServiceAbstraction { postPurgeCiphers( request: SecretVerificationRequest, - organizationId: string = null + organizationId: string = null, ): Promise { let path = "/ciphers/purge"; if (organizationId != null) { @@ -687,14 +687,14 @@ export class ApiService implements ApiServiceAbstraction { postImportOrganizationCiphers( organizationId: string, - request: ImportOrganizationCiphersRequest + request: ImportOrganizationCiphersRequest, ): Promise { return this.send( "POST", "/ciphers/import-organization?organizationId=" + organizationId, request, true, - false + false, ); } @@ -725,7 +725,7 @@ export class ApiService implements ApiServiceAbstraction { } async putRestoreManyCiphers( - request: CipherBulkDeleteRequest + request: CipherBulkDeleteRequest, ): Promise> { const r = await this.send("PUT", "/ciphers/restore", request, true, true); return new ListResponse(r, CipherResponse); @@ -736,7 +736,7 @@ export class ApiService implements ApiServiceAbstraction { async getAttachmentData( cipherId: string, attachmentId: string, - emergencyAccessId?: string + emergencyAccessId?: string, ): Promise { const path = (emergencyAccessId != null ? "/emergency-access/" + emergencyAccessId + "/" : "/ciphers/") + @@ -749,7 +749,7 @@ export class ApiService implements ApiServiceAbstraction { async postCipherAttachment( id: string, - request: AttachmentRequest + request: AttachmentRequest, ): Promise { const r = await this.send("POST", "/ciphers/" + id + "/attachment/v2", request, true, true); return new AttachmentUploadDataResponse(r); @@ -783,7 +783,7 @@ export class ApiService implements ApiServiceAbstraction { "/ciphers/" + id + "/attachment/" + attachmentId + "/admin", null, true, - false + false, ); } @@ -791,27 +791,27 @@ export class ApiService implements ApiServiceAbstraction { id: string, attachmentId: string, data: FormData, - organizationId: string + organizationId: string, ): Promise { return this.send( "POST", "/ciphers/" + id + "/attachment/" + attachmentId + "/share?organizationId=" + organizationId, data, true, - false + false, ); } async renewAttachmentUploadUrl( id: string, - attachmentId: string + attachmentId: string, ): Promise { const r = await this.send( "GET", "/ciphers/" + id + "/attachment/" + attachmentId + "/renew", null, true, - true + true, ); return new AttachmentUploadDataResponse(r); } @@ -824,14 +824,14 @@ export class ApiService implements ApiServiceAbstraction { async getCollectionDetails( organizationId: string, - id: string + id: string, ): Promise { const r = await this.send( "GET", "/organizations/" + organizationId + "/collections/" + id + "/details", null, true, - true + true, ); return new CollectionGroupDetailsResponse(r); } @@ -847,35 +847,35 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/collections", null, true, - true + true, ); return new ListResponse(r, CollectionResponse); } async getCollectionUsers( organizationId: string, - id: string + id: string, ): Promise { const r = await this.send( "GET", "/organizations/" + organizationId + "/collections/" + id + "/users", null, true, - true + true, ); return r.map((dr: any) => new SelectionReadOnlyResponse(dr)); } async postCollection( organizationId: string, - request: CollectionRequest + request: CollectionRequest, ): Promise { const r = await this.send( "POST", "/organizations/" + organizationId + "/collections", request, true, - true + true, ); return new CollectionResponse(r); } @@ -883,14 +883,14 @@ export class ApiService implements ApiServiceAbstraction { async putCollection( organizationId: string, id: string, - request: CollectionRequest + request: CollectionRequest, ): Promise { const r = await this.send( "PUT", "/organizations/" + organizationId + "/collections/" + id, request, true, - true + true, ); return new CollectionResponse(r); } @@ -898,14 +898,14 @@ export class ApiService implements ApiServiceAbstraction { async putCollectionUsers( organizationId: string, id: string, - request: SelectionReadOnlyRequest[] + request: SelectionReadOnlyRequest[], ): Promise { await this.send( "PUT", "/organizations/" + organizationId + "/collections/" + id + "/users", request, true, - false + false, ); } @@ -915,21 +915,21 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/collections/" + id, null, true, - false + false, ); } deleteCollectionUser( organizationId: string, id: string, - organizationUserId: string + organizationUserId: string, ): Promise { return this.send( "DELETE", "/organizations/" + organizationId + "/collections/" + id + "/user/" + organizationUserId, null, true, - false + false, ); } @@ -941,7 +941,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/groups/" + id + "/details", null, true, - true + true, ); return new GroupDetailsResponse(r); } @@ -952,7 +952,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/groups", null, true, - true + true, ); return new ListResponse(r, GroupResponse); } @@ -963,7 +963,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/groups/" + id + "/users", null, true, - true + true, ); return r; } @@ -974,7 +974,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/groups", request, true, - true + true, ); return new GroupResponse(r); } @@ -982,14 +982,14 @@ export class ApiService implements ApiServiceAbstraction { async putGroup( organizationId: string, id: string, - request: GroupRequest + request: GroupRequest, ): Promise { const r = await this.send( "PUT", "/organizations/" + organizationId + "/groups/" + id, request, true, - true + true, ); return new GroupResponse(r); } @@ -1000,7 +1000,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/groups/" + id + "/users", request, true, - false + false, ); } @@ -1010,7 +1010,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/groups/" + id, null, true, - false + false, ); } @@ -1020,7 +1020,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/groups/" + id + "/user/" + organizationUserId, null, true, - false + false, ); } @@ -1032,7 +1032,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/policies/" + type, null, true, - true + true, ); return new PolicyResponse(r); } @@ -1043,7 +1043,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/policies", null, true, - true + true, ); return new ListResponse(r, PolicyResponse); } @@ -1052,7 +1052,7 @@ export class ApiService implements ApiServiceAbstraction { organizationId: string, token: string, email: string, - organizationUserId: string + organizationUserId: string, ): Promise> { const r = await this.send( "GET", @@ -1067,21 +1067,21 @@ export class ApiService implements ApiServiceAbstraction { organizationUserId, null, false, - true + true, ); return new ListResponse(r, PolicyResponse); } async getPoliciesByInvitedUser( organizationId: string, - userId: string + userId: string, ): Promise> { const r = await this.send( "GET", "/organizations/" + organizationId + "/policies/invited-user?" + "userId=" + userId, null, false, - true + true, ); return new ListResponse(r, PolicyResponse); } @@ -1089,14 +1089,14 @@ export class ApiService implements ApiServiceAbstraction { async putPolicy( organizationId: string, type: PolicyType, - request: PolicyRequest + request: PolicyRequest, ): Promise { const r = await this.send( "PUT", "/organizations/" + organizationId + "/policies/" + type, request, true, - true + true, ); return new PolicyResponse(r); } @@ -1105,14 +1105,14 @@ export class ApiService implements ApiServiceAbstraction { async getOrganizationUser( organizationId: string, - id: string + id: string, ): Promise { const r = await this.send( "GET", "/organizations/" + organizationId + "/users/" + id, null, true, - true + true, ); return new OrganizationUserDetailsResponse(r); } @@ -1123,61 +1123,61 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/users/" + id + "/groups", null, true, - true + true, ); return r; } async getOrganizationUsers( - organizationId: string + organizationId: string, ): Promise> { const r = await this.send( "GET", "/organizations/" + organizationId + "/users", null, true, - true + true, ); return new ListResponse(r, OrganizationUserUserDetailsResponse); } async getOrganizationUserResetPasswordDetails( organizationId: string, - id: string + id: string, ): Promise { const r = await this.send( "GET", "/organizations/" + organizationId + "/users/" + id + "/reset-password-details", null, true, - true + true, ); return new OrganizationUserResetPasswordDetailsReponse(r); } async getOrganizationAutoEnrollStatus( - identifier: string + identifier: string, ): Promise { const r = await this.send( "GET", "/organizations/" + identifier + "/auto-enroll-status", null, true, - true + true, ); return new OrganizationAutoEnrollStatusResponse(r); } postOrganizationUserInvite( organizationId: string, - request: OrganizationUserInviteRequest + request: OrganizationUserInviteRequest, ): Promise { return this.send( "POST", "/organizations/" + organizationId + "/users/invite", request, true, - false + false, ); } @@ -1187,20 +1187,20 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/users/" + id + "/reinvite", null, true, - false + false, ); } async postManyOrganizationUserReinvite( organizationId: string, - request: OrganizationUserBulkRequest + request: OrganizationUserBulkRequest, ): Promise> { const r = await this.send( "POST", "/organizations/" + organizationId + "/users/reinvite", request, true, - true + true, ); return new ListResponse(r, OrganizationUserBulkResponse); } @@ -1208,55 +1208,55 @@ export class ApiService implements ApiServiceAbstraction { postOrganizationUserAccept( organizationId: string, id: string, - request: OrganizationUserAcceptRequest + request: OrganizationUserAcceptRequest, ): Promise { return this.send( "POST", "/organizations/" + organizationId + "/users/" + id + "/accept", request, true, - false + false, ); } postOrganizationUserConfirm( organizationId: string, id: string, - request: OrganizationUserConfirmRequest + request: OrganizationUserConfirmRequest, ): Promise { return this.send( "POST", "/organizations/" + organizationId + "/users/" + id + "/confirm", request, true, - false + false, ); } async postOrganizationUsersPublicKey( organizationId: string, - request: OrganizationUserBulkRequest + request: OrganizationUserBulkRequest, ): Promise> { const r = await this.send( "POST", "/organizations/" + organizationId + "/users/public-keys", request, true, - true + true, ); return new ListResponse(r, OrganizationUserBulkPublicKeyResponse); } async postOrganizationUserBulkConfirm( organizationId: string, - request: OrganizationUserBulkConfirmRequest + request: OrganizationUserBulkConfirmRequest, ): Promise> { const r = await this.send( "POST", "/organizations/" + organizationId + "/users/confirm", request, true, - true + true, ); return new ListResponse(r, OrganizationUserBulkResponse); } @@ -1264,56 +1264,56 @@ export class ApiService implements ApiServiceAbstraction { putOrganizationUser( organizationId: string, id: string, - request: OrganizationUserUpdateRequest + request: OrganizationUserUpdateRequest, ): Promise { return this.send( "PUT", "/organizations/" + organizationId + "/users/" + id, request, true, - false + false, ); } putOrganizationUserGroups( organizationId: string, id: string, - request: OrganizationUserUpdateGroupsRequest + request: OrganizationUserUpdateGroupsRequest, ): Promise { return this.send( "PUT", "/organizations/" + organizationId + "/users/" + id + "/groups", request, true, - false + false, ); } putOrganizationUserResetPasswordEnrollment( organizationId: string, userId: string, - request: OrganizationUserResetPasswordEnrollmentRequest + request: OrganizationUserResetPasswordEnrollmentRequest, ): Promise { return this.send( "PUT", "/organizations/" + organizationId + "/users/" + userId + "/reset-password-enrollment", request, true, - false + false, ); } putOrganizationUserResetPassword( organizationId: string, id: string, - request: OrganizationUserResetPasswordRequest + request: OrganizationUserResetPasswordRequest, ): Promise { return this.send( "PUT", "/organizations/" + organizationId + "/users/" + id + "/reset-password", request, true, - false + false, ); } @@ -1323,20 +1323,20 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/users/" + id, null, true, - false + false, ); } async deleteManyOrganizationUsers( organizationId: string, - request: OrganizationUserBulkRequest + request: OrganizationUserBulkRequest, ): Promise> { const r = await this.send( "DELETE", "/organizations/" + organizationId + "/users", request, true, - true + true, ); return new ListResponse(r, OrganizationUserBulkResponse); } @@ -1389,20 +1389,20 @@ export class ApiService implements ApiServiceAbstraction { } async getTwoFactorOrganizationProviders( - organizationId: string + organizationId: string, ): Promise> { const r = await this.send( "GET", "/organizations/" + organizationId + "/two-factor", null, true, - true + true, ); return new ListResponse(r, TwoFactorProviderResponse); } async getTwoFactorAuthenticator( - request: SecretVerificationRequest + request: SecretVerificationRequest, ): Promise { const r = await this.send("POST", "/two-factor/get-authenticator", request, true, true); return new TwoFactorAuthenticatorResponse(r); @@ -1420,14 +1420,14 @@ export class ApiService implements ApiServiceAbstraction { async getTwoFactorOrganizationDuo( organizationId: string, - request: SecretVerificationRequest + request: SecretVerificationRequest, ): Promise { const r = await this.send( "POST", "/organizations/" + organizationId + "/two-factor/get-duo", request, true, - true + true, ); return new TwoFactorDuoResponse(r); } @@ -1438,14 +1438,14 @@ export class ApiService implements ApiServiceAbstraction { } async getTwoFactorWebAuthn( - request: SecretVerificationRequest + request: SecretVerificationRequest, ): Promise { const r = await this.send("POST", "/two-factor/get-webauthn", request, true, true); return new TwoFactorWebAuthnResponse(r); } async getTwoFactorWebAuthnChallenge( - request: SecretVerificationRequest + request: SecretVerificationRequest, ): Promise { const r = await this.send("POST", "/two-factor/get-webauthn-challenge", request, true, true); return new ChallengeResponse(r); @@ -1457,7 +1457,7 @@ export class ApiService implements ApiServiceAbstraction { } async putTwoFactorAuthenticator( - request: UpdateTwoFactorAuthenticatorRequest + request: UpdateTwoFactorAuthenticatorRequest, ): Promise { const r = await this.send("PUT", "/two-factor/authenticator", request, true, true); return new TwoFactorAuthenticatorResponse(r); @@ -1475,27 +1475,27 @@ export class ApiService implements ApiServiceAbstraction { async putTwoFactorOrganizationDuo( organizationId: string, - request: UpdateTwoFactorDuoRequest + request: UpdateTwoFactorDuoRequest, ): Promise { const r = await this.send( "PUT", "/organizations/" + organizationId + "/two-factor/duo", request, true, - true + true, ); return new TwoFactorDuoResponse(r); } async putTwoFactorYubiKey( - request: UpdateTwoFactorYubioOtpRequest + request: UpdateTwoFactorYubioOtpRequest, ): Promise { const r = await this.send("PUT", "/two-factor/yubikey", request, true, true); return new TwoFactorYubiKeyResponse(r); } async putTwoFactorWebAuthn( - request: UpdateTwoFactorWebAuthnRequest + request: UpdateTwoFactorWebAuthnRequest, ): Promise { const response = request.deviceResponse.response as AuthenticatorAttestationResponse; const data: any = Object.assign({}, request); @@ -1516,7 +1516,7 @@ export class ApiService implements ApiServiceAbstraction { } async deleteTwoFactorWebAuthn( - request: UpdateTwoFactorWebAuthnDeleteRequest + request: UpdateTwoFactorWebAuthnDeleteRequest, ): Promise { const r = await this.send("DELETE", "/two-factor/webauthn", request, true, true); return new TwoFactorWebAuthnResponse(r); @@ -1529,14 +1529,14 @@ export class ApiService implements ApiServiceAbstraction { async putTwoFactorOrganizationDisable( organizationId: string, - request: TwoFactorProviderRequest + request: TwoFactorProviderRequest, ): Promise { const r = await this.send( "PUT", "/organizations/" + organizationId + "/two-factor/disable", request, true, - true + true, ); return new TwoFactorProviderResponse(r); } @@ -1618,7 +1618,7 @@ export class ApiService implements ApiServiceAbstraction { async postEmergencyAccessPassword( id: string, - request: EmergencyAccessPasswordRequest + request: EmergencyAccessPasswordRequest, ): Promise { await this.send("POST", "/emergency-access/" + id + "/password", request, true, true); } @@ -1651,7 +1651,7 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + id + "/license?installationId=" + installationId, null, true, - true + true, ); } @@ -1672,7 +1672,7 @@ export class ApiService implements ApiServiceAbstraction { async putOrganization( id: string, - request: OrganizationUpdateRequest + request: OrganizationUpdateRequest, ): Promise { const r = await this.send("PUT", "/organizations/" + id, request, true, true); return new OrganizationResponse(r); @@ -1680,7 +1680,7 @@ export class ApiService implements ApiServiceAbstraction { async putOrganizationTaxInfo( id: string, - request: OrganizationTaxInfoUpdateRequest + request: OrganizationTaxInfoUpdateRequest, ): Promise { return this.send("PUT", "/organizations/" + id + "/tax", request, true, false); } @@ -1700,7 +1700,7 @@ export class ApiService implements ApiServiceAbstraction { async postOrganizationApiKey( id: string, - request: SecretVerificationRequest + request: SecretVerificationRequest, ): Promise { const r = await this.send("POST", "/organizations/" + id + "/api-key", request, true, true); return new ApiKeyResponse(r); @@ -1708,21 +1708,21 @@ export class ApiService implements ApiServiceAbstraction { async postOrganizationRotateApiKey( id: string, - request: SecretVerificationRequest + request: SecretVerificationRequest, ): Promise { const r = await this.send( "POST", "/organizations/" + id + "/rotate-api-key", request, true, - true + true, ); return new ApiKeyResponse(r); } async postOrganizationSso( id: string, - request: OrganizationSsoRequest + request: OrganizationSsoRequest, ): Promise { const r = await this.send("POST", "/organizations/" + id + "/sso", request, true, true); return new OrganizationSsoResponse(r); @@ -1730,7 +1730,7 @@ export class ApiService implements ApiServiceAbstraction { async postOrganizationUpgrade( id: string, - request: OrganizationUpgradeRequest + request: OrganizationUpgradeRequest, ): Promise { const r = await this.send("POST", "/organizations/" + id + "/upgrade", request, true, true); return new PaymentResponse(r); @@ -1738,7 +1738,7 @@ export class ApiService implements ApiServiceAbstraction { async postOrganizationUpdateSubscription( id: string, - request: OrganizationSubscriptionUpdateRequest + request: OrganizationSubscriptionUpdateRequest, ): Promise { return this.send("POST", "/organizations/" + id + "/subscription", request, true, false); } @@ -1780,7 +1780,7 @@ export class ApiService implements ApiServiceAbstraction { async postOrganizationKeys( id: string, - request: OrganizationKeysRequest + request: OrganizationKeysRequest, ): Promise { const r = await this.send("POST", "/organizations/" + id + "/keys", request, true, true); return new OrganizationKeysResponse(r); @@ -1806,7 +1806,7 @@ export class ApiService implements ApiServiceAbstraction { // Provider User APIs async getProviderUsers( - providerId: string + providerId: string, ): Promise> { const r = await this.send("GET", "/providers/" + providerId + "/users", null, true, true); return new ListResponse(r, ProviderUserUserDetailsResponse); @@ -1827,41 +1827,41 @@ export class ApiService implements ApiServiceAbstraction { "/providers/" + providerId + "/users/" + id + "/reinvite", null, true, - false + false, ); } async postManyProviderUserReinvite( providerId: string, - request: ProviderUserBulkRequest + request: ProviderUserBulkRequest, ): Promise> { const r = await this.send( "POST", "/providers/" + providerId + "/users/reinvite", request, true, - true + true, ); return new ListResponse(r, ProviderUserBulkResponse); } async postProviderUserBulkConfirm( providerId: string, - request: ProviderUserBulkConfirmRequest + request: ProviderUserBulkConfirmRequest, ): Promise> { const r = await this.send( "POST", "/providers/" + providerId + "/users/confirm", request, true, - true + true, ); return new ListResponse(r, ProviderUserBulkResponse); } async deleteManyProviderUsers( providerId: string, - request: ProviderUserBulkRequest + request: ProviderUserBulkRequest, ): Promise> { const r = await this.send("DELETE", "/providers/" + providerId + "/users", request, true, true); return new ListResponse(r, ProviderUserBulkResponse); @@ -1870,41 +1870,41 @@ export class ApiService implements ApiServiceAbstraction { postProviderUserAccept( providerId: string, id: string, - request: ProviderUserAcceptRequest + request: ProviderUserAcceptRequest, ): Promise { return this.send( "POST", "/providers/" + providerId + "/users/" + id + "/accept", request, true, - false + false, ); } postProviderUserConfirm( providerId: string, id: string, - request: ProviderUserConfirmRequest + request: ProviderUserConfirmRequest, ): Promise { return this.send( "POST", "/providers/" + providerId + "/users/" + id + "/confirm", request, true, - false + false, ); } async postProviderUsersPublicKey( providerId: string, - request: ProviderUserBulkRequest + request: ProviderUserBulkRequest, ): Promise> { const r = await this.send( "POST", "/providers/" + providerId + "/users/public-keys", request, true, - true + true, ); return new ListResponse(r, ProviderUserBulkPublicKeyResponse); } @@ -1912,7 +1912,7 @@ export class ApiService implements ApiServiceAbstraction { putProviderUser( providerId: string, id: string, - request: ProviderUserUpdateRequest + request: ProviderUserUpdateRequest, ): Promise { return this.send("PUT", "/providers/" + providerId + "/users/" + id, request, true, false); } @@ -1924,41 +1924,41 @@ export class ApiService implements ApiServiceAbstraction { // Provider Organization APIs async getProviderClients( - providerId: string + providerId: string, ): Promise> { const r = await this.send( "GET", "/providers/" + providerId + "/organizations", null, true, - true + true, ); return new ListResponse(r, ProviderOrganizationOrganizationDetailsResponse); } postProviderAddOrganization( providerId: string, - request: ProviderAddOrganizationRequest + request: ProviderAddOrganizationRequest, ): Promise { return this.send( "POST", "/providers/" + providerId + "/organizations/add", request, true, - false + false, ); } async postProviderCreateOrganization( providerId: string, - request: ProviderOrganizationCreateRequest + request: ProviderOrganizationCreateRequest, ): Promise { const r = await this.send( "POST", "/providers/" + providerId + "/organizations", request, true, - true + true, ); return new ProviderOrganizationResponse(r); } @@ -1969,7 +1969,7 @@ export class ApiService implements ApiServiceAbstraction { "/providers/" + providerId + "/organizations/" + id, null, true, - false + false, ); } @@ -1981,7 +1981,7 @@ export class ApiService implements ApiServiceAbstraction { this.addEventParameters("/events", start, end, token), null, true, - true + true, ); return new ListResponse(r, EventResponse); } @@ -1990,14 +1990,14 @@ export class ApiService implements ApiServiceAbstraction { id: string, start: string, end: string, - token: string + token: string, ): Promise> { const r = await this.send( "GET", this.addEventParameters("/ciphers/" + id + "/events", start, end, token), null, true, - true + true, ); return new ListResponse(r, EventResponse); } @@ -2006,14 +2006,14 @@ export class ApiService implements ApiServiceAbstraction { id: string, start: string, end: string, - token: string + token: string, ): Promise> { const r = await this.send( "GET", this.addEventParameters("/organizations/" + id + "/events", start, end, token), null, true, - true + true, ); return new ListResponse(r, EventResponse); } @@ -2023,7 +2023,7 @@ export class ApiService implements ApiServiceAbstraction { id: string, start: string, end: string, - token: string + token: string, ): Promise> { const r = await this.send( "GET", @@ -2031,11 +2031,11 @@ export class ApiService implements ApiServiceAbstraction { "/organizations/" + organizationId + "/users/" + id + "/events", start, end, - token + token, ), null, true, - true + true, ); return new ListResponse(r, EventResponse); } @@ -2044,14 +2044,14 @@ export class ApiService implements ApiServiceAbstraction { id: string, start: string, end: string, - token: string + token: string, ): Promise> { const r = await this.send( "GET", this.addEventParameters("/providers/" + id + "/events", start, end, token), null, true, - true + true, ); return new ListResponse(r, EventResponse); } @@ -2061,7 +2061,7 @@ export class ApiService implements ApiServiceAbstraction { id: string, start: string, end: string, - token: string + token: string, ): Promise> { const r = await this.send( "GET", @@ -2069,11 +2069,11 @@ export class ApiService implements ApiServiceAbstraction { "/providers/" + providerId + "/users/" + id + "/events", start, end, - token + token, ), null, true, - true + true, ); return new ListResponse(r, EventResponse); } @@ -2095,7 +2095,7 @@ export class ApiService implements ApiServiceAbstraction { method: "POST", body: JSON.stringify(request), headers: headers, - }) + }), ); if (response.status !== 200) { return Promise.reject("Event post failed."); @@ -2141,7 +2141,7 @@ export class ApiService implements ApiServiceAbstraction { Accept: "application/json", Authorization: "Bearer " + authHeader, }), - }) + }), ); if (response.status !== 200) { @@ -2154,7 +2154,7 @@ export class ApiService implements ApiServiceAbstraction { async postUserKeyToKeyConnector( keyConnectorUrl: string, - request: KeyConnectorUserKeyRequest + request: KeyConnectorUserKeyRequest, ): Promise { const authHeader = await this.getActiveBearerToken(); @@ -2168,7 +2168,7 @@ export class ApiService implements ApiServiceAbstraction { "Content-Type": "application/json; charset=utf-8", }), body: JSON.stringify(request), - }) + }), ); if (response.status !== 200) { @@ -2186,7 +2186,7 @@ export class ApiService implements ApiServiceAbstraction { Accept: "application/json", "Content-Type": "application/json; charset=utf-8", }), - }) + }), ); if (response.status !== 200) { @@ -2214,7 +2214,7 @@ export class ApiService implements ApiServiceAbstraction { request.headers.set("Bitwarden-Client-Name", this.platformUtilsService.getClientType()); request.headers.set( "Bitwarden-Client-Version", - await this.platformUtilsService.getApplicationVersion() + await this.platformUtilsService.getApplicationVersion(), ); return this.nativeFetch(request); } @@ -2242,7 +2242,7 @@ export class ApiService implements ApiServiceAbstraction { credentials: this.getCredentials(), headers: headers, method: "GET", - }) + }), ); if (response.status === 200) { @@ -2255,14 +2255,14 @@ export class ApiService implements ApiServiceAbstraction { async postCreateSponsorship( sponsoredOrgId: string, - request: OrganizationSponsorshipCreateRequest + request: OrganizationSponsorshipCreateRequest, ): Promise { return await this.send( "POST", "/organization/sponsorship/" + sponsoredOrgId + "/families-for-enterprise", request, true, - false + false, ); } @@ -2272,7 +2272,7 @@ export class ApiService implements ApiServiceAbstraction { "/organization/sponsorship/" + sponsoringOrganizationId, null, true, - false + false, ); } @@ -2282,7 +2282,7 @@ export class ApiService implements ApiServiceAbstraction { "/organization/sponsorship/sponsored/" + sponsoringOrgId, null, true, - false + false, ); } @@ -2293,21 +2293,21 @@ export class ApiService implements ApiServiceAbstraction { encodeURIComponent(sponsorshipToken), null, true, - true + true, ); return r as boolean; } async postRedeemSponsorship( sponsorshipToken: string, - request: OrganizationSponsorshipRedeemRequest + request: OrganizationSponsorshipRedeemRequest, ): Promise { return await this.send( "POST", "/organization/sponsorship/redeem?sponsorshipToken=" + encodeURIComponent(sponsorshipToken), request, true, - false + false, ); } @@ -2317,7 +2317,7 @@ export class ApiService implements ApiServiceAbstraction { "/organization/sponsorship/" + sponsoringOrgId + "/families-for-enterprise/resend", null, true, - false + false, ); } @@ -2362,7 +2362,7 @@ export class ApiService implements ApiServiceAbstraction { credentials: this.getCredentials(), headers: headers, method: "POST", - }) + }), ); if (response.status === 200) { @@ -2371,7 +2371,7 @@ export class ApiService implements ApiServiceAbstraction { await this.tokenService.setTokens( tokenResponse.accessToken, tokenResponse.refreshToken, - null + null, ); } else { const error = await this.handleError(response, true, true); @@ -2390,7 +2390,7 @@ export class ApiService implements ApiServiceAbstraction { clientId, clientSecret, new TokenRequestTwoFactor(), - deviceRequest + deviceRequest, ); const response = await this.postIdentityToken(tokenRequest); @@ -2408,7 +2408,7 @@ export class ApiService implements ApiServiceAbstraction { authed: boolean, hasResponse: boolean, apiUrl?: string, - alterHeaders?: (headers: Headers) => void + alterHeaders?: (headers: Headers) => void, ): Promise { apiUrl = Utils.isNullOrWhitespace(apiUrl) ? this.environmentService.getApiUrl() : apiUrl; @@ -2470,7 +2470,7 @@ export class ApiService implements ApiServiceAbstraction { private async handleError( response: Response, tokenError: boolean, - authed: boolean + authed: boolean, ): Promise { if ( authed && diff --git a/jslib/common/src/services/audit.service.ts b/jslib/common/src/services/audit.service.ts index 4ceebf67..f854389a 100644 --- a/jslib/common/src/services/audit.service.ts +++ b/jslib/common/src/services/audit.service.ts @@ -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") diff --git a/jslib/common/src/services/auth.service.ts b/jslib/common/src/services/auth.service.ts index fe4542b8..9768a3c7 100644 --- a/jslib/common/src/services/auth.service.ts +++ b/jslib/common/src/services/auth.service.ts @@ -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 { 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 { if (this.logInStrategy == null) { throw new Error(this.i18nService.t("sessionTimeout")); diff --git a/jslib/common/src/services/azureFileUpload.service.ts b/jslib/common/src/services/azureFileUpload.service.ts index d7017bfb..bcfcda17 100644 --- a/jslib/common/src/services/azureFileUpload.service.ts +++ b/jslib/common/src/services/azureFileUpload.service.ts @@ -40,7 +40,7 @@ export class AzureFileUploadService { private async azureUploadBlocks( url: string, data: EncArrayBuffer, - renewalCallback: () => Promise + renewalCallback: () => Promise, ) { 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 + renewalCallback: () => Promise, ): Promise { const urlObject = Utils.getUrl(url); const expiry = new Date(urlObject.searchParams.get("se") ?? ""); @@ -183,10 +183,10 @@ class Version { return a.year !== b.year ? a.year - b.year : a.month !== b.month - ? a.month - b.month - : a.day !== b.day - ? a.day - b.day - : 0; + ? a.month - b.month + : a.day !== b.day + ? a.day - b.day + : 0; } year = 0; month = 0; diff --git a/jslib/common/src/services/bitwardenFileUpload.service.ts b/jslib/common/src/services/bitwardenFileUpload.service.ts index dd189e3e..0347a902 100644 --- a/jslib/common/src/services/bitwardenFileUpload.service.ts +++ b/jslib/common/src/services/bitwardenFileUpload.service.ts @@ -8,7 +8,7 @@ export class BitwardenFileUploadService { async upload( encryptedFileName: string, encryptedFileData: EncArrayBuffer, - apiCall: (fd: FormData) => Promise + apiCall: (fd: FormData) => Promise, ) { 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; diff --git a/jslib/common/src/services/cipher.service.ts b/jslib/common/src/services/cipher.service.ts index 1deeec8e..876d2d35 100644 --- a/jslib/common/src/services/cipher.service.ts +++ b/jslib/common/src/services/cipher.service.ts @@ -50,7 +50,7 @@ const DomainMatchBlacklist = new Map>([ 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 { @@ -87,7 +87,7 @@ export class CipherService implements CipherServiceAbstraction { async encrypt( model: CipherView, key?: SymmetricCryptoKey, - originalCipher: Cipher = null + originalCipher: Cipher = null, ): Promise { // 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 { 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 { if (!phModels || !phModels.length) { return null; @@ -281,7 +281,7 @@ export class CipherService implements CipherServiceAbstraction { async encryptPasswordHistory( phModel: PasswordHistoryView, - key: SymmetricCryptoKey + key: SymmetricCryptoKey, ): Promise { 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 { 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 { const attachmentPromises: Promise[] = []; 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 { const promises: Promise[] = []; 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 { 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 { 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 { 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 { 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; diff --git a/jslib/common/src/services/collection.service.ts b/jslib/common/src/services/collection.service.ts index 4d3563d7..be8ceb3d 100644 --- a/jslib/common/src/services/collection.service.ts +++ b/jslib/common/src/services/collection.service.ts @@ -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 { diff --git a/jslib/common/src/services/consoleLog.service.ts b/jslib/common/src/services/consoleLog.service.ts index 9959ef62..3b33f13a 100644 --- a/jslib/common/src/services/consoleLog.service.ts +++ b/jslib/common/src/services/consoleLog.service.ts @@ -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) { diff --git a/jslib/common/src/services/crypto.service.ts b/jslib/common/src/services/crypto.service.ts index c49d7763..28b13c5d 100644 --- a/jslib/common/src/services/crypto.service.ts +++ b/jslib/common/src/services/crypto.service.ts @@ -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 { @@ -57,7 +57,7 @@ export class CryptoService implements CryptoServiceAbstraction { async setOrgKeys( orgs: ProfileOrganizationResponse[], - providerOrgs: ProfileProviderOrganizationResponse[] + providerOrgs: ProfileProviderOrganizationResponse[], ): Promise { const orgKeys: any = {}; orgs.forEach((org) => { @@ -105,7 +105,7 @@ export class CryptoService implements CryptoServiceAbstraction { async getKeyFromStorage( keySuffix: KeySuffixOptions, - userId?: string + userId?: string, ): Promise { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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) { diff --git a/jslib/common/src/services/environment.service.ts b/jslib/common/src/services/environment.service.ts index 16683201..4ae8749f 100644 --- a/jslib/common/src/services/environment.service.ts +++ b/jslib/common/src/services/environment.service.ts @@ -27,7 +27,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction { distinctUntilChanged((oldUserId: string, newUserId: string) => oldUserId == newUserId), concatMap(async () => { await this.setUrlsFromStorage(); - }) + }), ) .subscribe(); } diff --git a/jslib/common/src/services/event.service.ts b/jslib/common/src/services/event.service.ts index c0024d49..00f928b5 100644 --- a/jslib/common/src/services/event.service.ts +++ b/jslib/common/src/services/event.service.ts @@ -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 { const authed = await this.stateService.getIsAuthenticated(); if (!authed) { diff --git a/jslib/common/src/services/fileUpload.service.ts b/jslib/common/src/services/fileUpload.service.ts index 6fc0af35..aafe4178 100644 --- a/jslib/common/src/services/fileUpload.service.ts +++ b/jslib/common/src/services/fileUpload.service.ts @@ -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; } diff --git a/jslib/common/src/services/folder.service.ts b/jslib/common/src/services/folder.service.ts index 666ca6d2..7c0b2a08 100644 --- a/jslib/common/src/services/folder.service.ts +++ b/jslib/common/src/services/folder.service.ts @@ -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 { diff --git a/jslib/common/src/services/i18n.service.ts b/jslib/common/src/services/i18n.service.ts index fda8f839..9d4f12e5 100644 --- a/jslib/common/src/services/i18n.service.ts +++ b/jslib/common/src/services/i18n.service.ts @@ -71,7 +71,7 @@ export class I18nService implements I18nServiceAbstraction { constructor( protected systemLanguage: string, protected localesDirectory: string, - protected getLocalesJson: (formattedLocale: string) => Promise + protected getLocalesJson: (formattedLocale: string) => Promise, ) { this.systemLanguage = systemLanguage.replace("_", "-"); } @@ -166,7 +166,7 @@ export class I18nService implements I18nServiceAbstraction { } messagesObj[prop] = messagesObj[prop].replace( new RegExp(replaceToken, "g"), - replaceContent + replaceContent, ); } } diff --git a/jslib/common/src/services/keyConnector.service.ts b/jslib/common/src/services/keyConnector.service.ts index c7e8b991..803a3e52 100644 --- a/jslib/common/src/services/keyConnector.service.ts +++ b/jslib/common/src/services/keyConnector.service.ts @@ -22,7 +22,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction { private tokenService: TokenService, private logService: LogService, private organizationService: OrganizationService, - private cryptoFunctionService: CryptoFunctionService + private cryptoFunctionService: CryptoFunctionService, ) {} setUsesKeyConnector(usesKeyConnector: boolean) { @@ -49,7 +49,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction { try { await this.apiService.postUserKeyToKeyConnector( organization.keyConnectorUrl, - keyConnectorRequest + keyConnectorRequest, ); } catch (e) { throw new Error("Unable to reach key connector"); @@ -77,7 +77,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction { o.keyConnectorEnabled && o.type !== OrganizationUserType.Admin && o.type !== OrganizationUserType.Owner && - !o.isProviderUser + !o.isProviderUser, ); } @@ -89,7 +89,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction { Utils.fromBufferToB64(password), await this.tokenService.getEmail(), kdf, - kdfIterations + kdfIterations, ); const keyConnectorRequest = new KeyConnectorUserKeyRequest(k.encKeyB64); await this.cryptoService.setKey(k); @@ -111,7 +111,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction { kdf, kdfIterations, orgId, - keys + keys, ); await this.apiService.postSetKeyConnectorKey(setPasswordRequest); } diff --git a/jslib/common/src/services/notifications.service.ts b/jslib/common/src/services/notifications.service.ts index d4e3fef4..9808f8fd 100644 --- a/jslib/common/src/services/notifications.service.ts +++ b/jslib/common/src/services/notifications.service.ts @@ -33,7 +33,7 @@ export class NotificationsService implements NotificationsServiceAbstraction { private environmentService: EnvironmentService, private logoutCallback: () => Promise, private logService: LogService, - private stateService: StateService + private stateService: StateService, ) { this.environmentService.urls.subscribe(() => { if (!this.inited) { @@ -73,7 +73,7 @@ export class NotificationsService implements NotificationsServiceAbstraction { .build(); this.signalrConnection.on("ReceiveMessage", (data: any) => - this.processNotification(new NotificationResponse(data)) + this.processNotification(new NotificationResponse(data)), ); // eslint-disable-next-line this.signalrConnection.on("Heartbeat", (data: any) => { @@ -136,7 +136,7 @@ export class NotificationsService implements NotificationsServiceAbstraction { case NotificationType.SyncCipherUpdate: await this.syncService.syncUpsertCipher( notification.payload as SyncCipherNotification, - notification.type === NotificationType.SyncCipherUpdate + notification.type === NotificationType.SyncCipherUpdate, ); break; case NotificationType.SyncCipherDelete: @@ -147,7 +147,7 @@ export class NotificationsService implements NotificationsServiceAbstraction { case NotificationType.SyncFolderUpdate: await this.syncService.syncUpsertFolder( notification.payload as SyncFolderNotification, - notification.type === NotificationType.SyncFolderUpdate + notification.type === NotificationType.SyncFolderUpdate, ); break; case NotificationType.SyncFolderDelete: @@ -176,7 +176,7 @@ export class NotificationsService implements NotificationsServiceAbstraction { case NotificationType.SyncSendUpdate: await this.syncService.syncUpsertSend( notification.payload as SyncSendNotification, - notification.type === NotificationType.SyncSendUpdate + notification.type === NotificationType.SyncSendUpdate, ); break; case NotificationType.SyncSendDelete: diff --git a/jslib/common/src/services/organization.service.ts b/jslib/common/src/services/organization.service.ts index 0ff32e81..368f2209 100644 --- a/jslib/common/src/services/organization.service.ts +++ b/jslib/common/src/services/organization.service.ts @@ -44,7 +44,7 @@ export class OrganizationService implements OrganizationServiceAbstraction { async canManageSponsorships(): Promise { const orgs = await this.getAll(); return orgs.some( - (o) => o.familySponsorshipAvailable || o.familySponsorshipFriendlyName !== null + (o) => o.familySponsorshipAvailable || o.familySponsorshipFriendlyName !== null, ); } diff --git a/jslib/common/src/services/passwordGeneration.service.ts b/jslib/common/src/services/passwordGeneration.service.ts index c752fcd9..8a8b9260 100644 --- a/jslib/common/src/services/passwordGeneration.service.ts +++ b/jslib/common/src/services/passwordGeneration.service.ts @@ -35,7 +35,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr constructor( private cryptoService: CryptoService, private policyService: PolicyService, - private stateService: StateService + private stateService: StateService, ) {} async generatePassword(options: any): Promise { @@ -191,7 +191,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr } async enforcePasswordGeneratorPoliciesOnOptions( - options: any + options: any, ): Promise<[any, PasswordGeneratorPolicyOptions]> { let enforcedPolicyOptions = await this.getPasswordGeneratorPolicyOptions(); if (enforcedPolicyOptions != null) { @@ -475,7 +475,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr } private async encryptHistory( - history: GeneratedPasswordHistory[] + history: GeneratedPasswordHistory[], ): Promise { if (history == null || history.length === 0) { return Promise.resolve([]); @@ -490,7 +490,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr } private async decryptHistory( - history: GeneratedPasswordHistory[] + history: GeneratedPasswordHistory[], ): Promise { if (history == null || history.length === 0) { return Promise.resolve([]); diff --git a/jslib/common/src/services/policy.service.ts b/jslib/common/src/services/policy.service.ts index 91ab864b..3e83ef20 100644 --- a/jslib/common/src/services/policy.service.ts +++ b/jslib/common/src/services/policy.service.ts @@ -19,7 +19,7 @@ export class PolicyService implements PolicyServiceAbstraction { constructor( private stateService: StateService, private organizationService: OrganizationService, - private apiService: ApiService + private apiService: ApiService, ) {} async clearCache(): Promise { @@ -76,7 +76,7 @@ export class PolicyService implements PolicyServiceAbstraction { } async getMasterPasswordPoliciesForInvitedUsers( - orgId: string + orgId: string, ): Promise { const userId = await this.stateService.getUserId(); const response = await this.apiService.getPoliciesByInvitedUser(orgId, userId); @@ -143,7 +143,7 @@ export class PolicyService implements PolicyServiceAbstraction { evaluateMasterPassword( passwordStrength: number, newPassword: string, - enforcedPolicyOptions: MasterPasswordPolicyOptions + enforcedPolicyOptions: MasterPasswordPolicyOptions, ): boolean { if (enforcedPolicyOptions == null) { return true; @@ -185,7 +185,7 @@ export class PolicyService implements PolicyServiceAbstraction { getResetPasswordPolicyOptions( policies: Policy[], - orgId: string + orgId: string, ): [ResetPasswordPolicyOptions, boolean] { const resetPasswordPolicyOptions = new ResetPasswordPolicyOptions(); @@ -194,7 +194,7 @@ export class PolicyService implements PolicyServiceAbstraction { } const policy = policies.find( - (p) => p.organizationId === orgId && p.type === PolicyType.ResetPassword && p.enabled + (p) => p.organizationId === orgId && p.type === PolicyType.ResetPassword && p.enabled, ); resetPasswordPolicyOptions.autoEnrollEnabled = policy?.data?.autoEnrollEnabled ?? false; @@ -213,7 +213,7 @@ export class PolicyService implements PolicyServiceAbstraction { async policyAppliesToUser( policyType: PolicyType, policyFilter?: (policy: Policy) => boolean, - userId?: string + userId?: string, ) { const policies = await this.getAll(policyType, userId); const organizations = await this.organizationService.getAll(userId); @@ -233,7 +233,7 @@ export class PolicyService implements PolicyServiceAbstraction { o.status >= OrganizationUserStatusType.Accepted && o.usePolicies && !this.isExcemptFromPolicies(o, policyType) && - policySet.has(o.id) + policySet.has(o.id), ); } diff --git a/jslib/common/src/services/search.service.ts b/jslib/common/src/services/search.service.ts index e1c54ceb..a5134614 100644 --- a/jslib/common/src/services/search.service.ts +++ b/jslib/common/src/services/search.service.ts @@ -19,7 +19,7 @@ export class SearchService implements SearchServiceAbstraction { constructor( private cipherService: CipherService, private logService: LogService, - private i18nService: I18nService + private i18nService: I18nService, ) { if (["zh-CN", "zh-TW"].indexOf(i18nService.locale) !== -1) { this.searchableMinLength = 1; @@ -88,7 +88,7 @@ export class SearchService implements SearchServiceAbstraction { async searchCiphers( query: string, filter: ((cipher: CipherView) => boolean) | ((cipher: CipherView) => boolean)[] = null, - ciphers: CipherView[] = null + ciphers: CipherView[] = null, ): Promise { const results: CipherView[] = []; if (query != null) { diff --git a/jslib/common/src/services/send.service.ts b/jslib/common/src/services/send.service.ts index 75530db3..73584a9b 100644 --- a/jslib/common/src/services/send.service.ts +++ b/jslib/common/src/services/send.service.ts @@ -27,7 +27,7 @@ export class SendService implements SendServiceAbstraction { private fileUploadService: FileUploadService, private i18nService: I18nService, private cryptoFunctionService: CryptoFunctionService, - private stateService: StateService + private stateService: StateService, ) {} async clearCache(): Promise { @@ -38,7 +38,7 @@ export class SendService implements SendServiceAbstraction { model: SendView, file: File | ArrayBuffer, password: string, - key?: SymmetricCryptoKey + key?: SymmetricCryptoKey, ): Promise<[Send, EncArrayBuffer]> { let fileData: EncArrayBuffer = null; const send = new Send(); @@ -56,7 +56,7 @@ export class SendService implements SendServiceAbstraction { password, model.key, "sha256", - SEND_KDF_ITERATIONS + SEND_KDF_ITERATIONS, ); send.password = Utils.fromBufferToB64(passwordHash); } @@ -74,7 +74,7 @@ export class SendService implements SendServiceAbstraction { const [name, data] = await this.encryptFileData( model.file.fileName, file, - model.cryptoKey + model.cryptoKey, ); send.file.fileName = name; fileData = data; @@ -148,7 +148,7 @@ export class SendService implements SendServiceAbstraction { await this.fileUploadService.uploadSendFile( uploadDataResponse, sendData[0].file.fileName, - sendData[1] + sendData[1], ); } catch (e) { if (e instanceof ErrorResponse && (e as ErrorResponse).statusCode === 404) { @@ -177,7 +177,7 @@ export class SendService implements SendServiceAbstraction { */ async legacyServerSendFileUpload( sendData: [Send, EncArrayBuffer], - request: SendRequest + request: SendRequest, ): Promise { const fd = new FormData(); try { @@ -193,7 +193,7 @@ export class SendService implements SendServiceAbstraction { { filepath: sendData[0].file.fileName.encryptedString, contentType: "application/octet-stream", - } as any + } as any, ); } else { throw e; @@ -271,7 +271,7 @@ export class SendService implements SendServiceAbstraction { const [name, data] = await this.encryptFileData( file.name, evt.target.result as ArrayBuffer, - key + key, ); send.file.fileName = name; resolve(data); @@ -288,7 +288,7 @@ export class SendService implements SendServiceAbstraction { private async encryptFileData( fileName: string, data: ArrayBuffer, - key: SymmetricCryptoKey + key: SymmetricCryptoKey, ): Promise<[EncString, EncArrayBuffer]> { const encFileName = await this.cryptoService.encrypt(fileName, key); const encFileData = await this.cryptoService.encryptToBytes(data, key); diff --git a/jslib/common/src/services/state.service.ts b/jslib/common/src/services/state.service.ts index 78ddaf82..a63463fc 100644 --- a/jslib/common/src/services/state.service.ts +++ b/jslib/common/src/services/state.service.ts @@ -49,7 +49,7 @@ const partialKeys = { export class StateService< TGlobalState extends GlobalState = GlobalState, - TAccount extends Account = Account + TAccount extends Account = Account, > implements StateServiceAbstraction { protected accountsSubject = new BehaviorSubject<{ [userId: string]: TAccount }>({}); @@ -59,7 +59,7 @@ export class StateService< activeAccount$ = this.activeAccountSubject.asObservable(); protected state: State = new State( - this.createGlobals() + this.createGlobals(), ); private hasBeenInited = false; @@ -72,7 +72,7 @@ export class StateService< protected logService: LogService, protected stateMigrationService: StateMigrationService, protected stateFactory: StateFactory, - protected useAccountCache: boolean = true + protected useAccountCache: boolean = true, ) { this.accountDiskCache = new Map(); } @@ -165,7 +165,7 @@ export class StateService< async setAddEditCipherInfo(value: any, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.data.addEditCipherInfo = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -180,12 +180,12 @@ export class StateService< async setAlwaysShowDock(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.alwaysShowDock = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -222,12 +222,12 @@ export class StateService< async setAutoConfirmFingerprints(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.autoConfirmFingerPrints = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -240,12 +240,12 @@ export class StateService< async setAutoFillOnPageLoadDefault(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.autoFillOnPageLoadDefault = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -258,12 +258,12 @@ export class StateService< async setBiometricAwaitingAcceptance(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.biometricAwaitingAcceptance = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -276,12 +276,12 @@ export class StateService< async setBiometricFingerprintValidated(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.biometricFingerprintValidated = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -294,7 +294,7 @@ export class StateService< async setBiometricLocked(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.settings.biometricLocked = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -308,12 +308,12 @@ export class StateService< async setBiometricText(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.biometricText = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -326,12 +326,12 @@ export class StateService< async setBiometricUnlock(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.biometricUnlock = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -341,7 +341,7 @@ export class StateService< } const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); if (account.profile.hasPremiumPersonally) { return true; @@ -366,7 +366,7 @@ export class StateService< return ( ( await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ) )?.settings?.clearClipboard ?? null ); @@ -374,12 +374,12 @@ export class StateService< async setClearClipboard(value: number, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.settings.clearClipboard = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -391,12 +391,12 @@ export class StateService< async setCollapsedGroupings(value: string[], options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.settings.collapsedGroupings = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -408,12 +408,12 @@ export class StateService< async setConvertAccountToKeyConnector(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.profile.convertAccountToKeyConnector = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -424,7 +424,7 @@ export class StateService< async setCryptoMasterKey(value: SymmetricCryptoKey, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.keys.cryptoMasterKey = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -433,7 +433,7 @@ export class StateService< async getCryptoMasterKeyAuto(options?: StorageOptions): Promise { options = this.reconcileOptions( this.reconcileOptions(options, { keySuffix: "auto" }), - await this.defaultSecureStorageOptions() + await this.defaultSecureStorageOptions(), ); if (options?.userId == null) { return null; @@ -444,7 +444,7 @@ export class StateService< async setCryptoMasterKeyAuto(value: string, options?: StorageOptions): Promise { options = this.reconcileOptions( this.reconcileOptions(options, { keySuffix: "auto" }), - await this.defaultSecureStorageOptions() + await this.defaultSecureStorageOptions(), ); if (options?.userId == null) { return; @@ -459,7 +459,7 @@ export class StateService< } return await this.secureStorageService.get( `${options?.userId}${partialKeys.masterKey}`, - options + options, ); } @@ -474,35 +474,35 @@ export class StateService< async getCryptoMasterKeyBiometric(options?: StorageOptions): Promise { options = this.reconcileOptions( this.reconcileOptions(options, { keySuffix: "biometric" }), - await this.defaultSecureStorageOptions() + await this.defaultSecureStorageOptions(), ); if (options?.userId == null) { return null; } return await this.secureStorageService.get( `${options.userId}${partialKeys.biometricKey}`, - options + options, ); } async hasCryptoMasterKeyBiometric(options?: StorageOptions): Promise { options = this.reconcileOptions( this.reconcileOptions(options, { keySuffix: "biometric" }), - await this.defaultSecureStorageOptions() + await this.defaultSecureStorageOptions(), ); if (options?.userId == null) { return false; } return await this.secureStorageService.has( `${options.userId}${partialKeys.biometricKey}`, - options + options, ); } async setCryptoMasterKeyBiometric(value: string, options?: StorageOptions): Promise { options = this.reconcileOptions( this.reconcileOptions(options, { keySuffix: "biometric" }), - await this.defaultSecureStorageOptions() + await this.defaultSecureStorageOptions(), ); if (options?.userId == null) { return; @@ -517,7 +517,7 @@ export class StateService< async setDecodedToken(value: any, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.tokens.decodedToken = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -530,7 +530,7 @@ export class StateService< async setDecryptedCiphers(value: CipherView[], options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.data.ciphers.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -543,7 +543,7 @@ export class StateService< async setDecryptedCollections(value: CollectionView[], options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.data.collections.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -556,10 +556,10 @@ export class StateService< async setDecryptedCryptoSymmetricKey( value: SymmetricCryptoKey, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.keys.cryptoSymmetricKey.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -572,14 +572,14 @@ export class StateService< async setDecryptedFolders(value: FolderView[], options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.data.folders.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); } async getDecryptedOrganizationKeys( - options?: StorageOptions + options?: StorageOptions, ): Promise> { return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))) ?.keys?.organizationKeys?.decrypted; @@ -587,17 +587,17 @@ export class StateService< async setDecryptedOrganizationKeys( value: Map, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.keys.organizationKeys.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); } async getDecryptedPasswordGenerationHistory( - options?: StorageOptions + options?: StorageOptions, ): Promise { return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))) ?.data?.passwordGenerationHistory?.decrypted; @@ -605,10 +605,10 @@ export class StateService< async setDecryptedPasswordGenerationHistory( value: GeneratedPasswordHistory[], - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.data.passwordGenerationHistory.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -621,7 +621,7 @@ export class StateService< async setDecryptedPinProtected(value: EncString, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.settings.pinProtected.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -634,7 +634,7 @@ export class StateService< async setDecryptedPolicies(value: Policy[], options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.data.policies.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -647,14 +647,14 @@ export class StateService< async setDecryptedPrivateKey(value: ArrayBuffer, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.keys.privateKey.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); } async getDecryptedProviderKeys( - options?: StorageOptions + options?: StorageOptions, ): Promise> { return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))) ?.keys?.providerKeys?.decrypted; @@ -662,10 +662,10 @@ export class StateService< async setDecryptedProviderKeys( value: Map, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.keys.providerKeys.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -678,7 +678,7 @@ export class StateService< async setDecryptedSends(value: SendView[], options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.data.sends.decrypted = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -692,12 +692,12 @@ export class StateService< async setDefaultUriMatch(value: UriMatchType, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.defaultUriMatch = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -710,12 +710,12 @@ export class StateService< async setDisableAddLoginNotification(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.disableAddLoginNotification = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -728,12 +728,12 @@ export class StateService< async setDisableAutoBiometricsPrompt(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.disableAutoBiometricsPrompt = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -746,12 +746,12 @@ export class StateService< async setDisableAutoTotpCopy(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.disableAutoTotpCopy = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -764,12 +764,12 @@ export class StateService< async setDisableBadgeCounter(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.disableBadgeCounter = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -782,15 +782,15 @@ export class StateService< async setDisableChangedPasswordNotification( value: boolean, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.disableChangedPasswordNotification = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -803,12 +803,12 @@ export class StateService< async setDisableContextMenuItem(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.disableContextMenuItem = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -816,7 +816,7 @@ export class StateService< return ( ( await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ) )?.disableFavicon ?? false ); @@ -824,12 +824,12 @@ export class StateService< async setDisableFavicon(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); globals.disableFavicon = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -842,12 +842,12 @@ export class StateService< async setDisableGa(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.disableGa = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -860,12 +860,12 @@ export class StateService< async setDontShowCardsCurrentTab(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.dontShowCardsCurrentTab = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -878,12 +878,12 @@ export class StateService< async setDontShowIdentitiesCurrentTab(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.dontShowIdentitiesCurrentTab = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -894,7 +894,7 @@ export class StateService< async setEmail(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.profile.email = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -909,12 +909,12 @@ export class StateService< async setEmailVerified(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.profile.emailVerified = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -930,21 +930,21 @@ export class StateService< async setEnableAlwaysOnTop(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.enableAlwaysOnTop = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableAlwaysOnTop = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -957,12 +957,12 @@ export class StateService< async setEnableAutoFillOnPageLoad(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.enableAutoFillOnPageLoad = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -975,12 +975,12 @@ export class StateService< async setEnableBiometric(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableBiometrics = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -993,12 +993,12 @@ export class StateService< async setEnableBrowserIntegration(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableBrowserIntegration = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1011,15 +1011,15 @@ export class StateService< async setEnableBrowserIntegrationFingerprint( value: boolean, - options?: StorageOptions + options?: StorageOptions, ): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableBrowserIntegrationFingerprint = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1032,12 +1032,12 @@ export class StateService< async setEnableCloseToTray(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableCloseToTray = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1045,7 +1045,7 @@ export class StateService< return ( ( await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ) )?.settings?.enableFullWidth ?? false ); @@ -1053,12 +1053,12 @@ export class StateService< async setEnableFullWidth(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.settings.enableFullWidth = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1066,7 +1066,7 @@ export class StateService< return ( ( await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ) )?.settings?.enableGravitars ?? false ); @@ -1074,12 +1074,12 @@ export class StateService< async setEnableGravitars(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.settings.enableGravitars = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1092,12 +1092,12 @@ export class StateService< async setEnableMinimizeToTray(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableMinimizeToTray = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1110,12 +1110,12 @@ export class StateService< async setEnableStartToTray(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableStartToTray = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1128,12 +1128,12 @@ export class StateService< async setEnableTray(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.enableTray = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1145,20 +1145,20 @@ export class StateService< async setEncryptedCiphers( value: { [id: string]: CipherData }, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); account.data.ciphers.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); } async getEncryptedCollections( - options?: StorageOptions + options?: StorageOptions, ): Promise<{ [id: string]: CollectionData }> { return ( await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions())) @@ -1167,15 +1167,15 @@ export class StateService< async setEncryptedCollections( value: { [id: string]: CollectionData }, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); account.data.collections.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); } @@ -1187,12 +1187,12 @@ export class StateService< async setEncryptedCryptoSymmetricKey(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.keys.cryptoSymmetricKey.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1204,15 +1204,15 @@ export class StateService< async setEncryptedFolders( value: { [id: string]: FolderData }, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); account.data.folders.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); } @@ -1224,20 +1224,20 @@ export class StateService< async setEncryptedOrganizationKeys( value: Map, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.keys.organizationKeys.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } async getEncryptedPasswordGenerationHistory( - options?: StorageOptions + options?: StorageOptions, ): Promise { return ( await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions())) @@ -1246,15 +1246,15 @@ export class StateService< async setEncryptedPasswordGenerationHistory( value: GeneratedPasswordHistory[], - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.data.passwordGenerationHistory.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1266,12 +1266,12 @@ export class StateService< async setEncryptedPinProtected(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.pinProtected.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1283,15 +1283,15 @@ export class StateService< async setEncryptedPolicies( value: { [id: string]: PolicyData }, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.data.policies.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1303,12 +1303,12 @@ export class StateService< async setEncryptedPrivateKey(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.keys.privateKey.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1320,12 +1320,12 @@ export class StateService< async setEncryptedProviderKeys(value: any, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.keys.providerKeys.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1337,15 +1337,15 @@ export class StateService< async setEncryptedSends( value: { [id: string]: SendData }, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); account.data.sends.encrypted = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); } @@ -1357,12 +1357,12 @@ export class StateService< async setEntityId(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.profile.entityId = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1374,12 +1374,12 @@ export class StateService< async setEntityType(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.profile.entityType = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1395,12 +1395,12 @@ export class StateService< // Global values are set on each change and the current global settings are passed to any newly authed accounts. // This is to allow setting environement values before an account is active, while still allowing individual accounts to have their own environments. const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.environmentUrls = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1412,12 +1412,12 @@ export class StateService< async setEquivalentDomains(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.equivalentDomains = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1429,12 +1429,12 @@ export class StateService< async setEventCollection(value: EventData[], options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.data.eventCollection = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1447,7 +1447,7 @@ export class StateService< async setEverBeenUnlocked(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.profile.everBeenUnlocked = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -1462,7 +1462,7 @@ export class StateService< async setForcePasswordReset(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.profile.forcePasswordReset = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -1476,12 +1476,12 @@ export class StateService< async setInstalledVersion(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.installedVersion = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1497,12 +1497,12 @@ export class StateService< async setKdfIterations(value: number, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.profile.kdfIterations = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1514,12 +1514,12 @@ export class StateService< async setKdfType(value: KdfType, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.profile.kdfType = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1531,12 +1531,12 @@ export class StateService< async setKeyHash(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.profile.keyHash = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1545,7 +1545,7 @@ export class StateService< const accountActivity = await this.storageService.get<{ [userId: string]: number }>( keys.accountActivity, - options + options, ); if (accountActivity == null || Object.keys(accountActivity).length < 1) { @@ -1563,7 +1563,7 @@ export class StateService< const accountActivity = (await this.storageService.get<{ [userId: string]: number }>( keys.accountActivity, - options + options, )) ?? {}; accountActivity[options.userId] = value; await this.storageService.save(keys.accountActivity, accountActivity, options); @@ -1577,12 +1577,12 @@ export class StateService< async setLastSync(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); account.profile.lastSync = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); } @@ -1594,12 +1594,12 @@ export class StateService< async setLegacyEtmKey(value: SymmetricCryptoKey, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.keys.legacyEtmKey = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1610,12 +1610,12 @@ export class StateService< } async setLocalData(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.data.localData = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1627,12 +1627,12 @@ export class StateService< async setLocale(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); globals.locale = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1643,7 +1643,7 @@ export class StateService< async setLoginRedirect(value: any, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); globals.loginRedirect = value; await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -1656,7 +1656,7 @@ export class StateService< async setMainWindowSize(value: number, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); globals.mainWindowSize = value; await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -1671,12 +1671,12 @@ export class StateService< async setMinimizeOnCopyToClipboard(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.minimizeOnCopyToClipboard = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1688,12 +1688,12 @@ export class StateService< async setNeverDomains(value: { [id: string]: any }, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.neverDomains = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1706,12 +1706,12 @@ export class StateService< async setNoAutoPromptBiometrics(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.noAutoPromptBiometrics = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1723,12 +1723,12 @@ export class StateService< async setNoAutoPromptBiometricsText(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.noAutoPromptBiometricsText = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1741,12 +1741,12 @@ export class StateService< async setOpenAtLogin(value: boolean, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.openAtLogin = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1757,7 +1757,7 @@ export class StateService< async setOrganizationInvitation(value: any, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); globals.organizationInvitation = value; await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -1771,15 +1771,15 @@ export class StateService< async setOrganizations( value: { [id: string]: OrganizationData }, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.data.organizations = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1791,12 +1791,12 @@ export class StateService< async setPasswordGenerationOptions(value: any, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.passwordGenerationOptions = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1808,12 +1808,12 @@ export class StateService< async setUsernameGenerationOptions(value: any, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.usernameGenerationOptions = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1825,12 +1825,12 @@ export class StateService< async setGeneratorOptions(value: any, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.generatorOptions = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1842,12 +1842,12 @@ export class StateService< async setProtectedPin(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.settings.protectedPin = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1859,15 +1859,15 @@ export class StateService< async setProviders( value: { [id: string]: ProviderData }, - options?: StorageOptions + options?: StorageOptions, ): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.data.providers = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1878,7 +1878,7 @@ export class StateService< async setPublicKey(value: ArrayBuffer, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.keys.publicKey = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -1904,12 +1904,12 @@ export class StateService< async setRememberedEmail(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); globals.rememberedEmail = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1920,7 +1920,7 @@ export class StateService< async setSecurityStamp(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, this.defaultInMemoryOptions) + this.reconcileOptions(options, this.defaultInMemoryOptions), ); account.tokens.securityStamp = value; await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); @@ -1934,12 +1934,12 @@ export class StateService< async setSettings(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); account.settings.settings = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()) + this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()), ); } @@ -1951,12 +1951,12 @@ export class StateService< async setSsoCodeVerifier(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.ssoCodeVerifier = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -1968,12 +1968,12 @@ export class StateService< async setSsoOrganizationIdentifier(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); globals.ssoOrganizationIdentifier = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -1985,12 +1985,12 @@ export class StateService< async setSsoState(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.ssoState = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -2002,12 +2002,12 @@ export class StateService< async setTheme(value: ThemeType, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); globals.theme = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -2019,12 +2019,12 @@ export class StateService< async setTwoFactorToken(value: string, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); globals.twoFactorToken = value; await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -2042,12 +2042,12 @@ export class StateService< async setUsesKeyConnector(value: boolean, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); account.profile.usesKeyConnector = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -2060,12 +2060,12 @@ export class StateService< async setVaultTimeout(value: number, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.settings.vaultTimeout = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -2081,12 +2081,12 @@ export class StateService< async setVaultTimeoutAction(value: string, options?: StorageOptions): Promise { const account = await this.getAccount( - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); account.settings.vaultTimeoutAction = value; await this.saveAccount( account, - this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()), ); } @@ -2109,12 +2109,12 @@ export class StateService< async setWindow(value: WindowState, options?: StorageOptions): Promise { const globals = await this.getGlobals( - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); globals.window = value; return await this.saveGlobals( globals, - this.reconcileOptions(options, await this.defaultOnDiskOptions()) + this.reconcileOptions(options, await this.defaultOnDiskOptions()), ); } @@ -2203,7 +2203,7 @@ export class StateService< ? (await this.secureStorageService.get(options.userId, options)) ?? (await this.storageService.get( options.userId, - this.reconcileOptions(options, { htmlStorageLocation: HtmlStorageLocation.Local }) + this.reconcileOptions(options, { htmlStorageLocation: HtmlStorageLocation.Local }), )) : await this.storageService.get(options.userId, options); @@ -2226,7 +2226,7 @@ export class StateService< options: StorageOptions = { storageLocation: StorageLocation.Both, useSecureStorage: false, - } + }, ) { return this.useMemory(options.storageLocation) ? await this.saveAccountToMemory(account) @@ -2266,8 +2266,8 @@ export class StateService< const storedAccount = await this.getAccount( this.reconcileOptions( { userId: account.profile.userId }, - await this.defaultOnDiskLocalOptions() - ) + await this.defaultOnDiskLocalOptions(), + ), ); // EnvironmentUrls are set before authenticating and should override whatever is stored from any previous session const environmentUrls = account.settings.environmentUrls; @@ -2288,8 +2288,8 @@ export class StateService< account, this.reconcileOptions( { userId: account.profile.userId }, - await this.defaultOnDiskLocalOptions() - ) + await this.defaultOnDiskLocalOptions(), + ), ); } @@ -2297,8 +2297,8 @@ export class StateService< const storedAccount = await this.getAccount( this.reconcileOptions( { userId: account.profile.userId }, - await this.defaultOnDiskMemoryOptions() - ) + await this.defaultOnDiskMemoryOptions(), + ), ); if (storedAccount?.settings != null) { storedAccount.settings.environmentUrls = account.settings.environmentUrls; @@ -2307,20 +2307,20 @@ export class StateService< await this.storageService.save( account.profile.userId, account, - await this.defaultOnDiskMemoryOptions() + await this.defaultOnDiskMemoryOptions(), ); await this.saveAccount( account, this.reconcileOptions( { userId: account.profile.userId }, - await this.defaultOnDiskMemoryOptions() - ) + await this.defaultOnDiskMemoryOptions(), + ), ); } protected async scaffoldNewAccountSessionStorage(account: TAccount): Promise { const storedAccount = await this.getAccount( - this.reconcileOptions({ userId: account.profile.userId }, await this.defaultOnDiskOptions()) + this.reconcileOptions({ userId: account.profile.userId }, await this.defaultOnDiskOptions()), ); if (storedAccount?.settings != null) { storedAccount.settings.environmentUrls = account.settings.environmentUrls; @@ -2329,11 +2329,11 @@ export class StateService< await this.storageService.save( account.profile.userId, account, - await this.defaultOnDiskMemoryOptions() + await this.defaultOnDiskMemoryOptions(), ); await this.saveAccount( account, - this.reconcileOptions({ userId: account.profile.userId }, await this.defaultOnDiskOptions()) + this.reconcileOptions({ userId: account.profile.userId }, await this.defaultOnDiskOptions()), ); } // @@ -2350,7 +2350,7 @@ export class StateService< protected reconcileOptions( requestedOptions: StorageOptions, - defaultOptions: StorageOptions + defaultOptions: StorageOptions, ): StorageOptions { if (requestedOptions == null) { return defaultOptions; @@ -2410,31 +2410,31 @@ export class StateService< } protected async removeAccountFromLocalStorage( - userId: string = this.state.activeUserId + userId: string = this.state.activeUserId, ): Promise { const storedAccount = await this.getAccount( - this.reconcileOptions({ userId: userId }, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions({ userId: userId }, await this.defaultOnDiskLocalOptions()), ); await this.saveAccount( this.resetAccount(storedAccount), - this.reconcileOptions({ userId: userId }, await this.defaultOnDiskLocalOptions()) + this.reconcileOptions({ userId: userId }, await this.defaultOnDiskLocalOptions()), ); } protected async removeAccountFromSessionStorage( - userId: string = this.state.activeUserId + userId: string = this.state.activeUserId, ): Promise { const storedAccount = await this.getAccount( - this.reconcileOptions({ userId: userId }, await this.defaultOnDiskOptions()) + this.reconcileOptions({ userId: userId }, await this.defaultOnDiskOptions()), ); await this.saveAccount( this.resetAccount(storedAccount), - this.reconcileOptions({ userId: userId }, await this.defaultOnDiskOptions()) + this.reconcileOptions({ userId: userId }, await this.defaultOnDiskOptions()), ); } protected async removeAccountFromSecureStorage( - userId: string = this.state.activeUserId + userId: string = this.state.activeUserId, ): Promise { await this.setCryptoMasterKeyAuto(null, { userId: userId }); await this.setCryptoMasterKeyBiometric(null, { userId: userId }); @@ -2493,7 +2493,7 @@ export class StateService< await this.setAccessToken(null, { userId: userId }); await this.setLastActive(null, { userId: userId }); this.state.authenticatedAccounts = this.state.authenticatedAccounts.filter( - (activeUserId) => activeUserId !== userId + (activeUserId) => activeUserId !== userId, ); await this.storageService.save(keys.authenticatedAccounts, this.state.authenticatedAccounts); } diff --git a/jslib/common/src/services/stateMigration.service.ts b/jslib/common/src/services/stateMigration.service.ts index 2b299898..e76acdbb 100644 --- a/jslib/common/src/services/stateMigration.service.ts +++ b/jslib/common/src/services/stateMigration.service.ts @@ -129,12 +129,12 @@ const partialKeys = { export class StateMigrationService< TGlobalState extends GlobalState = GlobalState, - TAccount extends Account = Account + TAccount extends Account = Account, > { constructor( protected storageService: StorageService, protected secureStorageService: StorageService, - protected stateFactory: StateFactory + protected stateFactory: StateFactory, ) {} async needsMigration(): Promise { @@ -334,7 +334,7 @@ export class StateMigrationService< collections: { decrypted: null, encrypted: await this.get<{ [id: string]: CollectionData }>( - v1KeyPrefixes.collections + userId + v1KeyPrefixes.collections + userId, ), }, eventCollection: await this.get(v1Keys.eventCollection), @@ -344,7 +344,7 @@ export class StateMigrationService< }, localData: null, organizations: await this.get<{ [id: string]: OrganizationData }>( - v1KeyPrefixes.organizations + userId + v1KeyPrefixes.organizations + userId, ), passwordGenerationHistory: { decrypted: null, @@ -427,7 +427,7 @@ export class StateMigrationService< await this.secureStorageService.save( `${userId}${partialKeys.biometricKey}`, await this.secureStorageService.get(v1Keys.key, { keySuffix: "biometric" }), - { keySuffix: "biometric" } + { keySuffix: "biometric" }, ); await this.secureStorageService.remove(v1Keys.key, { keySuffix: "biometric" }); } @@ -436,7 +436,7 @@ export class StateMigrationService< await this.secureStorageService.save( `${userId}${partialKeys.autoKey}`, await this.secureStorageService.get(v1Keys.key, { keySuffix: "auto" }), - { keySuffix: "auto" } + { keySuffix: "auto" }, ); await this.secureStorageService.remove(v1Keys.key, { keySuffix: "auto" }); } @@ -444,7 +444,7 @@ export class StateMigrationService< if (await this.secureStorageService.has(v1Keys.key)) { await this.secureStorageService.save( `${userId}${partialKeys.masterKey}`, - await this.secureStorageService.get(v1Keys.key) + await this.secureStorageService.get(v1Keys.key), ); await this.secureStorageService.remove(v1Keys.key); } @@ -463,7 +463,7 @@ export class StateMigrationService< account.profile.hasPremiumPersonally = decodedToken.premium; await this.set(userId, account); } - }) + }), ); const globals = await this.getGlobals(); @@ -480,7 +480,7 @@ export class StateMigrationService< delete account.profile.everBeenUnlocked; return this.set(userId, account); } - }) + }), ); const globals = await this.getGlobals(); diff --git a/jslib/common/src/services/sync.service.ts b/jslib/common/src/services/sync.service.ts index 93611238..f3141266 100644 --- a/jslib/common/src/services/sync.service.ts +++ b/jslib/common/src/services/sync.service.ts @@ -52,7 +52,7 @@ export class SyncService implements SyncServiceAbstraction { private stateService: StateService, private organizationService: OrganizationService, private providerService: ProviderService, - private logoutCallback: (expired: boolean) => Promise + private logoutCallback: (expired: boolean) => Promise, ) {} async getLastSync(): Promise { diff --git a/jslib/common/src/services/system.service.ts b/jslib/common/src/services/system.service.ts index 949b8ca4..8d9385b2 100644 --- a/jslib/common/src/services/system.service.ts +++ b/jslib/common/src/services/system.service.ts @@ -13,7 +13,7 @@ export class SystemService implements SystemServiceAbstraction { private messagingService: MessagingService, private platformUtilsService: PlatformUtilsService, private reloadCallback: () => Promise = null, - private stateService: StateService + private stateService: StateService, ) {} async startProcessReload(): Promise { diff --git a/jslib/common/src/services/token.service.ts b/jslib/common/src/services/token.service.ts index a47cca7c..cfe0c9ad 100644 --- a/jslib/common/src/services/token.service.ts +++ b/jslib/common/src/services/token.service.ts @@ -28,7 +28,7 @@ export class TokenService implements TokenServiceAbstraction { async setTokens( accessToken: string, refreshToken: string, - clientIdClientSecret: [string, string] + clientIdClientSecret: [string, string], ): Promise { await this.setToken(accessToken); await this.setRefreshToken(refreshToken); diff --git a/jslib/common/src/services/totp.service.ts b/jslib/common/src/services/totp.service.ts index 730587c7..d666305f 100644 --- a/jslib/common/src/services/totp.service.ts +++ b/jslib/common/src/services/totp.service.ts @@ -11,7 +11,7 @@ export class TotpService implements TotpServiceAbstraction { constructor( private cryptoFunctionService: CryptoFunctionService, private logService: LogService, - private stateService: StateService + private stateService: StateService, ) {} async getCode(key: string): Promise { @@ -166,7 +166,7 @@ export class TotpService implements TotpServiceAbstraction { private async sign( keyBytes: Uint8Array, timeBytes: Uint8Array, - alg: "sha1" | "sha256" | "sha512" + alg: "sha1" | "sha256" | "sha512", ) { const signature = await this.cryptoFunctionService.hmac(timeBytes.buffer, keyBytes.buffer, alg); return new Uint8Array(signature); diff --git a/jslib/common/src/services/twoFactor.service.ts b/jslib/common/src/services/twoFactor.service.ts index 7720d9be..d58c042d 100644 --- a/jslib/common/src/services/twoFactor.service.ts +++ b/jslib/common/src/services/twoFactor.service.ts @@ -65,7 +65,7 @@ export class TwoFactorService implements TwoFactorServiceAbstraction { constructor( private i18nService: I18nService, - private platformUtilsService: PlatformUtilsService + private platformUtilsService: PlatformUtilsService, ) {} init() { diff --git a/jslib/common/src/services/userVerification.service.ts b/jslib/common/src/services/userVerification.service.ts index 65207ac0..d95d75b9 100644 --- a/jslib/common/src/services/userVerification.service.ts +++ b/jslib/common/src/services/userVerification.service.ts @@ -15,7 +15,7 @@ export class UserVerificationService implements UserVerificationServiceAbstracti constructor( private cryptoService: CryptoService, private i18nService: I18nService, - private apiService: ApiService + private apiService: ApiService, ) {} /** @@ -27,7 +27,7 @@ export class UserVerificationService implements UserVerificationServiceAbstracti async buildRequest( verification: Verification, requestClass?: new () => T, - alreadyHashed?: boolean + alreadyHashed?: boolean, ) { this.validateInput(verification); @@ -63,7 +63,7 @@ export class UserVerificationService implements UserVerificationServiceAbstracti } else { const passwordValid = await this.cryptoService.compareAndUpdateKeyHash( verification.secret, - null + null, ); if (!passwordValid) { throw new Error(this.i18nService.t("invalidMasterPassword")); diff --git a/jslib/common/src/services/usernameGeneration.service.ts b/jslib/common/src/services/usernameGeneration.service.ts index e4201d6e..02d71a27 100644 --- a/jslib/common/src/services/usernameGeneration.service.ts +++ b/jslib/common/src/services/usernameGeneration.service.ts @@ -12,7 +12,10 @@ const DefaultOptions = { }; export class UsernameGenerationService implements BaseUsernameGenerationService { - constructor(private cryptoService: CryptoService, private stateService: StateService) {} + constructor( + private cryptoService: CryptoService, + private stateService: StateService, + ) {} generateUsername(options: any): Promise { if (options.type === "catchall") { diff --git a/jslib/common/src/services/vaultTimeout.service.ts b/jslib/common/src/services/vaultTimeout.service.ts index e5cd1d81..a4468711 100644 --- a/jslib/common/src/services/vaultTimeout.service.ts +++ b/jslib/common/src/services/vaultTimeout.service.ts @@ -31,7 +31,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction { private keyConnectorService: KeyConnectorService, private stateService: StateService, private lockedCallback: (userId?: string) => Promise = null, - private loggedOutCallback: (userId?: string) => Promise = null + private loggedOutCallback: (userId?: string) => Promise = null, ) {} init(checkOnInterval: boolean) { diff --git a/jslib/electron/src/baseMenu.ts b/jslib/electron/src/baseMenu.ts index d2ccd643..d9960199 100644 --- a/jslib/electron/src/baseMenu.ts +++ b/jslib/electron/src/baseMenu.ts @@ -11,7 +11,10 @@ export class BaseMenu { protected macAppMenuItemOptions: MenuItemConstructorOptions[]; protected macWindowSubmenuOptions: MenuItemConstructorOptions[]; - constructor(protected i18nService: I18nService, protected windowMain: WindowMain) {} + constructor( + protected i18nService: I18nService, + protected windowMain: WindowMain, + ) {} protected initProperties() { this.editMenuItemOptions = { diff --git a/jslib/electron/src/services/electronCrypto.service.ts b/jslib/electron/src/services/electronCrypto.service.ts index 52fd68e0..2b479d0f 100644 --- a/jslib/electron/src/services/electronCrypto.service.ts +++ b/jslib/electron/src/services/electronCrypto.service.ts @@ -11,7 +11,7 @@ export class ElectronCryptoService extends CryptoService { cryptoFunctionService: CryptoFunctionService, platformUtilService: PlatformUtilsService, logService: LogService, - stateService: StateService + stateService: StateService, ) { super(cryptoFunctionService, platformUtilService, logService, stateService); } @@ -61,7 +61,7 @@ export class ElectronCryptoService extends CryptoService { } } catch (e) { this.logService.error( - `Encountered error while upgrading obsolete Bitwarden secure storage item:` + `Encountered error while upgrading obsolete Bitwarden secure storage item:`, ); this.logService.error(e); } diff --git a/jslib/electron/src/services/electronLog.service.ts b/jslib/electron/src/services/electronLog.service.ts index b596d1cf..24d8fa09 100644 --- a/jslib/electron/src/services/electronLog.service.ts +++ b/jslib/electron/src/services/electronLog.service.ts @@ -8,7 +8,10 @@ import { ConsoleLogService as BaseLogService } from "@/jslib/common/src/services import { isDev } from "../utils"; export class ElectronLogService extends BaseLogService { - constructor(protected filter: (level: LogLevelType) => boolean = null, logDir: string = null) { + constructor( + protected filter: (level: LogLevelType) => boolean = null, + logDir: string = null, + ) { super(isDev(), filter); if (log.transports == null) { return; diff --git a/jslib/electron/src/services/electronMainMessaging.service.ts b/jslib/electron/src/services/electronMainMessaging.service.ts index db85b3f0..316f2979 100644 --- a/jslib/electron/src/services/electronMainMessaging.service.ts +++ b/jslib/electron/src/services/electronMainMessaging.service.ts @@ -7,7 +7,10 @@ import { RendererMenuItem } from "../utils"; import { WindowMain } from "../window.main"; export class ElectronMainMessagingService implements MessagingService { - constructor(private windowMain: WindowMain, private onMessage: (message: any) => void) { + constructor( + private windowMain: WindowMain, + private onMessage: (message: any) => void, + ) { ipcMain.handle("appVersion", () => { return app.getVersion(); }); @@ -31,7 +34,7 @@ export class ElectronMainMessagingService implements MessagingService { click: () => { resolve(index); }, - }) + }), ); }); menu.popup({ @@ -50,7 +53,7 @@ export class ElectronMainMessagingService implements MessagingService { nativeTheme.on("updated", () => { windowMain.win?.webContents.send( "systemThemeUpdated", - nativeTheme.shouldUseDarkColors ? ThemeType.Dark : ThemeType.Light + nativeTheme.shouldUseDarkColors ? ThemeType.Dark : ThemeType.Light, ); }); } diff --git a/jslib/electron/src/services/electronPlatformUtils.service.ts b/jslib/electron/src/services/electronPlatformUtils.service.ts index 3bea8402..4ecad8cf 100644 --- a/jslib/electron/src/services/electronPlatformUtils.service.ts +++ b/jslib/electron/src/services/electronPlatformUtils.service.ts @@ -18,7 +18,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { protected i18nService: I18nService, private messagingService: MessagingService, private isDesktopApp: boolean, - private stateService: StateService + private stateService: StateService, ) { this.clientType = isDesktopApp ? ClientType.Desktop : ClientType.DirectoryConnector; } @@ -115,7 +115,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { type: "error" | "success" | "warning" | "info", title: string, text: string | string[], - options?: any + options?: any, ): void { this.messagingService.send("showToast", { text: text, @@ -130,7 +130,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { title?: string, confirmText?: string, cancelText?: string, - type?: string + type?: string, ): Promise { const buttons = [confirmText == null ? this.i18nService.t("ok") : confirmText]; if (cancelText != null) { @@ -198,7 +198,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { onDefaultSystemThemeChange(callback: (theme: ThemeType.Light | ThemeType.Dark) => unknown) { ipcRenderer.on("systemThemeUpdated", (event, theme: ThemeType.Light | ThemeType.Dark) => - callback(theme) + callback(theme), ); } diff --git a/jslib/electron/src/tray.main.ts b/jslib/electron/src/tray.main.ts index b30338b4..ca2e53dd 100644 --- a/jslib/electron/src/tray.main.ts +++ b/jslib/electron/src/tray.main.ts @@ -18,7 +18,7 @@ export class TrayMain { constructor( private windowMain: WindowMain, private i18nService: I18nService, - private stateService: StateService + private stateService: StateService, ) { if (process.platform === "win32") { this.icon = path.join(__dirname, "/images/icon.ico"); @@ -27,7 +27,7 @@ export class TrayMain { nImage.setTemplateImage(true); this.icon = nImage; this.pressedIcon = nativeImage.createFromPath( - path.join(__dirname, "/images/icon-highlight.png") + path.join(__dirname, "/images/icon-highlight.png"), ); } else { this.icon = path.join(__dirname, "/images/icon.png"); diff --git a/jslib/electron/src/updater.main.ts b/jslib/electron/src/updater.main.ts index dfeef617..4d6ec9a8 100644 --- a/jslib/electron/src/updater.main.ts +++ b/jslib/electron/src/updater.main.ts @@ -22,7 +22,7 @@ export class UpdaterMain { private onCheckingForUpdate: () => void = null, private onReset: () => void = null, private onUpdateDownloaded: () => void = null, - private projectName: string + private projectName: string, ) { autoUpdater.logger = log; @@ -117,7 +117,7 @@ export class UpdaterMain { if (this.doingUpdateCheckWithFeedback) { dialog.showErrorBox( this.i18nService.t("updateError"), - error == null ? this.i18nService.t("unknown") : (error.stack || error).toString() + error == null ? this.i18nService.t("unknown") : (error.stack || error).toString(), ); } diff --git a/jslib/electron/src/window.main.ts b/jslib/electron/src/window.main.ts index dcc481ff..a732ca40 100644 --- a/jslib/electron/src/window.main.ts +++ b/jslib/electron/src/window.main.ts @@ -25,7 +25,7 @@ export class WindowMain { private defaultWidth = 950, private defaultHeight = 600, private argvCallback: (argv: string[]) => void = null, - private createWindowCallback: (win: BrowserWindow) => void + private createWindowCallback: (win: BrowserWindow) => void, ) {} init(): Promise { @@ -102,7 +102,7 @@ export class WindowMain { async createWindow(): Promise { this.windowStates[mainWindowSizeKey] = await this.getWindowState( this.defaultWidth, - this.defaultHeight + this.defaultHeight, ); this.enableAlwaysOnTop = await this.stateService.getEnableAlwaysOnTop(); @@ -144,7 +144,7 @@ export class WindowMain { }), { userAgent: cleanUserAgent(this.win.webContents.userAgent), - } + }, ); // Open the DevTools. diff --git a/jslib/node/spec/services/nodeCryptoFunction.service.spec.ts b/jslib/node/spec/services/nodeCryptoFunction.service.spec.ts index b2b7f1b8..4272a74f 100644 --- a/jslib/node/spec/services/nodeCryptoFunction.service.spec.ts +++ b/jslib/node/spec/services/nodeCryptoFunction.service.spec.ts @@ -80,7 +80,7 @@ describe("NodeCrypto Function Service", () => { prk32Byte, 64, "BnIqJlfnHm0e/2iB/15cbHyR19ARPIcWRp4oNS22CD9BV+" + - "/queOZenPNkDhmlVyL2WZ3OSU5+7ISNF5NhNfvZA==" + "/queOZenPNkDhmlVyL2WZ3OSU5+7ISNF5NhNfvZA==", ); testHkdfExpand("sha512", prk64Byte, 32, "uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlk="); testHkdfExpand( @@ -88,7 +88,7 @@ describe("NodeCrypto Function Service", () => { prk64Byte, 64, "uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlkY5Pv0sB+" + - "MqvaopmkC6sD/j89zDwTV9Ib2fpucUydO8w==" + "MqvaopmkC6sD/j89zDwTV9Ib2fpucUydO8w==", ); it("should fail with prk too small", async () => { @@ -97,7 +97,7 @@ describe("NodeCrypto Function Service", () => { Utils.fromB64ToArray(prk16Byte), "info", 32, - "sha256" + "sha256", ); await expect(f).rejects.toEqual(new Error("prk is too small.")); }); @@ -108,7 +108,7 @@ describe("NodeCrypto Function Service", () => { Utils.fromB64ToArray(prk32Byte), "info", 8161, - "sha256" + "sha256", ); await expect(f).rejects.toEqual(new Error("outputByteSize is too large.")); }); @@ -172,7 +172,7 @@ describe("NodeCrypto Function Service", () => { const encValue = await nodeCryptoFunctionService.aesEncrypt( data.buffer, iv.buffer, - key.buffer + key.buffer, ); expect(Utils.fromBufferToB64(encValue)).toBe("ByUF8vhyX4ddU9gcooznwA=="); }); @@ -186,7 +186,7 @@ describe("NodeCrypto Function Service", () => { const encValue = await nodeCryptoFunctionService.aesEncrypt( data.buffer, iv.buffer, - key.buffer + key.buffer, ); const decValue = await nodeCryptoFunctionService.aesDecrypt(encValue, iv.buffer, key.buffer); expect(Utils.fromBufferToUtf8(decValue)).toBe(value); @@ -214,7 +214,7 @@ describe("NodeCrypto Function Service", () => { const decValue = await nodeCryptoFunctionService.aesDecrypt( data.buffer, iv.buffer, - key.buffer + key.buffer, ); expect(Utils.fromBufferToUtf8(decValue)).toBe("EncryptMe!"); }); @@ -230,7 +230,7 @@ describe("NodeCrypto Function Service", () => { const encValue = await nodeCryptoFunctionService.rsaEncrypt( data.buffer, pubKey.buffer, - "sha1" + "sha1", ); const decValue = await nodeCryptoFunctionService.rsaDecrypt(encValue, privKey.buffer, "sha1"); expect(Utils.fromBufferToUtf8(decValue)).toBe(value); @@ -245,12 +245,12 @@ describe("NodeCrypto Function Service", () => { "A1/p8BQzN9UrbdYxUY2Va5+kPLyfZXF9JsZrjeEXcaclsnHurdxVAJcnbEqYMP3UXV" + "4YAS/mpf+Rxe6/X0WS1boQdA0MAHSgx95hIlAraZYpiMLLiJRKeo2u8YivCdTM9V5vuAEJwf9Tof/qFsFci3sApdbATkorCT" + "zFOIEPF2S1zgperEP23M01mr4dWVdYN18B32YF67xdJHMbFhp5dkQwv9CmscoWq7OE5HIfOb+JAh7BEZb+CmKhM3yWJvoR/D" + - "/5jcercUtK2o+XrzNrL4UQ7yLZcFz6Bfwb/j6ICYvqd/YJwXNE6dwlL57OfwJyCdw2rRYf0/qI00t9u8Iitw==" + "/5jcercUtK2o+XrzNrL4UQ7yLZcFz6Bfwb/j6ICYvqd/YJwXNE6dwlL57OfwJyCdw2rRYf0/qI00t9u8Iitw==", ); const decValue = await nodeCryptoFunctionService.rsaDecrypt( data.buffer, privKey.buffer, - "sha1" + "sha1", ); expect(Utils.fromBufferToUtf8(decValue)).toBe("EncryptMe!"); }); @@ -286,7 +286,7 @@ describe("NodeCrypto Function Service", () => { const randomData = await nodeCryptoFunctionService.randomBytes(16); const randomData2 = await nodeCryptoFunctionService.randomBytes(16); expect( - randomData.byteLength === randomData2.byteLength && randomData !== randomData2 + randomData.byteLength === randomData2.byteLength && randomData !== randomData2, ).toBeTruthy(); }); }); @@ -296,7 +296,7 @@ function testPbkdf2( algorithm: "sha256" | "sha512", regularKey: string, utf8Key: string, - unicodeKey: string + unicodeKey: string, ) { const regularEmail = "user@example.com"; const utf8Email = "üser@example.com"; @@ -329,7 +329,7 @@ function testPbkdf2( Utils.fromUtf8ToArray(regularPassword).buffer, Utils.fromUtf8ToArray(regularEmail).buffer, algorithm, - 5000 + 5000, ); expect(Utils.fromBufferToB64(key)).toBe(regularKey); }); @@ -339,7 +339,7 @@ function testHkdf( algorithm: "sha256" | "sha512", regularKey: string, utf8Key: string, - unicodeKey: string + unicodeKey: string, ) { const ikm = Utils.fromB64ToArray("criAmKtfzxanbgea5/kelQ=="); @@ -376,7 +376,7 @@ function testHkdf( Utils.fromUtf8ToArray(regularSalt).buffer, Utils.fromUtf8ToArray(regularInfo).buffer, 32, - algorithm + algorithm, ); expect(Utils.fromBufferToB64(key)).toBe(regularKey); }); @@ -386,7 +386,7 @@ function testHkdfExpand( algorithm: "sha256" | "sha512", b64prk: string, outputByteSize: number, - b64ExpectedOkm: string + b64ExpectedOkm: string, ) { const info = "info"; @@ -396,7 +396,7 @@ function testHkdfExpand( Utils.fromB64ToArray(b64prk), info, outputByteSize, - algorithm + algorithm, ); expect(Utils.fromBufferToB64(okm)).toBe(b64ExpectedOkm); }); @@ -406,7 +406,7 @@ function testHash( algorithm: "sha1" | "sha256" | "sha512" | "md5", regularHash: string, utf8Hash: string, - unicodeHash: string + unicodeHash: string, ) { const regularValue = "HashMe!!"; const utf8Value = "HǻshMe!!"; @@ -434,7 +434,7 @@ function testHash( const cryptoFunctionService = new NodeCryptoFunctionService(); const hash = await cryptoFunctionService.hash( Utils.fromUtf8ToArray(regularValue).buffer, - algorithm + algorithm, ); expect(Utils.fromBufferToHex(hash)).toBe(regularHash); }); @@ -505,7 +505,7 @@ function testRsaGenerateKeyPair(length: 1024 | 2048 | 4096) { const publicKey = await cryptoFunctionService.rsaExtractPublicKey(keyPair[1]); expect(Utils.fromBufferToB64(keyPair[0])).toBe(Utils.fromBufferToB64(publicKey)); }, - 30000 + 30000, ); } diff --git a/jslib/node/src/cli/baseProgram.ts b/jslib/node/src/cli/baseProgram.ts index fb32b5b8..c69005b4 100644 --- a/jslib/node/src/cli/baseProgram.ts +++ b/jslib/node/src/cli/baseProgram.ts @@ -10,13 +10,13 @@ import { StringResponse } from "./models/response/stringResponse"; export abstract class BaseProgram { constructor( protected stateService: StateService, - private writeLn: (s: string, finalLine: boolean, error: boolean) => void + private writeLn: (s: string, finalLine: boolean, error: boolean) => void, ) {} protected processResponse( response: Response, exitImmediately = false, - dataProcessor: () => string = null + dataProcessor: () => string = null, ) { if (!response.success) { if (process.env.BW_QUIET !== "true") { diff --git a/jslib/node/src/cli/commands/login.command.ts b/jslib/node/src/cli/commands/login.command.ts index 088b20e6..98c7e66f 100644 --- a/jslib/node/src/cli/commands/login.command.ts +++ b/jslib/node/src/cli/commands/login.command.ts @@ -55,7 +55,7 @@ export class LoginCommand { protected cryptoService: CryptoService, protected policyService: PolicyService, protected twoFactorService: TwoFactorService, - clientId: string + clientId: string, ) { this.clientId = clientId; } @@ -167,12 +167,12 @@ export class LoginCommand { ssoCodeVerifier, this.ssoRedirectUri, orgIdentifier, - twoFactor - ) + twoFactor, + ), ); } else { response = await this.authService.logIn( - new PasswordLogInCredentials(email, password, null, twoFactor) + new PasswordLogInCredentials(email, password, null, twoFactor), ); } if (response.captchaSiteKey) { @@ -255,7 +255,7 @@ export class LoginCommand { response = await this.authService.logInTwoFactor( new TokenRequestTwoFactor(selectedProvider.type, twoFactorToken), - null + null, ); } @@ -278,7 +278,7 @@ export class LoginCommand { if (response.resetMasterPassword) { return Response.error( "In order to log in with SSO from the CLI, you must first log in" + - " through the web vault to set your master password." + " through the web vault to set your master password.", ); } @@ -313,8 +313,8 @@ export class LoginCommand { return Response.error( new MessageResponse( "An organization administrator recently changed your master password. In order to access the vault, you must update your master password now via the web vault. You have been logged out.", - null - ) + null, + ), ); } @@ -346,7 +346,7 @@ export class LoginCommand { // Strength & Policy Validation const strengthResult = this.passwordGenerationService.passwordStrength( masterPassword, - this.getPasswordStrengthUserInput() + this.getPasswordStrengthUserInput(), ); // Get New Master Password Re-type @@ -381,11 +381,11 @@ export class LoginCommand { !this.policyService.evaluateMasterPassword( strengthResult.score, masterPassword, - enforcedPolicyOptions + enforcedPolicyOptions, ) ) { return this.updateTempPassword( - "Your new master password does not meet the policy requirements.\n" + "Your new master password does not meet the policy requirements.\n", ); } @@ -395,7 +395,7 @@ export class LoginCommand { masterPassword, this.email.trim().toLowerCase(), kdf, - kdfIterations + kdfIterations, ); const newPasswordHash = await this.cryptoService.hashPassword(masterPassword, newKey); @@ -425,12 +425,12 @@ export class LoginCommand { private async handleCaptchaRequired( twoFactorRequest: TokenRequestTwoFactor, - credentials: PasswordLogInCredentials = null + credentials: PasswordLogInCredentials = null, ): Promise { const badCaptcha = Response.badRequest( "Your authentication request has been flagged and will require user interaction to proceed.\n" + "Please use your API key to validate this request and ensure BW_CLIENTSECRET is correct, if set.\n" + - "(https://bitwarden.com/help/cli-auth-challenges)" + "(https://bitwarden.com/help/cli-auth-challenges)", ); try { @@ -447,7 +447,7 @@ export class LoginCommand { } else { authResultResponse = await this.authService.logInTwoFactor( twoFactorRequest, - captchaClientSecret + captchaClientSecret, ); } @@ -474,7 +474,7 @@ export class LoginCommand { .substr(0, atPosition) .trim() .toLowerCase() - .split(/[^A-Za-z0-9]/) + .split(/[^A-Za-z0-9]/), ); } return userInput; @@ -535,7 +535,7 @@ export class LoginCommand { private async openSsoPrompt( codeChallenge: string, - state: string + state: string, ): Promise<{ ssoCode: string; orgIdentifier: string }> { return new Promise((resolve, reject) => { const callbackServer = http.createServer((req, res) => { @@ -551,13 +551,13 @@ export class LoginCommand { "Success | Bitwarden CLI" + "

Successfully authenticated with the Bitwarden CLI

" + "

You may now close this tab and return to the terminal.

" + - "" + "", ); callbackServer.close(() => resolve({ ssoCode: code, orgIdentifier: orgIdentifier, - }) + }), ); } else { res.writeHead(400); @@ -565,7 +565,7 @@ export class LoginCommand { "Failed | Bitwarden CLI" + "

Something went wrong logging into the Bitwarden CLI

" + "

You may now close this tab and return to the terminal.

" + - "" + "", ); callbackServer.close(() => reject()); } @@ -585,7 +585,7 @@ export class LoginCommand { "&state=" + state + "&codeChallenge=" + - codeChallenge + codeChallenge, ); }); foundPort = true; diff --git a/jslib/node/src/cli/commands/logout.command.ts b/jslib/node/src/cli/commands/logout.command.ts index 77d65e3f..60688a50 100644 --- a/jslib/node/src/cli/commands/logout.command.ts +++ b/jslib/node/src/cli/commands/logout.command.ts @@ -8,7 +8,7 @@ export class LogoutCommand { constructor( private authService: AuthService, private i18nService: I18nService, - private logoutCallback: () => Promise + private logoutCallback: () => Promise, ) {} async run() { diff --git a/jslib/node/src/cli/commands/update.command.ts b/jslib/node/src/cli/commands/update.command.ts index a1221995..a92cbcc1 100644 --- a/jslib/node/src/cli/commands/update.command.ts +++ b/jslib/node/src/cli/commands/update.command.ts @@ -14,7 +14,7 @@ export class UpdateCommand { private i18nService: I18nService, private repoName: string, private executableName: string, - private showExtendedMessage: boolean + private showExtendedMessage: boolean, ) { this.inPkg = !!(process as any).pkg; } @@ -23,7 +23,7 @@ export class UpdateCommand { const currentVersion = await this.platformUtilsService.getApplicationVersion(); const response = await fetch.default( - "https://api.github.com/repos/bitwarden/" + this.repoName + "/releases/latest" + "https://api.github.com/repos/bitwarden/" + this.repoName + "/releases/latest", ); if (response.status === 200) { const responseJson = await response.json(); diff --git a/jslib/node/src/cli/models/response.ts b/jslib/node/src/cli/models/response.ts index d768c51f..3a7880f6 100644 --- a/jslib/node/src/cli/models/response.ts +++ b/jslib/node/src/cli/models/response.ts @@ -11,8 +11,8 @@ export class Response { error.message != null ? error.message : error.toString() === "[object Object]" - ? JSON.stringify(error) - : error.toString(); + ? JSON.stringify(error) + : error.toString(); } res.data = data; return res; diff --git a/jslib/node/src/cli/services/cliPlatformUtils.service.ts b/jslib/node/src/cli/services/cliPlatformUtils.service.ts index d82effd6..927b4ed5 100644 --- a/jslib/node/src/cli/services/cliPlatformUtils.service.ts +++ b/jslib/node/src/cli/services/cliPlatformUtils.service.ts @@ -13,7 +13,10 @@ export class CliPlatformUtilsService implements PlatformUtilsService { private deviceCache: DeviceType = null; - constructor(clientType: ClientType, private packageJson: any) { + constructor( + clientType: ClientType, + private packageJson: any, + ) { this.clientType = clientType; } @@ -109,7 +112,7 @@ export class CliPlatformUtilsService implements PlatformUtilsService { type: "error" | "success" | "warning" | "info", title: string, text: string | string[], - options?: any + options?: any, ): void { throw new Error("Not implemented."); } @@ -119,7 +122,7 @@ export class CliPlatformUtilsService implements PlatformUtilsService { title?: string, confirmText?: string, cancelText?: string, - type?: string + type?: string, ): Promise { throw new Error("Not implemented."); } diff --git a/jslib/node/src/services/lowdbStorage.service.ts b/jslib/node/src/services/lowdbStorage.service.ts index 407b7d81..bd266c74 100644 --- a/jslib/node/src/services/lowdbStorage.service.ts +++ b/jslib/node/src/services/lowdbStorage.service.ts @@ -20,7 +20,7 @@ export class LowdbStorageService implements StorageService { protected logService: LogService, defaults?: any, private dir?: string, - private allowCache = false + private allowCache = false, ) { this.defaults = defaults; } @@ -42,7 +42,7 @@ export class LowdbStorageService implements StorageService { this.dataFilePath = path.join(this.dir, "data.json"); if (!fs.existsSync(this.dataFilePath)) { this.logService.warning( - `Could not find data file, "${this.dataFilePath}"; creating it instead.` + `Could not find data file, "${this.dataFilePath}"; creating it instead.`, ); fs.writeFileSync(this.dataFilePath, "", { mode: 0o600 }); fs.chmodSync(this.dataFilePath, 0o600); @@ -61,14 +61,14 @@ export class LowdbStorageService implements StorageService { } catch (e) { if (e instanceof SyntaxError) { this.logService.warning( - `Error creating lowdb storage adapter, "${e.message}"; emptying data file.` + `Error creating lowdb storage adapter, "${e.message}"; emptying data file.`, ); if (fs.existsSync(this.dataFilePath)) { const backupPath = this.dataFilePath + ".bak"; this.logService.warning(`Writing backup of data file to ${backupPath}`); await fs.copyFile(this.dataFilePath, backupPath, () => { this.logService.warning( - `Error while creating data file backup, "${e.message}". No backup may have been created.` + `Error while creating data file backup, "${e.message}". No backup may have been created.`, ); }); } diff --git a/jslib/node/src/services/nodeApi.service.ts b/jslib/node/src/services/nodeApi.service.ts index 983cdb38..2c31e66a 100644 --- a/jslib/node/src/services/nodeApi.service.ts +++ b/jslib/node/src/services/nodeApi.service.ts @@ -21,7 +21,7 @@ export class NodeApiService extends ApiService { environmentService: EnvironmentService, appIdService: AppIdService, logoutCallback: (expired: boolean) => Promise, - customUserAgent: string = null + customUserAgent: string = null, ) { super( tokenService, @@ -29,7 +29,7 @@ export class NodeApiService extends ApiService { environmentService, appIdService, logoutCallback, - customUserAgent + customUserAgent, ); } diff --git a/jslib/node/src/services/nodeCryptoFunction.service.ts b/jslib/node/src/services/nodeCryptoFunction.service.ts index 3b19aeb7..af9d570d 100644 --- a/jslib/node/src/services/nodeCryptoFunction.service.ts +++ b/jslib/node/src/services/nodeCryptoFunction.service.ts @@ -12,7 +12,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: "sha256" | "sha512", - iterations: number + iterations: number, ): Promise { const len = algorithm === "sha256" ? 32 : 64; const nodePassword = this.toNodeValue(password); @@ -34,7 +34,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { salt: string | ArrayBuffer, info: string | ArrayBuffer, outputByteSize: number, - algorithm: "sha256" | "sha512" + algorithm: "sha256" | "sha512", ): Promise { const saltBuf = this.toArrayBuffer(salt); const prk = await this.hmac(ikm, saltBuf, algorithm); @@ -46,7 +46,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { prk: ArrayBuffer, info: string | ArrayBuffer, outputByteSize: number, - algorithm: "sha256" | "sha512" + algorithm: "sha256" | "sha512", ): Promise { const hashLen = algorithm === "sha256" ? 32 : 64; if (outputByteSize > 255 * hashLen) { @@ -79,7 +79,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { hash( value: string | ArrayBuffer, - algorithm: "sha1" | "sha256" | "sha512" | "md5" + algorithm: "sha1" | "sha256" | "sha512" | "md5", ): Promise { const nodeValue = this.toNodeValue(value); const hash = crypto.createHash(algorithm); @@ -90,7 +90,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { hmac( value: ArrayBuffer, key: ArrayBuffer, - algorithm: "sha1" | "sha256" | "sha512" + algorithm: "sha1" | "sha256" | "sha512", ): Promise { const nodeValue = this.toNodeBuffer(value); const nodeKey = this.toNodeBuffer(key); @@ -121,7 +121,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { hmacFast( value: ArrayBuffer, key: ArrayBuffer, - algorithm: "sha1" | "sha256" | "sha512" + algorithm: "sha1" | "sha256" | "sha512", ): Promise { return this.hmac(value, key, algorithm); } @@ -143,7 +143,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { data: string, iv: string, mac: string, - key: SymmetricCryptoKey + key: SymmetricCryptoKey, ): DecryptParameters { const p = new DecryptParameters(); p.encKey = key.encKey; @@ -182,7 +182,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { rsaEncrypt( data: ArrayBuffer, publicKey: ArrayBuffer, - algorithm: "sha1" | "sha256" + algorithm: "sha1" | "sha256", ): Promise { if (algorithm === "sha256") { throw new Error("Node crypto does not support RSA-OAEP SHA-256"); @@ -196,7 +196,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { rsaDecrypt( data: ArrayBuffer, privateKey: ArrayBuffer, - algorithm: "sha1" | "sha256" + algorithm: "sha1" | "sha256", ): Promise { if (algorithm === "sha256") { throw new Error("Node crypto does not support RSA-OAEP SHA-256"); @@ -242,7 +242,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { const privateKey = Utils.fromByteStringToArray(privateKeyByteString); resolve([publicKey.buffer, privateKey.buffer]); - } + }, ); }); } diff --git a/package-lock.json b/package-lock.json index c34e6e51..a0368f3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -100,7 +100,7 @@ "node-forge": "1.3.1", "node-loader": "2.0.0", "pkg": "5.8.1", - "prettier": "2.8.8", + "prettier": "3.2.2", "rimraf": "3.0.2", "rxjs": "7.8.1", "sass": "1.69.7", @@ -17685,15 +17685,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.2.tgz", + "integrity": "sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" diff --git a/package.json b/package.json index 26335ce2..a16c47f5 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "node-forge": "1.3.1", "node-loader": "2.0.0", "pkg": "5.8.1", - "prettier": "2.8.8", + "prettier": "3.2.2", "rimraf": "3.0.2", "rxjs": "7.8.1", "sass": "1.66.1", @@ -163,7 +163,6 @@ "form-data": "4.0.0", "google-auth-library": "7.14.1", "googleapis": "73.0.0", - "google-auth-library": "7.14.1", "https-proxy-agent": "5.0.1", "inquirer": "8.2.6", "keytar": "7.9.0", diff --git a/scripts/sign.js b/scripts/sign.js index bb1552e0..46d64aa7 100644 --- a/scripts/sign.js +++ b/scripts/sign.js @@ -15,7 +15,7 @@ exports.default = async function (configuration) { `"${configuration.path}"`, { stdio: "inherit", - } + }, ); } }; diff --git a/src/abstractions/state.service.ts b/src/abstractions/state.service.ts index 987a59c3..556d4a5c 100644 --- a/src/abstractions/state.service.ts +++ b/src/abstractions/state.service.ts @@ -19,7 +19,7 @@ export abstract class StateService extends BaseStateServiceAbstraction | GSuiteConfiguration | AzureConfiguration | OktaConfiguration - | OneLoginConfiguration + | OneLoginConfiguration, ) => Promise; getLdapConfiguration: (options?: StorageOptions) => Promise; setLdapConfiguration: (value: LdapConfiguration, options?: StorageOptions) => Promise; @@ -32,7 +32,7 @@ export abstract class StateService extends BaseStateServiceAbstraction getOneLoginConfiguration: (options?: StorageOptions) => Promise; setOneLoginConfiguration: ( value: OneLoginConfiguration, - options?: StorageOptions + options?: StorageOptions, ) => Promise; getOrganizationId: (options?: StorageOptions) => Promise; setOrganizationId: (value: string, options?: StorageOptions) => Promise; diff --git a/src/app/accounts/apiKey.component.ts b/src/app/accounts/apiKey.component.ts index ff260e33..615f1407 100644 --- a/src/app/accounts/apiKey.component.ts +++ b/src/app/accounts/apiKey.component.ts @@ -41,7 +41,7 @@ export class ApiKeyComponent { private platformUtilsService: PlatformUtilsService, private modalService: ModalService, private logService: LogService, - private stateService: StateService + private stateService: StateService, ) {} async submit() { @@ -49,7 +49,7 @@ export class ApiKeyComponent { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), - this.i18nService.t("clientIdRequired") + this.i18nService.t("clientIdRequired"), ); return; } @@ -57,7 +57,7 @@ export class ApiKeyComponent { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), - this.i18nService.t("orgApiKeyRequired") + this.i18nService.t("orgApiKeyRequired"), ); return; } @@ -65,7 +65,7 @@ export class ApiKeyComponent { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), - this.i18nService.t("clientSecretRequired") + this.i18nService.t("clientSecretRequired"), ); return; } @@ -75,14 +75,14 @@ export class ApiKeyComponent { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), - this.i18nService.t("invalidClientId") + this.i18nService.t("invalidClientId"), ); return; } try { this.formPromise = this.authService.logIn( - new ApiLogInCredentials(this.clientId, this.clientSecret) + new ApiLogInCredentials(this.clientId, this.clientSecret), ); await this.formPromise; const organizationId = await this.stateService.getEntityId(); @@ -96,7 +96,7 @@ export class ApiKeyComponent { async settings() { const [modalRef, childComponent] = await this.modalService.openViewRef( EnvironmentComponent, - this.environmentModal + this.environmentModal, ); // eslint-disable-next-line rxjs-angular/prefer-takeuntil diff --git a/src/app/accounts/environment.component.ts b/src/app/accounts/environment.component.ts index c45942ab..e5967716 100644 --- a/src/app/accounts/environment.component.ts +++ b/src/app/accounts/environment.component.ts @@ -13,7 +13,7 @@ export class EnvironmentComponent extends BaseEnvironmentComponent { constructor( environmentService: EnvironmentService, i18nService: I18nService, - platformUtilsService: PlatformUtilsService + platformUtilsService: PlatformUtilsService, ) { super(platformUtilsService, environmentService, i18nService); } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 12201f4d..8d156062 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -45,7 +45,7 @@ export class AppComponent implements OnInit { private messagingService: MessagingService, private syncService: SyncService, private stateService: StateService, - private logService: LogService + private logService: LogService, ) {} ngOnInit() { @@ -123,7 +123,7 @@ export class AppComponent implements OnInit { this.platformUtilsService.showToast( "warning", this.i18nService.t("loggedOut"), - this.i18nService.t("loginExpired") + this.i18nService.t("loginExpired"), ); } this.router.navigate(["login"]); @@ -142,7 +142,7 @@ export class AppComponent implements OnInit { } else { msg.text.forEach( (t: string) => - (message += "

" + this.sanitizer.sanitize(SecurityContext.HTML, t) + "

") + (message += "

" + this.sanitizer.sanitize(SecurityContext.HTML, t) + "

"), ); options.enableHtml = true; } diff --git a/src/app/services/auth-guard.service.ts b/src/app/services/auth-guard.service.ts index 402e3149..59662b33 100644 --- a/src/app/services/auth-guard.service.ts +++ b/src/app/services/auth-guard.service.ts @@ -7,7 +7,10 @@ import { StateService } from "../../abstractions/state.service"; @Injectable() export class AuthGuardService implements CanActivate { - constructor(private stateService: StateService, private messagingService: MessagingService) {} + constructor( + private stateService: StateService, + private messagingService: MessagingService, + ) {} async canActivate() { const isAuthed = await this.stateService.getIsAuthenticated(); diff --git a/src/app/services/launch-guard.service.ts b/src/app/services/launch-guard.service.ts index 14658f8c..07a1e21b 100644 --- a/src/app/services/launch-guard.service.ts +++ b/src/app/services/launch-guard.service.ts @@ -5,7 +5,10 @@ import { StateService } from "../../abstractions/state.service"; @Injectable() export class LaunchGuardService implements CanActivate { - constructor(private stateService: StateService, private router: Router) {} + constructor( + private stateService: StateService, + private router: Router, + ) {} async canActivate() { const isAuthed = await this.stateService.getIsAuthenticated(); diff --git a/src/app/services/services.module.ts b/src/app/services/services.module.ts index d8449b08..d79f1caa 100644 --- a/src/app/services/services.module.ts +++ b/src/app/services/services.module.ts @@ -45,7 +45,7 @@ export function initFactory( i18nService: I18nService, platformUtilsService: PlatformUtilsServiceAbstraction, stateService: StateServiceAbstraction, - cryptoService: CryptoServiceAbstraction + cryptoService: CryptoServiceAbstraction, ): () => Promise { return async () => { await stateService.init(); @@ -108,7 +108,7 @@ export function initFactory( useFactory: ( i18nService: I18nServiceAbstraction, messagingService: MessagingServiceAbstraction, - stateService: StateServiceAbstraction + stateService: StateServiceAbstraction, ) => new ElectronPlatformUtilsService(i18nService, messagingService, false, stateService), deps: [I18nServiceAbstraction, MessagingServiceAbstraction, StateServiceAbstraction], }, @@ -120,7 +120,7 @@ export function initFactory( platformUtilsService: PlatformUtilsServiceAbstraction, environmentService: EnvironmentServiceAbstraction, messagingService: MessagingServiceAbstraction, - appIdService: AppIdServiceAbstraction + appIdService: AppIdServiceAbstraction, ) => new NodeApiService( tokenService, @@ -132,7 +132,7 @@ export function initFactory( platformUtilsService.getApplicationVersion() + " (" + platformUtilsService.getDeviceString().toUpperCase() + - ")" + ")", ), deps: [ TokenServiceAbstraction, @@ -179,12 +179,12 @@ export function initFactory( 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"], }, @@ -194,7 +194,7 @@ export function initFactory( storageService: StorageServiceAbstraction, secureStorageService: StorageServiceAbstraction, logService: LogServiceAbstraction, - stateMigrationService: StateMigrationServiceAbstraction + stateMigrationService: StateMigrationServiceAbstraction, ) => new StateService( storageService, @@ -202,7 +202,7 @@ export function initFactory( logService, stateMigrationService, true, - new StateFactory(GlobalState, Account) + new StateFactory(GlobalState, Account), ), deps: [ StorageServiceAbstraction, diff --git a/src/app/tabs/dashboard.component.html b/src/app/tabs/dashboard.component.html index bd33f23e..14a55919 100644 --- a/src/app/tabs/dashboard.component.html +++ b/src/app/tabs/dashboard.component.html @@ -4,11 +4,11 @@

{{ "lastGroupSync" | i18n }}: - - {{ lastGroupSync | date : "medium" }} + {{ lastGroupSync | date: "medium" }}
{{ "lastUserSync" | i18n }}: - - {{ lastUserSync | date : "medium" }} + {{ lastUserSync | date: "medium" }}

{{ "syncStatus" | i18n }}: diff --git a/src/app/tabs/dashboard.component.ts b/src/app/tabs/dashboard.component.ts index c0ef2f51..7dbaa0c1 100644 --- a/src/app/tabs/dashboard.component.ts +++ b/src/app/tabs/dashboard.component.ts @@ -40,7 +40,7 @@ export class DashboardComponent implements OnInit, OnDestroy { private messagingService: MessagingService, private platformUtilsService: PlatformUtilsService, private changeDetectorRef: ChangeDetectorRef, - private stateService: StateService + private stateService: StateService, ) {} async ngOnInit() { @@ -88,7 +88,7 @@ export class DashboardComponent implements OnInit, OnDestroy { this.platformUtilsService.showToast( "success", null, - this.i18nService.t("syncCounts", groupCount.toString(), userCount.toString()) + this.i18nService.t("syncCounts", groupCount.toString(), userCount.toString()), ); } @@ -103,7 +103,7 @@ export class DashboardComponent implements OnInit, OnDestroy { this.simPromise = ConnectorUtils.simulate( this.syncService, this.i18nService, - this.simSinceLast + this.simSinceLast, ); const result = await this.simPromise; this.simGroups = result.groups; diff --git a/src/app/tabs/more.component.html b/src/app/tabs/more.component.html index b99fb4f8..a1d80ed2 100644 --- a/src/app/tabs/more.component.html +++ b/src/app/tabs/more.component.html @@ -6,7 +6,7 @@

{{ "bitwardenDirectoryConnector" | i18n }}
- {{ "version" | i18n : version }}
+ {{ "version" | i18n: version }}
© Bitwarden Inc. LLC 2015-{{ year }}