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

Upgrade prettier (#409)

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,7 +13,7 @@ export class BoxRowDirective implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.formEls = Array.from( 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) => { this.formEls.forEach((formEl) => {
formEl.addEventListener( formEl.addEventListener(
@@ -21,7 +21,7 @@ export class BoxRowDirective implements OnInit {
() => { () => {
this.el.classList.add("active"); this.el.classList.add("active");
}, },
false false,
); );
formEl.addEventListener( formEl.addEventListener(
@@ -29,7 +29,7 @@ export class BoxRowDirective implements OnInit {
() => { () => {
this.el.classList.remove("active"); this.el.classList.remove("active");
}, },
false false,
); );
}); });
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,8 @@
/* eslint-disable no-useless-escape */ /* eslint-disable no-useless-escape */
import { I18nService } from "../abstractions/i18n.service";
import * as tldjs from "tldjs"; import * as tldjs from "tldjs";
import { I18nService } from "../abstractions/i18n.service";
const nodeURL = typeof window === "undefined" ? require("url") : null; const nodeURL = typeof window === "undefined" ? require("url") : null;
@@ -185,7 +186,7 @@ export class Utils {
static isGuid(id: string) { static isGuid(id: string) {
return RegExp( 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}$/, /^[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); ).test(id);
} }
@@ -279,7 +280,7 @@ export class Utils {
} }
map.set( map.set(
decodeURIComponent(parts[0]).toLowerCase(), decodeURIComponent(parts[0]).toLowerCase(),
parts[1] == null ? "" : decodeURIComponent(parts[1]) parts[1] == null ? "" : decodeURIComponent(parts[1]),
); );
}); });
return map; return map;
@@ -359,10 +360,10 @@ export class Utils {
((a) => { ((a) => {
if ( 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( /(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( /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; mobile = true;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -40,7 +40,7 @@ export class AzureFileUploadService {
private async azureUploadBlocks( private async azureUploadBlocks(
url: string, url: string,
data: EncArrayBuffer, data: EncArrayBuffer,
renewalCallback: () => Promise<string> renewalCallback: () => Promise<string>,
) { ) {
const baseUrl = Utils.getUrl(url); const baseUrl = Utils.getUrl(url);
const blockSize = this.getMaxBlockSize(baseUrl.searchParams.get("sv")); const blockSize = this.getMaxBlockSize(baseUrl.searchParams.get("sv"));
@@ -50,7 +50,7 @@ export class AzureFileUploadService {
if (numBlocks > MAX_BLOCKS_PER_BLOB) { if (numBlocks > MAX_BLOCKS_PER_BLOB) {
throw new Error( 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( private async renewUrlIfNecessary(
url: string, url: string,
renewalCallback: () => Promise<string> renewalCallback: () => Promise<string>,
): Promise<string> { ): Promise<string> {
const urlObject = Utils.getUrl(url); const urlObject = Utils.getUrl(url);
const expiry = new Date(urlObject.searchParams.get("se") ?? ""); const expiry = new Date(urlObject.searchParams.get("se") ?? "");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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