QNSP

Build Pattern · TypeScript

Build a PQC-Secured Contract Management Platform

Encrypted long-term contract storage, clause-level search, AI contract analysis, and legal-hold workflows.

Ship a contract management platform that stores thousands of contracts with multi-decade retention, encrypted clause-level search via SSE-X, AI contract analysis on QNSP enclaves, and tamper-evident audit trails for legal-hold workflows. End-to-end QNSP primitives: vault + SSE-X + AI orchestrator + audit-service.

30 minTime to first PQC
TypeScriptPrimary SDK
4Services used

QNSP services used

Stack

Code

Real code, real SDK calls

Snippets reference the published @cuilabs/qnsp SDK surface (TypeScript, Python, Go, Rust mirror byte-for-byte).

Store a contract + index for clause searchtypescript
import { QnspClient } from "@cuilabs/qnsp";

const qnsp = new QnspClient({ apiKey: process.env.QNSP_API_KEY! });

// 1. Vault the source PDF (ML-KEM-768-wrapped AES-256-GCM)
const secret = await qnsp.vault.createSecret({
  name: `contract:${contractId}`,
  payloadB64: pdfBase64,
  retention: { lockUntil: "2055-12-31" },
});

// 2. Extract + index clauses for encrypted search
await qnsp.search.upsertVectors("contracts", [{
  id: contractId,
  vector: clauseEmbedding,
  metadata: { counterparty, signedAt },
}]);

// 3. Audit
await qnsp.audit.logEvent({
  eventType: "contract.created",
  payload: { contractId, secretId: secret.id },
});
Clause search across encrypted indextypescript
const hits = await qnsp.search.query("contracts", {
  vector: queryEmbedding,
  topK: 20,
  filter: { counterparty: "Acme Corp" },
});

// hits[].id maps back to vault secret IDs — fetch under access control
for (const hit of hits.matches) {
  const secret = await qnsp.vault.getSecret(`contract:${hit.id}`);
  // decrypted plaintext is in secret.payloadB64
}

Ship it

Get an API key and start building