
Company News
AWS Security Hub Adds Socket for Supply Chain Security
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.
Official JavaScript/TypeScript SDK for SafePrompt API.
npm install safeprompt
import SafePrompt from 'safeprompt';
const client = new SafePrompt({ apiKey: 'your-api-key' });
const result = await client.check('User input goes here');
if (result.safe) {
// Safe to proceed with LLM
} else {
// Handle malicious input
console.log('Threats detected:', result.threats);
}
new SafePrompt(config)Create a new SafePrompt client.
Parameters:
config.apiKey (string, required): Your SafePrompt API keyconfig.baseURL (string, optional): Custom API base URLclient.check(prompt)Validate a single prompt.
Parameters:
prompt (string, required): The user input to validateReturns:
{
safe: boolean;
threats: string[];
confidence: number;
processingTime: number;
}
client.checkBatch(prompts)Validate multiple prompts in one request.
Parameters:
prompts (string[], required): Array of prompts to validateReturns:
Array<ValidationResult>
client.getUsage()Get API usage statistics.
Returns:
{
requestsThisMonth: number;
requestsRemaining: number;
plan: string;
}
try {
const result = await client.check(userInput);
} catch (error) {
if (error instanceof SafePromptError) {
console.error('API Error:', error.message, error.statusCode);
} else {
console.error('Unexpected error:', error);
}
}
Full TypeScript support included with type definitions.
MIT
FAQs
API-first prompt injection protection for AI applications
We found that safeprompt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.