facezk-core
Version:
ZKP-AI Proof of Humanity: Live Selfie Check with Biometric Template Extraction and Fuzzy Hashing
121 lines • 3.11 kB
TypeScript
/**
* Audit Logging Plugin
* Comprehensive audit trail for security and compliance
*/
import type { IAuditPlugin, AuditEvent, AuditLogExport, PluginState } from '../core/interfaces';
export interface AuditPluginConfig {
enabled: boolean;
retentionDays: number;
logLevel: 'info' | 'warn' | 'error' | 'security';
maxEvents: number;
enableCompression: boolean;
enableEncryption: boolean;
externalEndpoint?: string;
batchSize: number;
flushInterval: number;
}
export declare class AuditPlugin implements IAuditPlugin {
readonly id = "audit-plugin";
readonly name = "Audit Logging Plugin";
readonly version = "2.0.0";
state: PluginState;
private config;
private events;
private flushTimer;
private pendingEvents;
private sessionCounter;
constructor(config?: Partial<AuditPluginConfig>);
initialize(config?: Partial<AuditPluginConfig>): Promise<void>;
dispose(): Promise<void>;
isReady(): boolean;
/**
* Log an audit event
*/
logEvent(event: AuditEvent): Promise<void>;
/**
* Get audit trail for a session
*/
getAuditTrail(sessionId: string): Promise<AuditEvent[]>;
/**
* Export audit log for a date range
*/
exportAuditLog(startDate: Date, endDate: Date): Promise<AuditLogExport>;
/**
* Get audit statistics
*/
getAuditStats(): {
totalEvents: number;
eventsByType: Record<string, number>;
eventsBySeverity: Record<string, number>;
oldestEvent: Date | null;
newestEvent: Date | null;
};
/**
* Search audit events
*/
searchEvents(query: {
eventType?: string;
severity?: string;
sessionId?: string;
userId?: string;
startDate?: Date;
endDate?: Date;
}): AuditEvent[];
/**
* Clear old events based on retention policy
*/
cleanupOldEvents(): Promise<void>;
/**
* Validate audit event
*/
private validateEvent;
/**
* Enrich event with additional metadata
*/
private enrichEvent;
/**
* Generate unique event ID
*/
private generateEventId;
/**
* Flush pending events to storage/external service
*/
private flushEvents;
/**
* Save events to local storage
*/
private saveEventsToStorage;
/**
* Load events from local storage
*/
private loadEventsFromStorage;
/**
* Send events to external service
*/
private sendToExternalService;
/**
* Compress data (simple implementation)
*/
private compressData;
/**
* Decompress data (simple implementation)
*/
private decompressData;
/**
* Start flush timer
*/
private startFlushTimer;
/**
* Stop flush timer
*/
private stopFlushTimer;
/**
* Get plugin configuration
*/
getConfig(): Required<AuditPluginConfig>;
/**
* Update plugin configuration
*/
updateConfig(newConfig: Partial<AuditPluginConfig>): Promise<void>;
}
//# sourceMappingURL=audit-plugin.d.ts.map