@udene/sdk
Version:
Udene Fraud Detection SDK for JavaScript
148 lines • 3.74 kB
TypeScript
/**
* Configuration options for the Udene client
*/
export interface UdeneClientConfig {
/**
* API key for authentication
*/
apiKey: string;
/**
* Custom API base URL (optional)
*/
baseURL?: string;
/**
* Maximum number of retry attempts for failed requests (default: 3)
*/
maxRetries?: number;
/**
* Custom logger function (default: console.error)
*/
logger?: (message: string, error?: any) => void;
/**
* Whether to disable all logging (default: false)
*/
disableLogging?: boolean;
}
/**
* Metrics response interface
*/
export interface MetricsResponse {
riskScore: number;
activeUsers: number;
alertCount: number;
apiCalls: number;
accuracy: number;
falsePositiveRate: number;
avgProcessingTime: number;
concurrentCalls: number;
}
/**
* Activity item interface
*/
export interface ActivityItem {
id: string;
type: 'suspicious' | 'normal';
description: string;
timestamp: string;
}
/**
* Activity response interface
*/
export interface ActivityResponse {
activities: ActivityItem[];
}
/**
* Track interaction request interface
*/
export interface TrackInteractionRequest {
userId: string;
action: string;
metadata?: Record<string, any>;
}
/**
* Track interaction response interface
*/
export interface TrackInteractionResponse {
success: boolean;
transactionId: string;
}
/**
* Transaction analysis request interface
*/
export interface TransactionAnalysisRequest {
transactionId: string;
userId: string;
amount?: number;
currency?: string;
paymentMethod?: string;
timestamp?: string;
metadata?: Record<string, any>;
}
/**
* Transaction analysis response interface
*/
export interface TransactionAnalysisResponse {
riskScore: number;
recommendation: 'approve' | 'review' | 'deny';
reasons?: string[];
transactionId: string;
}
/**
* Device fingerprint response interface
*/
export interface DeviceFingerprintResponse {
deviceId: string;
browser: string;
os: string;
ip: string;
location?: {
country?: string;
city?: string;
};
riskFactors?: string[];
trustScore?: number;
}
/**
* UdeneClient for JavaScript
* A client for interacting with the Udene Fraud Detection API
*/
export declare class UdeneClient {
private client;
private maxRetries;
private logger;
private disableLogging;
/**
* Create a new UdeneClient instance
* @param apiKeyOrConfig - Your API key or a configuration object
* @param baseURL - Optional custom API base URL (ignored if config object is provided)
*/
constructor(apiKeyOrConfig: string | UdeneClientConfig, baseURL?: string);
/**
* Get fraud metrics for the current user/session
* @returns Fraud metrics data
*/
getMetrics(): Promise<MetricsResponse>;
/**
* Get activity data for analysis
* @returns Activity data
*/
getActivity(): Promise<ActivityResponse>;
/**
* Track a user interaction for fraud analysis
* @param data - Interaction data to track
* @returns Tracking confirmation
*/
trackInteraction(data: TrackInteractionRequest): Promise<TrackInteractionResponse>;
/**
* Analyze a transaction for fraud
* @param transaction - Transaction data to analyze
* @returns Fraud analysis results
*/
analyzeTransaction(transaction: TransactionAnalysisRequest): Promise<TransactionAnalysisResponse>;
/**
* Get device fingerprint information
* @returns Device fingerprint data
*/
getDeviceFingerprint(): Promise<DeviceFingerprintResponse>;
}
//# sourceMappingURL=index.d.ts.map