SDKs & Client Libraries
Official client libraries for seamless ResolveDB integration.
No SDK Required
ResolveDB works with any language that can make DNS queries - which is every language. If your language can call dig, nslookup, or has a DNS library, it can use ResolveDB.
SDKs are optional convenience wrappers that handle encoding, retries, and response parsing. They're helpful but never mandatory.
Coming Soon: Official SDKs are in development. Sign up for early access.
Why Use an SDK?
SDKs handle the complexity of the UQRP protocol so you can focus on building your application.
| Raw DNS Queries | With ResolveDB SDK |
|---|---|
| Manual Base64 encoding/decoding | Automatic encoding handled |
| Handle chunked responses yourself | Chunked data assembled transparently |
| Implement retry logic from scratch | Built-in retry with exponential backoff |
| Parse UQRP response format manually | Native objects returned directly |
| Manage encryption keys yourself | Simple encryption helpers |
| No type safety | Full TypeScript/type hints support |
Available SDKs
JavaScript / TypeScript
npm install @resolvedb/client- Full TypeScript support
- Browser & Node.js compatible
- Tree-shakeable
Python
pip install resolvedb- Type hints (PEP 484)
- Async/await support
- Python 3.8+
Go
go get github.com/resolvedb/resolvedb-go- Idiomatic Go API
- Context support
- Zero dependencies
Rust
[dependencies]
resolvedb = "0.1"- Zero-cost abstractions
- async/await with tokio
- no_std optional
SDK Features
Blob Fallback
Data larger than 512 bytes automatically triggers URL redirects. The SDK fetches the blob from our CDN transparently, so you always get the complete data.
Encryption Helpers
Simple APIs for AES-256-GCM encryption and decryption. Key management utilities help you rotate keys and manage access securely.
Chunked Data Assembly
Large responses split across multiple DNS records are automatically reassembled. The SDK handles chunk ordering and integrity verification.
Retry Logic
Automatic retries with exponential backoff and jitter for transient failures. Configurable retry policies for different error types.
Response Parsing
UQRP responses are automatically parsed to native objects. No need to manually parse TXT record formats or handle encoding.
Client-Side Caching
TTL-aware caching respects server-provided cache durations. Reduces redundant queries while ensuring data freshness.
Quick Examples
Basic Get/Set Operations
TypeScript
import { ResolveDB } from '@resolvedb/client';
const client = new ResolveDB({
apiKey: 'your-api-key',
namespace: 'myapp'
});
// Get public data
const weather = await client.get('weather', 'newyork');
console.log(weather.temp); // 72
// Set data (requires authentication)
await client.set('config', 'theme', { mode: 'dark', accent: 'blue' });
// Delete data
await client.delete('config', 'old-setting');Python
from resolvedb import ResolveDB
client = ResolveDB(
api_key="your-api-key",
namespace="myapp"
)
# Get public data
weather = await client.get("weather", "newyork")
print(weather["temp"]) # 72
# Set data (requires authentication)
await client.set("config", "theme", {"mode": "dark", "accent": "blue"})
# Delete data
await client.delete("config", "old-setting")Go
package main
import (
"context"
"fmt"
resolvedb "github.com/resolvedb/resolvedb-go"
)
func main() {
client := resolvedb.New(resolvedb.Config{
APIKey: "your-api-key",
Namespace: "myapp",
})
ctx := context.Background()
// Get public data
var weather struct {
Temp int `json:"temp"`
}
_ = client.Get(ctx, "weather", "newyork", &weather)
fmt.Println(weather.Temp) // 72
// Set data (requires authentication)
_ = client.Set(ctx, "config", "theme", map[string]string{
"mode": "dark", "accent": "blue",
})
}Rust
use resolvedb::ResolveDB;
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
struct Weather {
temp: i32,
}
#[derive(Serialize)]
struct Theme {
mode: String,
accent: String,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ResolveDB::new()
.api_key("your-api-key")
.namespace("myapp")
.build()?;
// Get public data
let weather: Weather = client.get("weather", "newyork").await?;
println!("{}", weather.temp); // 72
// Set data (requires authentication)
client.set("config", "theme", Theme {
mode: "dark".into(),
accent: "blue".into(),
}).await?;
Ok(())
}Encrypted Data Storage
TypeScript
import { ResolveDB, EncryptionKey } from '@resolvedb/client';
const client = new ResolveDB({ apiKey: 'your-api-key' });
// Generate or load an encryption key
const key = await EncryptionKey.generate();
// Or: const key = EncryptionKey.fromBase64('...');
// Store encrypted data
await client.setEncrypted('secrets', 'api-tokens', {
github: 'ghp_xxxx',
openai: 'sk-xxxx'
}, key);
// Retrieve and decrypt
const secrets = await client.getEncrypted('secrets', 'api-tokens', key);
console.log(secrets.github); // 'ghp_xxxx'
// Export key for storage
const exportedKey = key.toBase64();Python
from resolvedb import ResolveDB, EncryptionKey
client = ResolveDB(api_key="your-api-key")
# Generate or load an encryption key
key = EncryptionKey.generate()
# Or: key = EncryptionKey.from_base64("...")
# Store encrypted data
await client.set_encrypted("secrets", "api-tokens", {
"github": "ghp_xxxx",
"openai": "sk-xxxx"
}, key)
# Retrieve and decrypt
secrets = await client.get_encrypted("secrets", "api-tokens", key)
print(secrets["github"]) # "ghp_xxxx"
# Export key for storage
exported_key = key.to_base64()Large Blob Handling
TypeScript
import { ResolveDB } from '@resolvedb/client';
const client = new ResolveDB({ apiKey: 'your-api-key' });
// Store large data - SDK automatically uses blob storage
const largeConfig = {
features: Array(1000).fill({ enabled: true, settings: {} }),
metadata: { /* ... large object ... */ }
};
// Data > 512 bytes is automatically uploaded to blob storage
await client.set('config', 'full-settings', largeConfig);
// Retrieval is transparent - SDK fetches from blob URL automatically
const config = await client.get('config', 'full-settings');
// Force blob storage for any size
await client.set('assets', 'logo', imageBuffer, { forceBlob: true });Python
from resolvedb import ResolveDB
client = ResolveDB(api_key="your-api-key")
# Store large data - SDK automatically uses blob storage
large_config = {
"features": [{"enabled": True, "settings": {}} for _ in range(1000)],
"metadata": { ... }
}
# Data > 512 bytes is automatically uploaded to blob storage
await client.set("config", "full-settings", large_config)
# Retrieval is transparent - SDK fetches from blob URL automatically
config = await client.get("config", "full-settings")
# Force blob storage for any size
await client.set("assets", "logo", image_bytes, force_blob=True)Stay Updated
SDKs are currently in development. Sign up to be notified when they launch.