UNPKG

@centure/node-sdk

Version:

A Typescript SDK for interacting with Centure's API

66 lines 2.13 kB
import { ScanOptions, 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); /** * Validates scan options * @throws {ScanOptionsError} If both only and exclude are specified */ private validateScanOptions; /** * Makes an API request with proper error handling */ private request; /** * Scans text content for prompt injection attacks * @param text - The text content to scan * @param options - Optional scan options * @returns Scan results with safety assessment and detected categories * @throws {ScanOptionsError} If both only and exclude are specified */ scanText(text: string, options?: ScanOptions): Promise<ScanResponse>; /** * Scans an image for prompt injection attacks * @param image - Base64-encoded image string OR Buffer (will be converted to base64) * @param options - Optional scan options * @returns Scan results with safety assessment and detected categories * @throws {ScanOptionsError} If both only and exclude are specified */ scanImage(image: string | Buffer, options?: ScanOptions): Promise<ScanResponse>; } //# sourceMappingURL=client.d.ts.map