import { KeyStorageFacade } from './KeyStorageFacade'; import { StorageFacade } from './StorageFacade'; import { StorageEntryKeysFactory } from './StorageEntryKeysFactory'; import { KeyPair } from '../crypto/RSA'; /** * @internal This class is meant for internal use only and may be changed without notice. * Simplifies access to the storage facades for iCure-specific data storage. */ export declare class IcureStorageFacade { private readonly keys; private readonly data; private readonly entryFor; constructor(keyStorage: KeyStorageFacade, storage: StorageFacade, entryKeysFactory: StorageEntryKeysFactory); /** * Saves a key pair for the data owner. * @param dataOwnerId id of the data owner with the key. * @param publicKeyFingerprint fingerprint of the public key of the pair. * @param keyPair a key pair of the data owner. * @param isDevice true if the key was generated on this device. */ saveKey(dataOwnerId: string, publicKeyFingerprint: string, keyPair: KeyPair, isDevice: boolean): Promise; /** * Get an existing key pair for the data owner. * @param dataOwnerId id of the data owner with the key. * @param publicKeyFingerprint fingerprint of a public key of the data owner. * @param legacyPublicKey the legacy public key of the data owner, if present (only used to know if we should search for the key in 'legacy' storage * locations. * @return the keypair and if the key was generated on this device or undefined if the key pair could not be found. */ loadKey(dataOwnerId: string, publicKeyFingerprint: string, legacyPublicKey: string | undefined): Promise<{ pair: KeyPair; isDevice: boolean; } | undefined>; /** * Save the results of public key verification. If there were already results stored the entries will be merged. In case of conflicts the new * {@link verificationDetails} take priority over the stored data. * @param dataOwnerId id of a data owner. * @param verificationDetails results of verification, associates key fingerprints to true if they were verified by the user or false otherwise. * @return the updated keys */ saveSelfVerifiedKeys(dataOwnerId: string, verificationDetails: { [keyFingerprint: string]: boolean; }): Promise<{ [keyFingerprint: string]: boolean; }>; /** * Get the last saved results of public key verification. * @param dataOwnerId id of a data owner. * @return saved results of verification, associates key fingerprints to true if they were verified by the user or false otherwise. If no results * were saved returns an empty object instead. * @throws if the stored results are not in a valid format. */ loadSelfVerifiedKeys(dataOwnerId: string): Promise<{ [keyFingerprint: string]: boolean; }>; /** * Saves a signature and verification key pair. Overrides previously saved signature keys (but keeps signature verification keys). * @param dataOwnerId id of the data owner with the key. * @param publicKeyFingerprint fingerprint of the public key of the pair. * @param keyPair the key pair to save. */ saveSignatureKeyPair(dataOwnerId: string, publicKeyFingerprint: string, keyPair: KeyPair): Promise; /** * Loads the signature key for the data owner. * @param dataOwnerId id of the data owner with the key. * @return the signature key for the data owner or undefined if there is no signature key stored. */ loadSignatureKey(dataOwnerId: string): Promise | undefined>; /** * Loads the signature verification key for a data owner with the provided fingerprint. * @param dataOwnerId id of the data owner with the key. * @param publicKeyFingerprint fingerprint of the verification key. * @return the requested signature verification key or undefined if the key could not be found. */ loadSignatureVerificationKey(dataOwnerId: string, publicKeyFingerprint: string): Promise; }