games_app/backend/dist/services/referralSybilService.d.ts
2026-06-29 15:01:23 +02:00

24 lines
1.2 KiB
TypeScript

/**
* Referral Sybil / fraud signal detection for commission payouts.
*/
export type SybilSignal = 'same_registration_ip' | 'shared_login_ip' | 'referrer_daily_limit_exceeded' | 'referrer_inactive_referrals_batch' | 'referral_chain_loop';
export declare const SYBIL_SIGNAL_POINTS: Record<SybilSignal, number>;
export declare function computeSybilScore(signals: SybilSignal[]): number;
export declare function resolveCommissionStatusFromSybilScore(score: number, thresholds: {
review: number;
block: number;
}): 'pending' | 'review' | 'blocked';
export declare function countReferralsInLast24h(referrerId: string): Promise<number>;
export declare function countInactiveDirectReferrals(referrerId: string): Promise<number>;
/** Validates referrer chain has no loop before accepting a new referral link. */
export declare function assertReferralChainHasNoLoop(referrerId: string): Promise<void>;
export declare function detectReferralSybilSignals(input: {
beneficiaryUserId: string;
referredUserId: string;
maxReferralsPerDay: number;
inactiveReferralsThreshold?: number;
}): Promise<{
score: number;
signals: SybilSignal[];
}>;
//# sourceMappingURL=referralSybilService.d.ts.map