@centure/node-sdk
Version:
A Typescript SDK for interacting with Centure's API
57 lines • 1.69 kB
TypeScript
import { ScanResponse } from "./types";
/**
* Options for configuring the Centure client
*/
export interface CentureOptions {
/**
* Base URL for the API
* @default "https://api.centure.ai"
*/
baseUrl?: string;
/**
* API key for authentication
* @default process.env.CENTURE_API_KEY
*/
apiKey?: string;
/**
* Custom fetch implementation
* Useful for Node.js environments or custom configurations
*/
fetch?: typeof fetch;
/**
* Additional options to pass to fetch requests
*/
fetchOptions?: RequestInit;
}
/**
* Client for interacting with the Centure API
*/
export declare class CentureClient {
private readonly apiKey;
private readonly baseUrl;
private readonly fetchFn;
private readonly fetchOptions;
/**
* Creates a new Centure API client
* @param options - Configuration options
* @throws {MissingApiKeyError} If no API key is provided
*/
constructor(options?: CentureOptions);
/**
* Makes an API request with proper error handling
*/
private request;
/**
* Scans text content for prompt injection attacks
* @param content - The text content to scan
* @returns Scan results with safety assessment and detected categories
*/
scanText(content: string): Promise<ScanResponse>;
/**
* Scans an image for prompt injection attacks
* @param image - Base64-encoded image string OR Buffer (will be converted to base64)
* @returns Scan results with safety assessment and detected categories
*/
scanImage(image: string | Buffer): Promise<ScanResponse>;
}
//# sourceMappingURL=client.d.ts.map