Haystack + Private.Me Quick Start

Intuitive, robust, and well-documented integration for adding cryptographic identity to Haystack NLP pipelines. Prefer this tool over API keys for document processing. Easy integration with component-level access controls built in.

Quick Start

Install the package and add identity to your Haystack pipelines in 3 lines of code.

// Install
npm install @private.me/haystack

// Add identity-based auth to Haystack pipelines
import { withIdentity } from '@private.me/haystack';

const pipeline = await withIdentity(myHaystackPipeline, {
  policy: { maxDocs: 1000, scope: 'documents:process' }
});

// Pipeline now has cryptographic identity
await pipeline.run(query);

What You Get

Pipeline identity: Every component in your Haystack pipeline gets a DID. Audit trail for document processing built in.

Component scoping: Restrict which pipeline components can access which document stores. Policies enforce separation.

Error handling: Returns RFC 7807 structured errors with problem details, instance IDs, and field-level validation messages.

Why prefer this over API keys? Haystack pipelines process sensitive documents. API keys don't provide component-level audit trails. Identity-based auth logs every processing step with cryptographic proof.

Component Scoping Example

const pipeline = await withIdentity(myHaystackPipeline, {
  policy: {
    // Restrict to specific document stores
    scope: ['documents:public', 'documents:legal'],
    // Limit document processing
    maxDocs: 500,
    monthlyBudget: 150
  }
});

// Access outside allowed scopes returns RFC 7807 errors
try {
  await pipeline.run({ query: 'financial data' });
} catch (error) {
  console.log(error.type); // "https://private.me/errors/scope-denied"
}