1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-19 07:35:48 +02:00
bitwarden-browser/src/abstractions/cipher.service.ts

50 lines
2.8 KiB
TypeScript
Raw Normal View History

import { CipherType } from '../enums/cipherType';
import { CipherData } from '../models/data/cipherData';
2018-01-10 05:01:16 +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';
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;
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[]>;
getAllDecryptedForUrl: (url: string, includeOtherTypes?: CipherType[]) => Promise<CipherView[]>;
getLastUsedForUrl: (url: string) => Promise<CipherView>;
2018-01-23 23:29:15 +01:00
updateLastUsedDate: (id: string) => Promise<void>;
saveNeverDomain: (domain: string) => Promise<void>;
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-06-12 17:45:02 +02:00
shareAttachmentWithServer: (attachmentView: AttachmentView, cipherId: string,
organizationId: 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;
2018-01-10 05:01:16 +01:00
}