/**
 * Key Ceremony Support
 * Implements multi-party key generation, custodian management,
 * and ceremony audit trail for enterprise key management
 */
import { EventEmitter } from 'events';
import { IHSMProvider, KeySpec, KeyHandle } from './provider';
/**
 * Ceremony types
 */
export declare enum CeremonyType {
    /** Generate a new master key */
    MASTER_KEY_GENERATION = "MASTER_KEY_GENERATION",
    /** Rotate an existing key */
    KEY_ROTATION = "KEY_ROTATION",
    /** Recover a key from shares */
    KEY_RECOVERY = "KEY_RECOVERY",
    /** Destroy a key */
    KEY_DESTRUCTION = "KEY_DESTRUCTION",
    /** Transfer key between HSMs */
    KEY_TRANSFER = "KEY_TRANSFER"
}
/**
 * Ceremony status
 */
export declare enum CeremonyStatus {
    PENDING = "PENDING",
    IN_PROGRESS = "IN_PROGRESS",
    AWAITING_SHARES = "AWAITING_SHARES",
    SHARES_COLLECTED = "SHARES_COLLECTED",
    COMPLETED = "COMPLETED",
    FAILED = "FAILED",
    CANCELLED = "CANCELLED"
}
/**
 * Key custodian
 */
export interface KeyCustodian {
    id: string;
    name: string;
    email: string;
    role: CustodianRole;
    publicKey?: Buffer;
    shareIndex?: number;
    hasSubmittedShare?: boolean;
    submittedAt?: Date;
}
/**
 * Custodian roles
 */
export declare enum CustodianRole {
    ADMINISTRATOR = "ADMINISTRATOR",
    KEY_HOLDER = "KEY_HOLDER",
    WITNESS = "WITNESS",
    AUDITOR = "AUDITOR"
}
/**
 * Key share (encrypted)
 */
export interface KeyShare {
    index: number;
    custodianId: string;
    encryptedShare: Buffer;
    checksum: string;
    createdAt: Date;
}
/**
 * Ceremony configuration
 */
export interface CeremonyConfig {
    /** Ceremony type */
    type: CeremonyType;
    /** Key specification for generation */
    keySpec?: KeySpec;
    /** Key ID for rotation/destruction */
    existingKeyId?: string;
    /** Total number of shares (n in n-of-m) */
    totalShares: number;
    /** Required shares for reconstruction (m in n-of-m) */
    requiredShares: number;
    /** Custodians participating in ceremony */
    custodians: KeyCustodian[];
    /** Require all witnesses present */
    requireWitnesses?: boolean;
    /** Require dual control (two people) */
    requireDualControl?: boolean;
    /** Maximum ceremony duration in minutes */
    maxDurationMinutes?: number;
    /** Notes/description */
    description?: string;
}
/**
 * Ceremony instance
 */
export interface Ceremony {
    id: string;
    config: CeremonyConfig;
    status: CeremonyStatus;
    createdAt: Date;
    startedAt?: Date;
    completedAt?: Date;
    keyHandle?: string;
    shares: KeyShare[];
    auditTrail: CeremonyAuditEntry[];
    presentCustodians: string[];
    error?: string;
}
/**
 * Ceremony audit entry
 */
export interface CeremonyAuditEntry {
    timestamp: Date;
    action: CeremonyAction;
    custodianId?: string;
    metadata?: Record<string, unknown>;
    signature?: Buffer;
}
/**
 * Ceremony actions for audit
 */
export declare enum CeremonyAction {
    CEREMONY_CREATED = "CEREMONY_CREATED",
    CEREMONY_STARTED = "CEREMONY_STARTED",
    CUSTODIAN_PRESENT = "CUSTODIAN_PRESENT",
    SHARE_GENERATED = "SHARE_GENERATED",
    SHARE_DISTRIBUTED = "SHARE_DISTRIBUTED",
    SHARE_SUBMITTED = "SHARE_SUBMITTED",
    SHARE_VERIFIED = "SHARE_VERIFIED",
    KEY_GENERATED = "KEY_GENERATED",
    KEY_RECOVERED = "KEY_RECOVERED",
    KEY_DESTROYED = "KEY_DESTROYED",
    CEREMONY_COMPLETED = "CEREMONY_COMPLETED",
    CEREMONY_FAILED = "CEREMONY_FAILED",
    CEREMONY_CANCELLED = "CEREMONY_CANCELLED"
}
export declare class KeyCeremonyManager extends EventEmitter {
    private hsm;
    private ceremonies;
    private shamir;
    private auditCallback?;
    constructor(hsm: IHSMProvider, auditCallback?: (entry: CeremonyAuditEntry) => void);
    /**
     * Create a new ceremony
     */
    createCeremony(config: CeremonyConfig): Promise<Ceremony>;
    /**
     * Validate ceremony configuration
     */
    private validateCeremonyConfig;
    /**
     * Generate unique ceremony ID
     */
    private generateCeremonyId;
    /**
     * Start a ceremony
     */
    startCeremony(ceremonyId: string): Promise<void>;
    /**
     * Mark custodian as present
     */
    markCustodianPresent(ceremonyId: string, custodianId: string, verificationData?: Buffer): Promise<void>;
    /**
     * Execute master key generation ceremony
     */
    executeMasterKeyGeneration(ceremonyId: string): Promise<KeyHandle>;
    /**
     * Submit a share for key recovery
     */
    submitShare(ceremonyId: string, custodianId: string, encryptedShare: Buffer): Promise<void>;
    /**
     * Execute key recovery ceremony
     */
    executeKeyRecovery(ceremonyId: string): Promise<Buffer>;
    /**
     * Execute key destruction ceremony
     */
    executeKeyDestruction(ceremonyId: string): Promise<void>;
    /**
     * Cancel a ceremony
     */
    cancelCeremony(ceremonyId: string, reason?: string): Promise<void>;
    /**
     * Get ceremony by ID
     */
    getCeremony(ceremonyId: string): Ceremony | undefined;
    /**
     * Get ceremony or throw
     */
    private getCeremonyOrThrow;
    /**
     * List all ceremonies
     */
    listCeremonies(filter?: {
        status?: CeremonyStatus;
        type?: CeremonyType;
    }): Ceremony[];
    /**
     * Get ceremony audit trail
     */
    getCeremonyAuditTrail(ceremonyId: string): CeremonyAuditEntry[];
    /**
     * Add audit entry
     */
    private addAuditEntry;
    /**
     * Export ceremony report
     */
    exportCeremonyReport(ceremonyId: string): string;
    /**
     * Verify ceremony integrity
     */
    verifyCeremonyIntegrity(ceremonyId: string): boolean;
}
//# sourceMappingURL=key-ceremony.d.ts.map