@yugenkairo/sentinel-sdk
Version:
Node.js SDK for Sentinel - Enterprise LLM Security Gateway with AI-powered threat detection and cryptographic data protection
77 lines (71 loc) • 2.22 kB
JavaScript
/**
* Sentinel SDK - A self-healing LLM firewall with cryptographic data protection
*
* This SDK provides integration with the Sentinel gateway for securing LLM applications.
*/
class SentinelClient {
/**
* Create a new Sentinel client
* @param {Object} options - Configuration options
* @param {string} options.apiKey - API key for authentication
* @param {string} options.baseUrl - Base URL for the Sentinel gateway
*/
constructor(options = {}) {
this.apiKey = options.apiKey || process.env.SENTINEL_API_KEY;
this.baseUrl = options.baseUrl || 'http://localhost:8080';
}
/**
* Sanitize a prompt before sending to LLM
* @param {string} prompt - The prompt to sanitize
* @param {Object} options - Additional options
* @returns {Promise<Object>} Sanitized prompt and metadata
*/
async sanitizePrompt(prompt, options = {}) {
// In a real implementation, this would call the Sentinel gateway
return {
sanitizedPrompt: prompt,
detectedEntities: [],
policyViolations: [],
encryptionApplied: false
};
}
/**
* Process an LLM response for security
* @param {string} response - The LLM response to process
* @param {Object} options - Additional options
* @returns {Promise<Object>} Processed response and metadata
*/
async processResponse(response, options = {}) {
// In a real implementation, this would call the Sentinel gateway
return {
processedResponse: response,
detectedEntities: [],
policyViolations: [],
encryptionApplied: false
};
}
/**
* Configure security policies
* @param {Object} policies - Policy configuration
* @returns {Promise<Object>} Policy update result
*/
async configurePolicies(policies) {
// In a real implementation, this would call the Sentinel gateway
return {
success: true,
message: 'Policies configured successfully'
};
}
}
/**
* Create a new Sentinel client instance
* @param {Object} options - Configuration options
* @returns {SentinelClient} A new Sentinel client
*/
function createClient(options) {
return new SentinelClient(options);
}
module.exports = {
SentinelClient,
createClient
};