Threat Model
Traditional vector databases like Pinecone and Weaviate:- Store vectors in plaintext on their servers
- Have full read access to your data
- Require you to trust their infrastructure security
- Can be compelled to hand over data via subpoena
Traditional DBs
VecLabs
Encryption Algorithm
VecLabs uses AES-256-GCM (Advanced Encryption Standard with Galois/Counter Mode):- AES-256: 256-bit key length, industry standard symmetric encryption
- GCM mode: Authenticated encryption with additional data (AEAD)
- Authentication tag: Prevents tampering — any modification to ciphertext causes decryption to fail
encryption.rs:1-4:
AES-256-GCM is used by Signal, WhatsApp, TLS 1.3, and most modern secure systems. It provides both confidentiality (data can’t be read) and integrity (data can’t be modified without detection).
How Encryption Works
Encrypting Vectors
Fromencryption.rs:12-35:
- Generate random nonce — A unique 12-byte value for this encryption operation (prevents nonce reuse attacks)
- Serialize vectors — Pack vector count, dimension, and float32 values into a byte buffer
- Encrypt — Run AES-256-GCM encryption on the plaintext
- Return — Prepend the nonce to the ciphertext (nonce is not secret, but must be unique per encryption)
Decrypting Vectors
Fromencryption.rs:37-85:
- Extract nonce — First 12 bytes of the encrypted data
- Decrypt — AES-256-GCM decryption (fails immediately if data was tampered with)
- Deserialize — Parse vector count, dimension, and reconstruct float32 arrays
- Return — Original vectors in plaintext
Key Derivation
The encryption key is derived from your Solana wallet public key using SHA-256. Fromencryption.rs:87-95:
- Your Solana wallet public key is 32 bytes (Ed25519)
- Hash the pubkey with a domain-specific prefix (
"solvec-encryption-key-v1:") - Output is a deterministic 32-byte key unique to your wallet
- Same wallet always produces the same encryption key
- Different wallets produce completely different keys
In production: The key derivation will use the wallet’s signing capability to derive a deterministic key without exposing the private key. The current implementation is for alpha testing.
Why Not Use the Private Key Directly?
Using the public key instead of the private key for derivation has two benefits:- Read-only access — Someone with only the public key can derive the encryption key and read encrypted data, but cannot modify it (requires private key for Solana transactions)
- Key separation — The encryption key is distinct from the signing key, reducing risk if either is compromised
Encrypted Data Format
The encrypted blob stored on Shadow Drive has this structure:- Header: 8 + 8 = 16 bytes
- Vector data: 100 * 384 * 4 = 153,600 bytes
- Plaintext: 153,616 bytes
- Ciphertext: 12 (nonce) + 153,616 (encrypted) + 16 (auth tag) = 153,644 bytes
Nonce Uniqueness
AES-256-GCM requires a unique nonce for every encryption with the same key. Reusing a nonce with the same key is catastrophic — it can leak plaintext data. VecLabs ensures nonce uniqueness by generating a random 12-byte nonce using the OS cryptographic RNG (OsRng) for every encryption operation (encryption.rs:14):
encryption.rs:140-147):
Testing
From the test suite (encryption.rs:98-155), VecLabs validates:
Roundtrip Encryption
Wrong Key Detection
Performance Impact
Encryption adds minimal overhead:| Operation | Time (100 vectors, 384 dims) |
|---|---|
| Serialization | ~20 μs |
| AES-256-GCM encryption | ~150 μs |
| Total overhead | ~170 μs |
- HNSW query: 1,900 μs (p50)
- Encryption: 170 μs
- Encryption is less than 9% of query time
Limitations and Future Work
Current Limitations
- No key rotation — Once encrypted with a wallet key, re-encryption requires decrypting all data and re-encrypting with a new key
- No field-level encryption — Metadata is stored in plaintext (only vector values are encrypted)
- No searchable encryption — You cannot query encrypted vectors without decrypting them first
Planned Improvements
Metadata Encryption
Encrypt metadata fields with the same wallet-derived key. Adds minimal overhead and protects sensitive metadata (PII, access logs, etc.).
Key Rotation
Support re-encrypting collections with a new key. Useful when wallet is rotated or when migrating between wallets.
Security Best Practices
For Production Deployments
- Use dedicated wallets per environment — Don’t reuse dev wallets in production
- Rotate wallets periodically — Plan for key rotation (upcoming feature)
- Monitor on-chain activity — Watch for unexpected Merkle root updates to detect unauthorized access
- Backup encrypted data — Store Shadow Drive ciphertext in multiple locations
Why This Matters
VecLabs is the only vector database where encryption happens client-side before data leaves your machine.Pinecone, Weaviate, Qdrant
- Vectors stored in plaintext on vendor servers
- Vendor has full read access
- Trust their security practices
- Vulnerable to insider threats and subpoenas
VecLabs SolVec
- Vectors encrypted before leaving SDK
- VecLabs infrastructure cannot read data
- You control the encryption key (your wallet)
- Even if storage is compromised, data is protected
Code Reference
Full implementation:crates/solvec-core/src/encryption.rs
Key functions:
encrypt_vectors()— encryption.rs:12decrypt_vectors()— encryption.rs:38derive_key_from_pubkey()— encryption.rs:89
Ready to Build?
Start using VecLabs with the TypeScript or Python SDK.