/**
 * @fileoverview Base encryption engine for MemberJunction field-level encryption.
 *
 * The EncryptionEngineBase provides metadata caching for encryption-related entities
 * (keys, algorithms, sources) and can be used by both client and server code.
 * Server-side implementations should extend this class to add the actual
 * encryption/decryption operations.
 *
 * ## Usage
 *
 * ```typescript
 * import { EncryptionEngineBase } from '@memberjunction/core-entities';
 *
 * // Configure the engine (loads metadata)
 * await EncryptionEngineBase.Instance.Config(false, contextUser);
 *
 * // Access cached metadata
 * const key = EncryptionEngineBase.Instance.GetKeyByID(keyId);
 * const algorithm = EncryptionEngineBase.Instance.GetAlgorithmByID(algoId);
 * ```
 *
 * @module @memberjunction/core-entities
 */
import { BaseEngine, IMetadataProvider, UserInfo } from "@memberjunction/core";
import { MJEncryptionKeyEntity, MJEncryptionAlgorithmEntity, MJEncryptionKeySourceEntity } from "../generated/entity_subclasses.js";
/**
 * Configuration for a loaded encryption key, combining key, algorithm, and source data.
 * This is a convenience type that aggregates related encryption configuration.
 */
export interface EncryptionKeyConfiguration {
    /** The encryption key entity */
    key: MJEncryptionKeyEntity;
    /** The encryption algorithm entity */
    algorithm: MJEncryptionAlgorithmEntity;
    /** The key source entity */
    source: MJEncryptionKeySourceEntity;
    /** The marker to use for encrypted values (from key or default) */
    marker: string;
}
/**
 * Base engine class for encryption metadata caching.
 *
 * This class extends BaseEngine to provide automatic caching of encryption-related
 * entities with auto-refresh when those entities are modified. It can be used in
 * both client and server contexts.
 *
 * ## Features
 *
 * - Caches all encryption keys, algorithms, and sources
 * - Auto-refreshes when entity data changes
 * - Provides convenient lookup methods
 * - Works in both client and server environments
 *
 * ## For Server-Side Encryption
 *
 * For actual encryption/decryption operations, use or extend the EncryptionEngine
 * class in the @memberjunction/encryption package, which extends this base class.
 */
