import { Observable } from "rxjs"; import { UriMatchStrategySetting } from "../../models/domain/domain-service"; import { SymmetricCryptoKey } from "../../platform/models/domain/symmetric-crypto-key"; import { CipherId, CollectionId, OrganizationId } from "../../types/guid"; import { CipherType } from "../enums/cipher-type"; import { CipherData } from "../models/data/cipher.data"; import { Cipher } from "../models/domain/cipher"; import { Field } from "../models/domain/field"; import { CipherView } from "../models/view/cipher.view"; import { FieldView } from "../models/view/field.view"; import { AddEditCipherInfo } from "../types/add-edit-cipher-info"; export abstract class CipherService { /** * An observable monitoring the add/edit cipher info saved to memory. */ addEditCipherInfo$: Observable; clearCache: (userId?: string) => Promise; encrypt: ( model: CipherView, keyForEncryption?: SymmetricCryptoKey, keyForCipherKeyDecryption?: SymmetricCryptoKey, originalCipher?: Cipher, ) => Promise; encryptFields: (fieldsModel: FieldView[], key: SymmetricCryptoKey) => Promise; encryptField: (fieldModel: FieldView, key: SymmetricCryptoKey) => Promise; get: (id: string) => Promise; getAll: () => Promise; getAllDecrypted: () => Promise; getAllDecryptedForGrouping: (groupingId: string, folder?: boolean) => Promise; getAllDecryptedForUrl: ( url: string, includeOtherTypes?: CipherType[], defaultMatch?: UriMatchStrategySetting, ) => Promise; getAllFromApiForOrganization: (organizationId: string) => Promise; /** * Gets ciphers belonging to the specified organization that the user has explicit collection level access to. * Ciphers that are not assigned to any collections are only included for users with admin access. */ getManyFromApiForOrganization: (organizationId: string) => Promise; getLastUsedForUrl: (url: string, autofillOnPageLoad: boolean) => Promise; getLastLaunchedForUrl: (url: string, autofillOnPageLoad: boolean) => Promise; getNextCipherForUrl: (url: string) => Promise; updateLastUsedIndexForUrl: (url: string) => void; updateLastUsedDate: (id: string) => Promise; updateLastLaunchedDate: (id: string) => Promise; saveNeverDomain: (domain: string) => Promise; createWithServer: (cipher: Cipher, orgAdmin?: boolean) => Promise; updateWithServer: (cipher: Cipher, orgAdmin?: boolean, isNotClone?: boolean) => Promise; shareWithServer: ( cipher: CipherView, organizationId: string, collectionIds: string[], ) => Promise; shareManyWithServer: ( ciphers: CipherView[], organizationId: string, collectionIds: string[], ) => Promise; saveAttachmentWithServer: ( cipher: Cipher, unencryptedFile: any, admin?: boolean, ) => Promise; saveAttachmentRawWithServer: ( cipher: Cipher, filename: string, data: ArrayBuffer, admin?: boolean, ) => Promise; saveCollectionsWithServer: (cipher: Cipher) => Promise; /** * Bulk update collections for many ciphers with the server * @param orgId * @param cipherIds * @param collectionIds * @param removeCollections - If true, the collections will be removed from the ciphers, otherwise they will be added */ bulkUpdateCollectionsWithServer: ( orgId: OrganizationId, cipherIds: CipherId[], collectionIds: CollectionId[], removeCollections: boolean, ) => Promise; upsert: (cipher: CipherData | CipherData[]) => Promise; replace: (ciphers: { [id: string]: CipherData }) => Promise; clear: (userId: string) => Promise; moveManyWithServer: (ids: string[], folderId: string) => Promise; delete: (id: string | string[]) => Promise; deleteWithServer: (id: string, asAdmin?: boolean) => Promise; deleteManyWithServer: (ids: string[], asAdmin?: boolean) => Promise; deleteAttachment: (id: string, attachmentId: string) => Promise; deleteAttachmentWithServer: (id: string, attachmentId: string) => Promise; sortCiphersByLastUsed: (a: CipherView, b: CipherView) => number; sortCiphersByLastUsedThenName: (a: CipherView, b: CipherView) => number; getLocaleSortingFunction: () => (a: CipherView, b: CipherView) => number; softDelete: (id: string | string[]) => Promise; softDeleteWithServer: (id: string, asAdmin?: boolean) => Promise; softDeleteManyWithServer: (ids: string[], asAdmin?: boolean) => Promise; restore: ( cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[], ) => Promise; restoreWithServer: (id: string, asAdmin?: boolean) => Promise; restoreManyWithServer: ( ids: string[], organizationId?: string, asAdmin?: boolean, ) => Promise; getKeyForCipherKeyDecryption: (cipher: Cipher) => Promise; setAddEditCipherInfo: (value: AddEditCipherInfo) => Promise; }