UNPKG

@iflow-mcp/claudeus-wp-mcp

Version:

The most comprehensive WordPress MCP server - 145 production-ready tools for complete WordPress management with AI

52 lines 1.78 kB
import { ConsentType } from '../types/security.js'; export class DataPrivacyManager { consentManager; config; constructor(consentManager, config) { this.consentManager = consentManager; this.config = config; } async exposeResource(resource, context) { const operation = { type: ConsentType.DATA_ACCESS, description: `Access resource: ${resource.type}`, resource: String(resource.id), params: { context } }; const hasConsent = await this.consentManager.requestConsent(operation, context); if (!hasConsent) { return false; } if (this.config.privacyControls.maskSensitiveData) { resource = this.maskSensitiveData(resource); } return true; } maskSensitiveData(data) { if (!data) return data; // Deep clone to avoid modifying original const masked = JSON.parse(JSON.stringify(data)); // Mask sensitive fields const sensitiveFields = ['password', 'token', 'key', 'secret', 'auth']; this.recursiveMask(masked, sensitiveFields); return masked; } recursiveMask(obj, sensitiveFields) { if (typeof obj !== 'object' || obj === null) return; for (const key in obj) { if (sensitiveFields.includes(key.toLowerCase())) { obj[key] = '***MASKED***'; } else if (typeof obj[key] === 'object') { this.recursiveMask(obj[key], sensitiveFields); } } } async canShareExternally(_resource) { // TODO: Implement external sharing permission check return false; } } //# sourceMappingURL=DataPrivacyManager.js.map