export declare class EncryptionEngineBase extends BaseEngine<EncryptionEngineBase> {
    /**
     * Cached array of encryption keys loaded from the database.
     * @private
     */
    private _encryptionKeys;
    /**
     * Cached array of encryption algorithms loaded from the database.
     * @private
     */
    private _encryptionAlgorithms;
    /**
     * Cached array of encryption key sources loaded from the database.
     * @private
     */
    private _encryptionKeySources;
    /**
     * Gets the singleton instance of the encryption engine base.
     *
     * @example
     * ```typescript
     * const engine = EncryptionEngineBase.Instance;
     * await engine.Config(false, contextUser);
     * const keys = engine.EncryptionKeys;
     * ```
     */
    static get Instance(): EncryptionEngineBase;
    /**
     * Configures the engine by loading encryption metadata from the database.
     *
     * This method should be called before accessing any cached data. It loads
     * all encryption keys, algorithms, and key sources into memory.
     *
     * @param forceRefresh - If true, reloads data even if already loaded
     * @param contextUser - User context for database access (required server-side)
     * @param provider - Optional metadata provider override
     *
     * @example
     * ```typescript
     * // Initial load
     * await EncryptionEngineBase.Instance.Config(false, contextUser);
     *
     * // Force refresh after external changes
     * await EncryptionEngineBase.Instance.Config(true, contextUser);
     * ```
     */
    Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
    /**
     * Gets all cached encryption keys.
     *
     * @returns Array of all encryption key entities
     */
    get EncryptionKeys(): MJEncryptionKeyEntity[];
    /**
     * Gets only active encryption keys.
     *
     * @returns Array of encryption keys where IsActive is true
     */
    get ActiveEncryptionKeys(): MJEncryptionKeyEntity[];
    /**
     * Gets all cached encryption algorithms.
     *
     * @returns Array of all encryption algorithm entities
     */
    get EncryptionAlgorithms(): MJEncryptionAlgorithmEntity[];
    /**
     * Gets only active encryption algorithms.
     *
     * @returns Array of encryption algorithms where IsActive is true
     */
    get ActiveEncryptionAlgorithms(): MJEncryptionAlgorithmEntity[];
    /**
     * Gets all cached encryption key sources.
     *
     * @returns Array of all encryption key source entities
     */
    get EncryptionKeySources(): MJEncryptionKeySourceEntity[];
    /**
     * Gets only active encryption key sources.
     *
     * @returns Array of encryption key sources where IsActive is true
     */
    get ActiveEncryptionKeySources(): MJEncryptionKeySourceEntity[];
    /**
     * Gets an encryption key by its ID.
     *
     * @param keyId - The UUID of the encryption key
     * @returns The encryption key entity, or undefined if not found
     *
     * @example
     * ```typescript
     * const key = engine.GetKeyByID('550e8400-e29b-41d4-a716-446655440000');
     * if (key) {
     *   console.log(`Key: ${key.Name}, Status: ${key.Status}`);
     * }
     * ```
     */
    GetKeyByID(keyId: string): MJEncryptionKeyEntity | undefined;
    /**
     * Gets an encryption key by its name.
     *
     * @param name - The name of the encryption key (case-insensitive)
     * @returns The encryption key entity, or undefined if not found
     */
    GetKeyByName(name: string): MJEncryptionKeyEntity | undefined;
    /**
     * Gets an encryption algorithm by its ID.
     *
     * @param algorithmId - The UUID of the encryption algorithm
     * @returns The encryption algorithm entity, or undefined if not found
     */
    GetAlgorithmByID(algorithmId: string): MJEncryptionAlgorithmEntity | undefined;
    /**
     * Gets an encryption algorithm by its name.
     *
     * @param name - The name of the algorithm (e.g., 'AES-256-GCM')
     * @returns The encryption algorithm entity, or undefined if not found
     */
    GetAlgorithmByName(name: string): MJEncryptionAlgorithmEntity | undefined;
    /**
     * Gets an encryption key source by its ID.
     *
     * @param sourceId - The UUID of the key source
     * @returns The encryption key source entity, or undefined if not found
     */
    GetKeySourceByID(sourceId: string): MJEncryptionKeySourceEntity | undefined;
    /**
     * Gets an encryption key source by its driver class name.
     *
     * @param driverClass - The driver class name (e.g., 'EnvVarKeySource')
     * @returns The encryption key source entity, or undefined if not found
     */
    GetKeySourceByDriverClass(driverClass: string): MJEncryptionKeySourceEntity | undefined;
    /**
     * Gets the full configuration for an encryption key, including its algorithm and source.
     *
     * This method aggregates the key, its associated algorithm, and source into
     * a single configuration object for convenience.
     *
     * @param keyId - The UUID of the encryption key
     * @returns The full key configuration, or undefined if key not found
     * @throws Error if the key's algorithm or source cannot be found
     *
     * @example
     * ```typescript
     * const config = engine.GetKeyConfiguration(keyId);
     * if (config) {
     *   console.log(`Algorithm: ${config.algorithm.Name}`);
     *   console.log(`Source: ${config.source.DriverClass}`);
     *   console.log(`Marker: ${config.marker}`);
     * }
     * ```
     */
    GetKeyConfiguration(keyId: string): EncryptionKeyConfiguration | undefined;
    /**
     * Validates that a key is usable for encryption operations.
     *
     * Checks that the key, its algorithm, and its source are all active and valid.
     *
     * @param keyId - The UUID of the encryption key to validate
     * @returns Object with isValid boolean and optional error message
     *
     * @example
     * ```typescript
     * const result = engine.ValidateKey(keyId);
     * if (!result.isValid) {
     *   console.error(`Key validation failed: ${result.error}`);
     * }
     * ```
     */
    ValidateKey(keyId: string): {
        isValid: boolean;
        error?: string;
    };
    /**
     * Gets the marker prefix for a specific encryption key.
     *
     * @param keyId - The UUID of the encryption key
     * @returns The marker string (from key or default ENCRYPTION_MARKER)
     */
    GetKeyMarker(keyId: string): string;
}
//# sourceMappingURL=EncryptionEngineBase.d.ts.map