2018-03-02 14:33:57 +01:00
|
|
|
import { CipherType } from '../enums/cipherType';
|
2020-09-20 15:47:35 +02:00
|
|
|
import { UriMatchType } from '../enums/uriMatchType';
|
2018-03-02 14:33:57 +01:00
|
|
|
|
2018-02-19 19:07:19 +01:00
|
|
|
import { CipherData } from '../models/data/cipherData';
|
2018-01-10 05:01:16 +01:00
|
|
|
|
2018-02-19 19:07:19 +01:00
|
|
|
import { Cipher } from '../models/domain/cipher';
|
|
|
|
import { Field } from '../models/domain/field';
|
|
|
|
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
2018-01-10 05:01:16 +01:00
|
|
|
|
2018-06-12 17:45:02 +02:00
|
|
|
import { AttachmentView } from '../models/view/attachmentView';
|
2018-02-19 19:07:19 +01:00
|
|
|
import { CipherView } from '../models/view/cipherView';
|
|
|
|
import { FieldView } from '../models/view/fieldView';
|
2018-01-24 18:19:49 +01:00
|
|
|
|
2018-01-23 23:29:15 +01:00
|
|
|
export abstract class CipherService {
|
2018-01-24 18:19:49 +01:00
|
|
|
decryptedCipherCache: CipherView[];
|
2018-01-23 23:29:15 +01:00
|
|
|
|
|
|
|
clearCache: () => void;
|
2018-08-15 17:43:52 +02:00
|
|
|
encrypt: (model: CipherView, key?: SymmetricCryptoKey, originalCipher?: Cipher) => Promise<Cipher>;
|
2018-01-24 18:19:49 +01:00
|
|
|
encryptFields: (fieldsModel: FieldView[], key: SymmetricCryptoKey) => Promise<Field[]>;
|
|
|
|
encryptField: (fieldModel: FieldView, key: SymmetricCryptoKey) => Promise<Field>;
|
2018-01-23 23:29:15 +01:00
|
|
|
get: (id: string) => Promise<Cipher>;
|
|
|
|
getAll: () => Promise<Cipher[]>;
|
2018-01-24 18:19:49 +01:00
|
|
|
getAllDecrypted: () => Promise<CipherView[]>;
|
|
|
|
getAllDecryptedForGrouping: (groupingId: string, folder?: boolean) => Promise<CipherView[]>;
|
2020-09-20 15:47:35 +02:00
|
|
|
getAllDecryptedForUrl: (url: string, includeOtherTypes?: CipherType[],
|
|
|
|
defaultMatch?: UriMatchType) => Promise<CipherView[]>;
|
2018-12-14 19:55:44 +01:00
|
|
|
getAllFromApiForOrganization: (organizationId: string) => Promise<CipherView[]>;
|
2018-03-02 18:03:03 +01:00
|
|
|
getLastUsedForUrl: (url: string) => Promise<CipherView>;
|
2020-08-12 21:59:59 +02:00
|
|
|
getNextCipherForUrl: (url: string) => Promise<CipherView>;
|
2018-01-23 23:29:15 +01:00
|
|
|
updateLastUsedDate: (id: string) => Promise<void>;
|
|
|
|
saveNeverDomain: (domain: string) => Promise<void>;
|
2018-10-19 17:20:04 +02:00
|
|
|
saveWithServer: (cipher: Cipher) => Promise<any>;
|
2018-06-13 06:02:15 +02:00
|
|
|
shareWithServer: (cipher: CipherView, organizationId: string, collectionIds: string[]) => Promise<any>;
|
|
|
|
shareManyWithServer: (ciphers: CipherView[], organizationId: string, collectionIds: string[]) => Promise<any>;
|
2018-07-05 16:48:19 +02:00
|
|
|
saveAttachmentWithServer: (cipher: Cipher, unencryptedFile: any, admin?: boolean) => Promise<Cipher>;
|
|
|
|
saveAttachmentRawWithServer: (cipher: Cipher, filename: string, data: ArrayBuffer,
|
|
|
|
admin?: boolean) => Promise<Cipher>;
|
2018-06-12 19:07:06 +02:00
|
|
|
saveCollectionsWithServer: (cipher: Cipher) => Promise<any>;
|
2018-01-23 23:29:15 +01:00
|
|
|
upsert: (cipher: CipherData | CipherData[]) => Promise<any>;
|
|
|
|
replace: (ciphers: { [id: string]: CipherData; }) => Promise<any>;
|
|
|
|
clear: (userId: string) => Promise<any>;
|
2018-06-12 23:12:27 +02:00
|
|
|
moveManyWithServer: (ids: string[], folderId: string) => Promise<any>;
|
2018-01-23 23:29:15 +01:00
|
|
|
delete: (id: string | string[]) => Promise<any>;
|
|
|
|
deleteWithServer: (id: string) => Promise<any>;
|
2018-06-12 23:12:27 +02:00
|
|
|
deleteManyWithServer: (ids: string[]) => Promise<any>;
|
2018-01-23 23:29:15 +01:00
|
|
|
deleteAttachment: (id: string, attachmentId: string) => Promise<void>;
|
|
|
|
deleteAttachmentWithServer: (id: string, attachmentId: string) => Promise<void>;
|
|
|
|
sortCiphersByLastUsed: (a: any, b: any) => number;
|
|
|
|
sortCiphersByLastUsedThenName: (a: any, b: any) => number;
|
2018-07-04 05:33:15 +02:00
|
|
|
getLocaleSortingFunction: () => (a: CipherView, b: CipherView) => number;
|
2020-04-03 22:32:15 +02:00
|
|
|
softDelete: (id: string | string[]) => Promise<any>;
|
|
|
|
softDeleteWithServer: (id: string) => Promise<any>;
|
|
|
|
softDeleteManyWithServer: (ids: string[]) => Promise<any>;
|
|
|
|
restore: (id: string | string[]) => Promise<any>;
|
|
|
|
restoreWithServer: (id: string) => Promise<any>;
|
|
|
|
restoreManyWithServer: (ids: string[]) => Promise<any>;
|
2018-01-10 05:01:16 +01:00
|
|
|
}
|