2018-02-19 19:07:19 +01:00
|
|
|
import { CipherString } from '../models/domain/cipherString';
|
|
|
|
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
2018-01-08 20:11:28 +01:00
|
|
|
|
2018-02-19 19:07:19 +01:00
|
|
|
import { ProfileOrganizationResponse } from '../models/response/profileOrganizationResponse';
|
2018-01-08 20:11:28 +01:00
|
|
|
|
2018-01-25 20:26:09 +01:00
|
|
|
export abstract class CryptoService {
|
|
|
|
setKey: (key: SymmetricCryptoKey) => Promise<any>;
|
|
|
|
setKeyHash: (keyHash: string) => Promise<{}>;
|
|
|
|
setEncKey: (encKey: string) => Promise<{}>;
|
|
|
|
setEncPrivateKey: (encPrivateKey: string) => Promise<{}>;
|
|
|
|
setOrgKeys: (orgs: ProfileOrganizationResponse[]) => Promise<{}>;
|
|
|
|
getKey: () => Promise<SymmetricCryptoKey>;
|
|
|
|
getKeyHash: () => Promise<string>;
|
|
|
|
getEncKey: () => Promise<SymmetricCryptoKey>;
|
|
|
|
getPrivateKey: () => Promise<ArrayBuffer>;
|
|
|
|
getOrgKeys: () => Promise<Map<string, SymmetricCryptoKey>>;
|
|
|
|
getOrgKey: (orgId: string) => Promise<SymmetricCryptoKey>;
|
2018-06-13 23:10:52 +02:00
|
|
|
hasKey: () => Promise<boolean>;
|
2018-01-25 20:26:09 +01:00
|
|
|
clearKey: () => Promise<any>;
|
|
|
|
clearKeyHash: () => Promise<any>;
|
|
|
|
clearEncKey: (memoryOnly?: boolean) => Promise<any>;
|
|
|
|
clearPrivateKey: (memoryOnly?: boolean) => Promise<any>;
|
|
|
|
clearOrgKeys: (memoryOnly?: boolean) => Promise<any>;
|
|
|
|
clearKeys: () => Promise<any>;
|
|
|
|
toggleKey: () => Promise<any>;
|
2018-04-22 05:14:04 +02:00
|
|
|
makeKey: (password: string, salt: string) => Promise<SymmetricCryptoKey>;
|
2018-01-25 20:26:09 +01:00
|
|
|
hashPassword: (password: string, key: SymmetricCryptoKey) => Promise<string>;
|
|
|
|
makeEncKey: (key: SymmetricCryptoKey) => Promise<CipherString>;
|
2018-04-22 05:14:04 +02:00
|
|
|
encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise<CipherString>;
|
2018-01-25 20:26:09 +01:00
|
|
|
encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise<ArrayBuffer>;
|
2018-04-22 05:14:04 +02:00
|
|
|
decryptToUtf8: (cipherString: CipherString, key?: SymmetricCryptoKey) => Promise<string>;
|
2018-01-25 20:26:09 +01:00
|
|
|
decryptFromBytes: (encBuf: ArrayBuffer, key: SymmetricCryptoKey) => Promise<ArrayBuffer>;
|
2018-04-23 19:03:47 +02:00
|
|
|
randomNumber: (min: number, max: number) => Promise<number>;
|
2018-01-08 20:11:28 +01:00
|
|
|
}
|