better-auth-fraud-detection
Version:
Real-time fraud detection plugin for Better Auth - Prevent account takeovers, bot attacks, and suspicious activities
34 lines (33 loc) • 883 B
text/typescript
import type { BetterAuthClientPlugin } from "better-auth/client";
export const fraudDetectionClient = (): BetterAuthClientPlugin => {
return {
id: "fraud-detection",
$InferServerPlugin: {} as any,
getActions: () => ({
fraud: {
getRiskScore: async () => {
// TODO: Get current session risk score
return { score: 0, signals: [] };
},
reportSuspicious: async (report: {
reason: string;
details?: string;
}) => {
// TODO: Report suspicious activity
return { success: true };
},
getAnalytics: async (options: {
timeRange: string;
}) => {
// TODO: Get fraud analytics
return {
blocked: 0,
challenged: 0,
passed: 0,
topRisks: []
};
}
}
})
};
};