mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-24 04:04:29 +00:00
[PM-23631] Delete unused jslib models and misc code (#819)
* Remove unused cipher-related code from jslib - Delete cipher.ts, cipherView.ts, sortedCiphersCache.ts - Delete search-ciphers.pipe.ts and icon.component files - Delete cipherData.ts, cipherResponse.ts, linkedIdType.ts - Delete field-related files (fieldData.ts, field.ts, fieldApi.ts, fieldView.ts) - Delete sync, emergency access, and attachment upload response files - Delete card and identity view files - Delete linkedFieldOption decorator - Remove cipher methods from StateService abstractions and implementations - Preserve ciphers property in AccountData as 'any' type for data compatibility * Remove unused Send feature and related password manager code from jslib - Delete Send domain models: send.ts, sendAccess.ts, sendFile.ts, sendText.ts - Delete Send data models: sendData.ts, sendFileData.ts, sendTextData.ts - Delete Send view models: sendView.ts, sendAccessView.ts, sendFileView.ts, sendTextView.ts - Delete Send API models: sendFileApi.ts, sendTextApi.ts - Delete Send response models: sendAccessResponse.ts, sendFileDownloadDataResponse.ts, sendFileUploadDataResponse.ts, sendResponse.ts - Delete Send enum: sendType.ts - Delete Send specs: send.spec.ts, sendAccess.spec.ts, sendFile.spec.ts, sendText.spec.ts - Remove Send methods from StateService abstractions and implementations - Remove getDecryptedSends/setDecryptedSends and getEncryptedSends/setEncryptedSends methods - Change sends property in AccountData to 'any' type for data compatibility - Fix import formatting and remove empty lines * Remove misc unused password manager models from jslib - Delete Core domain models: card.ts, identity.ts, secureNote.ts, attachment.ts - Delete Core data models: cardData.ts, identityData.ts, secureNoteData.ts, attachmentData.ts - Delete Core view models: secureNoteView.ts, attachmentView.ts - Delete Core API models: cardApi.ts, identityApi.ts, secureNoteApi.ts - Delete Core response models: attachmentResponse.ts - Delete Core enum: secureNoteType.ts - Delete Core specs: card.spec.ts, identity.spec.ts, secureNote.spec.ts, attachment.spec.ts * Remove unused Organization files (folders/collections) - Delete folder and collection domain models, data models, view models, response models, and spec files * Remove unused UI/UX settings methods from state service - Remove 20 password manager specific interface methods: - Autofill methods (4): getAutoFillOnPageLoadDefault, setAutoFillOnPageLoadDefault, getEnableAutoFillOnPageLoad, setEnableAutoFillOnPageLoad - Browser integration methods (4): getEnableBrowserIntegration, setEnableBrowserIntegration, getEnableBrowserIntegrationFingerprint, setEnableBrowserIntegrationFingerprint - Notification methods (4): getDisableAddLoginNotification, setDisableAddLoginNotification, getDisableChangedPasswordNotification, setDisableChangedPasswordNotification - Favicon methods (2): getDisableFavicon, setDisableFavicon - Gravatar methods (2): getEnableGravitars, setEnableGravitars - Card/Identity tab methods (4): getDontShowCardsCurrentTab, setDontShowCardsCurrentTab, getDontShowIdentitiesCurrentTab, setDontShowIdentitiesCurrentTab * Fix build errors * Delete leftover data models and stateService methods * Delete iframes and passwordReprompt
This commit is contained in:
@@ -10,28 +10,16 @@ import { StorageLocation } from "../enums/storageLocation";
|
||||
import { ThemeType } from "../enums/themeType";
|
||||
import { UriMatchType } from "../enums/uriMatchType";
|
||||
import { StateFactory } from "../factories/stateFactory";
|
||||
import { CipherData } from "../models/data/cipherData";
|
||||
import { CollectionData } from "../models/data/collectionData";
|
||||
import { EventData } from "../models/data/eventData";
|
||||
import { FolderData } from "../models/data/folderData";
|
||||
import { OrganizationData } from "../models/data/organizationData";
|
||||
import { PolicyData } from "../models/data/policyData";
|
||||
import { ProviderData } from "../models/data/providerData";
|
||||
import { SendData } from "../models/data/sendData";
|
||||
import { Account, AccountData } from "../models/domain/account";
|
||||
import { EncString } from "../models/domain/encString";
|
||||
import { EnvironmentUrls } from "../models/domain/environmentUrls";
|
||||
import { GeneratedPasswordHistory } from "../models/domain/generatedPasswordHistory";
|
||||
import { GlobalState } from "../models/domain/globalState";
|
||||
import { Policy } from "../models/domain/policy";
|
||||
import { State } from "../models/domain/state";
|
||||
import { StorageOptions } from "../models/domain/storageOptions";
|
||||
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
||||
import { WindowState } from "../models/domain/windowState";
|
||||
import { CipherView } from "../models/view/cipherView";
|
||||
import { CollectionView } from "../models/view/collectionView";
|
||||
import { FolderView } from "../models/view/folderView";
|
||||
import { SendView } from "../models/view/sendView";
|
||||
|
||||
const keys = {
|
||||
global: "global",
|
||||
@@ -231,24 +219,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getAutoFillOnPageLoadDefault(options?: StorageOptions): Promise<boolean> {
|
||||
return (
|
||||
(await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions())))
|
||||
?.settings?.autoFillOnPageLoadDefault ?? true
|
||||
);
|
||||
}
|
||||
|
||||
async setAutoFillOnPageLoadDefault(value: boolean, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.settings.autoFillOnPageLoadDefault = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getBiometricAwaitingAcceptance(options?: StorageOptions): Promise<boolean> {
|
||||
return (
|
||||
(await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions())))
|
||||
@@ -523,32 +493,6 @@ export class StateService<
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedCiphers(options?: StorageOptions): Promise<CipherView[]> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.data?.ciphers?.decrypted;
|
||||
}
|
||||
|
||||
async setDecryptedCiphers(value: CipherView[], options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions),
|
||||
);
|
||||
account.data.ciphers.decrypted = value;
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedCollections(options?: StorageOptions): Promise<CollectionView[]> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.data?.collections?.decrypted;
|
||||
}
|
||||
|
||||
async setDecryptedCollections(value: CollectionView[], options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions),
|
||||
);
|
||||
account.data.collections.decrypted = value;
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedCryptoSymmetricKey(options?: StorageOptions): Promise<SymmetricCryptoKey> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.keys?.cryptoSymmetricKey?.decrypted;
|
||||
@@ -565,19 +509,6 @@ export class StateService<
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedFolders(options?: StorageOptions): Promise<FolderView[]> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.data?.folders?.decrypted;
|
||||
}
|
||||
|
||||
async setDecryptedFolders(value: FolderView[], options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions),
|
||||
);
|
||||
account.data.folders.decrypted = value;
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedOrganizationKeys(
|
||||
options?: StorageOptions,
|
||||
): Promise<Map<string, SymmetricCryptoKey>> {
|
||||
@@ -596,24 +527,6 @@ export class StateService<
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedPasswordGenerationHistory(
|
||||
options?: StorageOptions,
|
||||
): Promise<GeneratedPasswordHistory[]> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.data?.passwordGenerationHistory?.decrypted;
|
||||
}
|
||||
|
||||
async setDecryptedPasswordGenerationHistory(
|
||||
value: GeneratedPasswordHistory[],
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions),
|
||||
);
|
||||
account.data.passwordGenerationHistory.decrypted = value;
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedPinProtected(options?: StorageOptions): Promise<EncString> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.settings?.pinProtected?.decrypted;
|
||||
@@ -627,19 +540,6 @@ export class StateService<
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedPolicies(options?: StorageOptions): Promise<Policy[]> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.data?.policies?.decrypted;
|
||||
}
|
||||
|
||||
async setDecryptedPolicies(value: Policy[], options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions),
|
||||
);
|
||||
account.data.policies.decrypted = value;
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedPrivateKey(options?: StorageOptions): Promise<ArrayBuffer> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.keys?.privateKey?.decrypted;
|
||||
@@ -671,19 +571,6 @@ export class StateService<
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDecryptedSends(options?: StorageOptions): Promise<SendView[]> {
|
||||
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
|
||||
?.data?.sends?.decrypted;
|
||||
}
|
||||
|
||||
async setDecryptedSends(value: SendView[], options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions),
|
||||
);
|
||||
account.data.sends.decrypted = value;
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
}
|
||||
|
||||
async getDefaultUriMatch(options?: StorageOptions): Promise<UriMatchType> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
@@ -1137,48 +1024,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedCiphers(options?: StorageOptions): Promise<{ [id: string]: CipherData }> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()))
|
||||
)?.data?.ciphers?.encrypted;
|
||||
}
|
||||
|
||||
async setEncryptedCiphers(
|
||||
value: { [id: string]: CipherData },
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
account.data.ciphers.encrypted = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedCollections(
|
||||
options?: StorageOptions,
|
||||
): Promise<{ [id: string]: CollectionData }> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()))
|
||||
)?.data?.collections?.encrypted;
|
||||
}
|
||||
|
||||
async setEncryptedCollections(
|
||||
value: { [id: string]: CollectionData },
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
account.data.collections.encrypted = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedCryptoSymmetricKey(options?: StorageOptions): Promise<string> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
@@ -1196,26 +1041,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedFolders(options?: StorageOptions): Promise<{ [id: string]: FolderData }> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()))
|
||||
)?.data?.folders?.encrypted;
|
||||
}
|
||||
|
||||
async setEncryptedFolders(
|
||||
value: { [id: string]: FolderData },
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
account.data.folders.encrypted = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedOrganizationKeys(options?: StorageOptions): Promise<any> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
@@ -1236,28 +1061,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedPasswordGenerationHistory(
|
||||
options?: StorageOptions,
|
||||
): Promise<GeneratedPasswordHistory[]> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
)?.data?.passwordGenerationHistory?.encrypted;
|
||||
}
|
||||
|
||||
async setEncryptedPasswordGenerationHistory(
|
||||
value: GeneratedPasswordHistory[],
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.data.passwordGenerationHistory.encrypted = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedPinProtected(options?: StorageOptions): Promise<string> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
@@ -1275,26 +1078,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedPolicies(options?: StorageOptions): Promise<{ [id: string]: PolicyData }> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
)?.data?.policies?.encrypted;
|
||||
}
|
||||
|
||||
async setEncryptedPolicies(
|
||||
value: { [id: string]: PolicyData },
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.data.policies.encrypted = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedPrivateKey(options?: StorageOptions): Promise<string> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
@@ -1329,26 +1112,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEncryptedSends(options?: StorageOptions): Promise<{ [id: string]: SendData }> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()))
|
||||
)?.data?.sends.encrypted;
|
||||
}
|
||||
|
||||
async setEncryptedSends(
|
||||
value: { [id: string]: SendData },
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
account.data.sends.encrypted = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskMemoryOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getEntityId(options?: StorageOptions): Promise<string> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
|
||||
@@ -1393,23 +1156,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEventCollection(options?: StorageOptions): Promise<EventData[]> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
)?.data?.eventCollection;
|
||||
}
|
||||
|
||||
async setEventCollection(value: EventData[], options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.data.eventCollection = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getEverBeenUnlocked(options?: StorageOptions): Promise<boolean> {
|
||||
return (
|
||||
(await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))?.profile
|
||||
|
||||
Reference in New Issue
Block a user