/**
 * Plugin integrity enforcement (PLUGIN-INTEGRITY-01).
 *
 * Load-time SHA-256 integrity checking for plugins.
 * Every plugin is verified against a trusted manifest (plugins.lock.json)
 * before it is admitted into the governance runtime.
 *
 * Fail-closed by default: a plugin whose hash is absent from the manifest
 * or whose hash does not match is rejected. The `disableIntegrity` escape
 * hatch exists for development convenience but emits a WARN audit event so
 * auditors can see the bypass on the chain.
 *
 * Scope (PLUGIN-INTEGRITY-01): load-time only.
 * Runtime per-dispatch re-verification is tracked under PLUGIN-INTEGRITY-02.
 *
 * @connexum/ai-governance
 */
/**
 * One entry in the trusted-plugin lockfile (.governance/plugins.lock.json).
 * The sha256 field is the hex SHA-256 digest of the plugin's source text.
 */
export interface TrustedPluginEntry {
    /** Unique plugin identifier -- must match `GovernancePlugin.manifest.name`. */
    name: string;
    /** SemVer string for informational purposes (not enforced). */
    version: string;
    /** Hex SHA-256 of the plugin source text at publish time. */
    sha256: string;
    /** Optional publisher label for human traceability. */
    trustedPublisher?: string;
}
export type PluginIntegrityDenyReason = 'hash-mismatch' | 'unregistered-plugin' | 'empty-manifest';
/**
 * Thrown when a plugin fails load-time integrity verification.
 * Extends Error directly (same base as GovernanceTamperError / PluginValidationError)
 * so catch(err instanceof Error) paths handle it without importing the hierarchy.
 */
export declare class PluginIntegrityError extends Error {
    readonly code: 'PLUGIN_INTEGRITY_FAILED';
    readonly reason: PluginIntegrityDenyReason;
    readonly pluginName: string;
    readonly expected?: string;
    readonly actual?: string;
    constructor(opts: {
        reason: PluginIntegrityDenyReason;
        pluginName: string;
        expected?: string;
        actual?: string;
    });
}
/**
 * Compute the hex SHA-256 digest of plugin source code.
 * Input may be a string (UTF-8 encoded internally) or a raw Buffer.
 */
export declare function computePluginSha256(pluginCode: string | Buffer): string;
/**
 * Verify a plugin's source against its trusted manifest entry.
 *
 * Returns `{ ok: true }` when the hash matches.
 * Returns a typed failure record otherwise -- callers decide whether to throw.
 */
export declare function verifyPluginIntegrity(plugin: {
    name: string;
    source: string | Buffer;
}, manifestEntry: TrustedPluginEntry | undefined, manifestMap?: Map<string, TrustedPluginEntry>): {
    ok: true;
} | {
    ok: false;
    reason: PluginIntegrityDenyReason;
    expected?: string;
    actual?: string;
};
/**
 * Read `.governance/plugins.lock.json` (or an arbitrary path) and parse it
 * into a map keyed by plugin name.
 *
 * Rejects on:
 *   - File read failure
 *   - Malformed JSON
 *   - Root value that is not an array
 *   - Array entries that are missing `name` or `sha256`
 *
 * Returns an empty Map (not an error) when the file does not exist -- a
 * missing lockfile is a valid first-boot state. Callers that require a
 * non-empty manifest should call `assertPluginTrusted`, which will surface
 * `empty-manifest`.
 */
export declare function loadTrustedPluginManifest(manifestPath: string): Promise<Map<string, TrustedPluginEntry>>;
/**
 * Assert that a plugin is trusted according to the manifest map.
 * Throws `PluginIntegrityError` if the check fails.
 *
 * This is the high-level convenience used by `PluginRegistry.register()`.
 */
export declare function assertPluginTrusted(plugin: {
    name: string;
    source: string | Buffer;
}, manifestMap: Map<string, TrustedPluginEntry>): void;
//# sourceMappingURL=plugin-integrity.d.ts.map