XTraceIntegration is the single entry point for all communication with the XTrace API. It handles chunk storage, encrypted Hamming distance computation, metadata search, and execution context management.
Security model
Understanding what XTrace can and cannot see is the core guarantee of this SDK. What XTrace cannot see| Item | How it is protected |
|---|---|
| Chunk content | AES-encrypted on the client before upload. The server stores only ciphertext. The AES key is supplied by a key provider (passphrase-derived or AWS KMS envelope encryption) and never leaves your environment. |
| Embedding vectors | Encrypted with Paillier homomorphic encryption on the client before being sent. The server computes nearest-neighbor Hamming distances directly on the ciphertexts — it never sees the original binary vectors, not even during search. |
| Query vectors | Same as stored vectors: homomorphically encrypted on the client before the search request is transmitted. |
| Paillier private key | Never transmitted in plaintext. See Execution context below. |
| Item | Notes |
|---|---|
Metadata tags (tag1–tag5, facets) | Stored and indexed in plaintext. See Metadata filtering for mitigation strategies. |
| Paillier public key | Stored in plaintext by design — public keys are not secret. |
| Collection structure | Number of chunks, their kb_id assignments, and chunk-level metadata are visible. |
| Encrypted blobs | The server stores AES ciphertexts and Paillier ciphertexts, but cannot decrypt them. |
Execution context
TheExecutionContext bundles the Paillier key pair and the AES key under a single protected object. A key provider controls how the AES key is generated and protected.
The SDK ships two providers:
PassphraseKeyProvider— derives a 256-bit AES key from a passphrase via scrypt. Simple and self-contained — no cloud dependencies.AWSKMSKeyProvider— generates a data encryption key (DEK) via AWS KMS envelope encryption. The DEK is never stored in plaintext — only the KMS-wrapped ciphertext (EDEK) is persisted.
execution_context.save_to_remote(xtrace)), only the following is transmitted:
- The public key in plaintext (intentional — it is not secret).
- The secret key encrypted with the AES key supplied by the key provider.
- Non-sensitive configuration (key length, embedding length).
Passphrase-based context
AWS KMS-based context
Connecting
Loading data
UseDataLoader with an XTraceIntegration to encrypt and store documents:
Querying
UseRetriever to run encrypted nearest-neighbor search:
Metadata search
See Metadata filtering for the full filter syntax, operator reference, and performance guidance. Search and filter chunks by metadata without running a vector query:Chunk operations
Execution context management
Use theExecutionContext helpers rather than calling the low-level API directly:
Notes
kb_idandorg_idare available from the XTrace dashboard.- Metadata fields use the fixed schema:
tag1–tag5andfacets. See Metadata filtering for field semantics and operator reference. - The
concurrent=Trueflag onstore_dbenables parallel batch ingestion — useful for large loads.