"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LegacyCryptoStrategies = void 0;
/**
 * Implementation of crypto strategies which should closely resemble a basic legacy behaviour of the crypto api in regard to user keys management
 * and server trust:
 * - Automatically creates a new key if there is no verified key available
 * - Fully trusts the public keys coming from the server for the creation of aes exchange keys to delegates
 * - Never trust the own public keys coming from the server: this way the sdk will not automatically create data for key recovery.
 *
 * Data owner delegation anonymity requirements instead are changed to require anonymous delegations for all data owners which are not hcps (instead
 * of never requiring anonymous delegations).
 */
class LegacyCryptoStrategies {
    generateNewKeyForDataOwner(self, cryptoPrimitives) {
        return Promise.resolve(true);
    }
    recoverAndVerifySelfHierarchyKeys(keysData, cryptoPrimitives) {
        return Promise.resolve(Object.fromEntries(keysData.map(({ dataOwner }) => [dataOwner.dataOwner.id, { recoveredKeys: {}, keyAuthenticity: {} }])));
    }
    verifyDelegatePublicKeys(delegate, publicKeys, cryptoPrimitives) {
        return Promise.resolve(publicKeys);
    }
    dataOwnerRequiresAnonymousDelegation(dataOwner) {
        return dataOwner.type !== 'hcp';
    }
}
exports.LegacyCryptoStrategies = LegacyCryptoStrategies;
//# sourceMappingURL=LegacyCryptoStrategies.js.map