Skip to main content
This guide covers best practices for deploying Blindfold in production, optimizing performance, and ensuring security.

Choosing the Right Privacy Method

Different use cases require different privacy approaches. Here’s how to choose:
When to use:
  • AI chatbots and assistants (OpenAI, Anthropic Claude, Google Gemini)
  • LLM-powered applications (LangChain, LlamaIndex, Vercel AI SDK)
  • When you need to restore original data after processing
Why:
  • Reversible - you can restore original PII after AI responds
  • Maintains context for AI (tokens preserve sentence structure)
  • Best for user-facing applications
When to use:
  • Showing data to users (e.g., “Card ending in 3456”)
  • Audit logs that need partial visibility
  • Customer support interfaces
Why:
  • Not reversible - safe for display
  • Shows enough context to be useful
  • Prevents accidental exposure
When to use:
  • Audit logs with no PII requirement
  • Public data sharing
  • Compliance with “right to be forgotten”
Why:
  • Completely removes PII
  • Cannot be reversed
  • Safest for long-term storage
When to use:
  • User tracking across sessions
  • Analytics and aggregation
  • Deduplication without storing PII
Why:
  • Same input = same hash (consistent IDs)
  • Cannot reverse to original value
  • Safe for analytics databases
When to use:
  • Long-term data storage
  • Database encryption
  • Regulatory compliance requiring encrypted PII
Why:
  • Reversible with your encryption key
  • Industry-standard AES-256 encryption
  • You control the decryption key
When to use:
  • Creating test datasets
  • Demos and screenshots
  • Development environments
Why:
  • Generates realistic fake data
  • Maintains format and structure
  • Safe for public sharing

Choosing the Right Policy

Policies simplify compliance by providing pre-configured entity sets.

Policy Selection Guide

When to Create Custom Policies

Create custom policies when:
1

Industry-Specific Requirements

Your industry has unique PII definitions not covered by standard policies
2

Performance Optimization

You only need specific entity types and want faster processing
3

Custom Entity Detection

You need to detect domain-specific identifiers

Security Best Practices

API Key Management

Never commit API keys to version control or expose them in client-side code.
Recommended Approaches:

Mapping Storage

Mappings must be stored securely to enable detokenization.
Mapping Security Checklist:
  • Set expiration time (recommended: 24 hours or less)
  • Encrypt mappings at rest
  • Use TLS/SSL for transmission
  • Implement access controls
  • Log access for audit trails
  • Auto-delete expired mappings
  • Never log mappings in plain text

Performance Optimization

Use Async for Concurrency

Process multiple requests in parallel for better throughput.
Performance:
  • Sequential: 100 requests × 200ms = 20 seconds
  • Async: ~2-3 seconds (limited by API rate limits)

Batch Similar Requests

Combine similar text into single requests when possible.

Cache Results

Cache tokenization results for frequently used text.

Optimize Detection Threshold

Higher thresholds = faster processing, fewer detections.
Threshold Selection:
  • 0.60+: High confidence only, fast processing
  • 0.35-0.60: Balanced (recommended for most use cases)
  • 0.25-0.35: Catch more edge cases, may have false positives
  • < 0.25: Maximum detection, slower, more false positives

Error Handling

Comprehensive Error Handling

Handle all error types gracefully.

Retry Strategy with Exponential Backoff

Monitoring and Logging

Track API Usage

Monitor your API usage to prevent unexpected rate limit hits.

Set Up Alerts

Monitor critical metrics and set up alerts.

Compliance Considerations

GDPR Compliance

Only detect and protect the entities you need.
Implement data deletion for user requests.
Request a DPA from Blindfold for your records.Contact: hello@blindfold.dev Subject: “DPA Request - [Your Company]“

HIPAA Compliance

Request a BAA from Blindfold if processing PHI.Contact: hello@blindfold.dev Subject: “BAA Request - [Your Organization]“

Testing Best Practices

Unit Testing

Test your privacy protection logic thoroughly.

Integration Testing

Test the complete flow with real AI providers.

Production Deployment Checklist

Before deploying to production:

Security

  • API keys stored in secret management system (not environment variables)
  • Mappings encrypted at rest
  • TLS/SSL enabled for all connections
  • API keys never exposed in client-side code
  • Logging doesn’t include sensitive data or mappings
  • Access controls implemented for mapping storage
  • Regular security audits scheduled

Performance

  • Async methods used for concurrent requests
  • Caching implemented for frequently used text
  • Batch processing for similar requests
  • Appropriate detection threshold chosen
  • Connection pooling configured
  • Timeouts set appropriately

Error Handling

  • All error types handled gracefully
  • Retry logic with exponential backoff implemented
  • Fallback behavior defined for API failures
  • Admin alerts configured for critical errors
  • User-friendly error messages displayed

Monitoring

  • Request count tracking
  • Error rate monitoring
  • Latency tracking
  • Rate limit monitoring
  • Alerts configured for anomalies
  • Logging integrated with central logging system

Compliance

  • Appropriate policy selected (GDPR, HIPAA, PCI DSS)
  • Data retention policies implemented
  • Mapping expiration configured
  • DPA/BAA obtained if required
  • Privacy policy updated
  • Audit trail implemented

Testing

  • Unit tests for all privacy methods
  • Integration tests with AI providers
  • Load testing completed
  • Edge cases tested (empty text, very long text, special characters)
  • Failure scenarios tested

Need Help?

Documentation

Read the complete documentation

Support

Contact hello@blindfold.dev for help

Examples

See real-world integration examples

API Reference

Complete API documentation