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

39 lines
1.9 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
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-01-24 18:19:49 +01:00
encrypt: (model: CipherView) => Promise<Cipher>;
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[]>;
getAllDecryptedForDomain: (domain: string, includeOtherTypes?: CipherType[]) => Promise<CipherView[]>;
2018-01-24 18:19:49 +01:00
getLastUsedForDomain: (domain: 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>;
saveAttachmentWithServer: (cipher: Cipher, unencryptedFile: any) => Promise<any>;
upsert: (cipher: CipherData | CipherData[]) => Promise<any>;
replace: (ciphers: { [id: string]: CipherData; }) => Promise<any>;
clear: (userId: string) => Promise<any>;
delete: (id: string | string[]) => Promise<any>;
deleteWithServer: (id: string) => Promise<any>;
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-01-10 05:01:16 +01:00
}