SHINRAI SDK
The official SDK for integrating Shinrai privacy tools into your applications. Build privacy-first products with our zero-knowledge infrastructure.
Installation
Install the Shinrai SDK using your preferred package manager:
npm install @shinrai/sdk
yarn add @shinrai/sdk
pnpm add @shinrai/sdk
Quick Start
Initialize the SDK with your API key and start using Shinrai services:
import { Shinrai } from '@shinrai/sdk';
// Initialize with your API key
const shinrai = new Shinrai({
apiKey: process.env.SHINRAI_API_KEY,
environment: 'production', // or 'sandbox'
});
// Check if an email has been breached
const breaches = await shinrai.breach.check({
email: '[email protected]'
});
console.log(`Found ${breaches.length} breaches`);
Authentication
All API requests require authentication via API key. You can generate keys from your dashboard.
// Recommended: Use environment variables
const shinrai = new Shinrai({
apiKey: process.env.SHINRAI_API_KEY
});
// Optional: Configure request timeout and retries
const shinrai = new Shinrai({
apiKey: process.env.SHINRAI_API_KEY,
timeout: 30000, // 30 seconds
retries: 3,
baseUrl: 'https://api.shinrai.io/v2'
});
VPN / Proxy Module
Connect to our global network of 140+ zero-log VPN servers. Route traffic through encrypted tunnels.
| Parameter | Type | Description |
|---|---|---|
| countryoptional | string | ISO country code (e.g., 'CH', 'US', 'DE') |
| cityoptional | string | City name (e.g., 'zurich', 'new-york') |
| protocoloptional | string | 'wireguard' | 'openvpn'. Default: 'wireguard' |
// Connect to a Swiss VPN server
const connection = await shinrai.vpn.connect({
country: 'CH',
city: 'zurich',
protocol: 'wireguard'
});
console.log(connection.assignedIp); // Your new IP
console.log(connection.serverHostname);
// Get list of available servers
const servers = await shinrai.vpn.listServers();
// Disconnect
await shinrai.vpn.disconnect(connection.sessionId);
Burner Cards Module
Generate virtual debit cards for anonymous payments. Cards can be single-use or reloadable.
| Parameter | Type | Description |
|---|---|---|
| typerequired | string | 'single_use' | 'reloadable' |
| limitoptional | number | Spending limit in cents (default: no limit) |
| memooptional | string | Description for your reference |
| expiresInoptional | string | '1h' | '24h' | '7d' | '30d' | '1y' |
// Create a single-use burner card
const card = await shinrai.cards.create({
type: 'single_use',
limit: 5000, // $50.00
memo: 'Netflix subscription',
expiresIn: '30d'
});
console.log(card.pan); // Card number
console.log(card.cvv); // Security code
console.log(card.expMonth); // Expiry month
console.log(card.expYear); // Expiry year
// Burn (close) the card immediately
await shinrai.cards.burn(card.token);
// List all your cards
const allCards = await shinrai.cards.list();
Identity Generator
Generate realistic fake identities for privacy testing and account creation.
// Generate a random US identity
const identity = await shinrai.identity.generate({
country: 'US',
gender: 'any',
ageRange: '25-35'
});
console.log(identity);
// {
// name: 'Marcus Chen',
// email: '[email protected]',
// phone: '+1 (415) 555-0147',
// address: '1847 Oak Street, San Francisco, CA 94102',
// dob: '1992-03-15',
// ssn: 'XXX-XX-7842',
// username: 'shadowrunner_mc',
// password: 'kX9#mP2$vL7@nQ4'
// }
Breach Check
Check if credentials have been exposed in known data breaches.
// Check email for breaches
const result = await shinrai.breach.check({
email: '[email protected]'
});
if (result.breaches.length > 0) {
console.log('[!] Email found in breaches:');
result.breaches.forEach(breach => {
console.log(` - ${breach.name} (${breach.date})`);
console.log(` Exposed: ${breach.dataTypes.join(', ')}`);
});
}
OSINT Scanner
Analyze public exposure and digital footprint across the internet.
// Run an OSINT scan
const report = await shinrai.osint.scan({
name: 'John Doe',
email: '[email protected]',
usernames: ['johndoe', 'jdoe1990'],
phone: '+1-555-123-4567'
});
console.log(`Exposure Level: ${report.exposureLevel}`);
console.log(`Risk Score: ${report.exposureScore}/100`);
report.findings.forEach(finding => {
console.log(`[${finding.severity}] ${finding.title}`);
});
Phishing Detector
Analyze URLs and emails for phishing indicators and threats.
// Analyze a suspicious URL
const urlAnalysis = await shinrai.phishing.analyzeUrl({
url: 'https://paypa1-secure.com/login'
});
console.log(`Verdict: ${urlAnalysis.verdict}`); // PHISHING
console.log(`Threat Score: ${urlAnalysis.threatScore}/100`);
// Analyze email content
const emailAnalysis = await shinrai.phishing.analyzeEmail({
content: emailBody,
headers: emailHeaders // optional
});
Dark Web Monitor
Monitor if your credentials appear on dark web marketplaces and forums.
// Scan for dark web exposure
const darkwebScan = await shinrai.darkweb.scan({
email: '[email protected]',
usernames: ['username1', 'username2'],
phone: '+1-555-123-4567'
});
console.log(`Exposure: ${darkwebScan.exposureLevel}`);
console.log(`Breaches: ${darkwebScan.breachCount}`);
console.log(`Paste Sites: ${darkwebScan.pasteCount}`);
console.log(`Forum Mentions: ${darkwebScan.forumCount}`);
// Set up continuous monitoring
await shinrai.darkweb.monitor({
email: '[email protected]',
webhookUrl: 'https://your-app.com/webhook',
frequency: 'daily'
});
IP Cleaner
Analyze and request removal of IP-associated data from various services.
// Scan for IP traces
const traces = await shinrai.ipCleaner.scan({
ip: '203.0.113.42',
hours: 24 // Look back 24 hours
});
console.log(`Found ${traces.traces.length} traces`);
console.log(`Exposure Score: ${traces.exposureScore}%`);
// Request cleanup
const cleanup = await shinrai.ipCleaner.clean({
ip: '203.0.113.42',
targets: ['analytics', 'adNetworks', 'cdnLogs']
});
console.log(`Cleanup Status: ${cleanup.status}`);
Webhooks
Receive real-time notifications for monitoring events.
// Register a webhook
const webhook = await shinrai.webhooks.create({
url: 'https://your-app.com/shinrai-webhook',
events: [
'breach.detected',
'darkweb.exposure',
'card.transaction',
'card.declined'
],
secret: 'your-webhook-secret'
});
// Verify webhook signature in your handler
const isValid = shinrai.webhooks.verifySignature(
payload,
signature,
'your-webhook-secret'
);
Rate Limits
API requests are rate limited based on your plan tier:
| Plan | Requests/min | Daily Limit |
|---|---|---|
| Free | 10 | 100 |
| Pro | 100 | 10,000 |
| Enterprise | 1,000 | Unlimited |
Rate limit headers are included in every response:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1704067200
Error Handling
The SDK throws typed errors for different failure scenarios:
import {
ShinraiError,
AuthenticationError,
RateLimitError,
ValidationError
} from '@shinrai/sdk';
try {
await shinrai.breach.check({ email: '[email protected]' });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Invalid API key');
} else if (error instanceof RateLimitError) {
console.error(`Rate limited. Retry after: ${error.retryAfter}s`);
} else if (error instanceof ValidationError) {
console.error(`Invalid input: ${error.message}`);
} else {
console.error(`Unexpected error: ${error.message}`);
}
}