67 lines
2.6 KiB
TypeScript
67 lines
2.6 KiB
TypeScript
/**
|
|
* Platform security: ledger integrity, alerts, withdrawal suspension, admin notifications.
|
|
*/
|
|
import type { SecurityAlert, SecurityAlertSeverity, SecurityAlertStatus } from '../models/security.model';
|
|
/** Ledger entry types that may credit or debit user balances. */
|
|
export declare const AUTHORIZED_LEDGER_TYPES: Set<string>;
|
|
export declare class SecurityBlockedError extends Error {
|
|
constructor(message: string);
|
|
}
|
|
export declare function assertUserCanWithdraw(userId: string): Promise<void>;
|
|
export declare function suspendUserForSecurity(userId: string, reason: string, alertType: string, severity?: SecurityAlertSeverity): Promise<void>;
|
|
export declare function raiseAlert(input: {
|
|
userId?: string | null;
|
|
severity: SecurityAlertSeverity;
|
|
alertType: string;
|
|
title: string;
|
|
details?: string;
|
|
metadata?: Record<string, unknown>;
|
|
suspendUser?: boolean;
|
|
}): Promise<SecurityAlert>;
|
|
export declare function notifyAdminsOfAlert(alert: SecurityAlert): Promise<void>;
|
|
export declare function resolveAlert(alertId: string, adminUserId: string, status: SecurityAlertStatus, resolutionNote?: string, reactivateWithdrawals?: boolean): Promise<SecurityAlert | null>;
|
|
export type IntegrityIssue = {
|
|
userId: string;
|
|
walletTypeId: number;
|
|
accountId: string;
|
|
available: string;
|
|
locked: string;
|
|
entriesSum: string;
|
|
issue: string;
|
|
entryId?: string;
|
|
amount?: string;
|
|
};
|
|
export declare function runLedgerIntegrityCheck(): Promise<IntegrityIssue[]>;
|
|
export declare function getSecuritySettings(): Promise<{
|
|
alertEmails: string[];
|
|
}>;
|
|
export declare function updateSecuritySettings(alertEmails: string[]): Promise<{
|
|
alertEmails: string[];
|
|
}>;
|
|
export declare function listSecurityAlerts(opts: {
|
|
status?: SecurityAlertStatus;
|
|
userId?: string;
|
|
limit?: number;
|
|
offset?: number;
|
|
}): Promise<{
|
|
items: {
|
|
id: string;
|
|
userId: string | null;
|
|
severity: "low" | "medium" | "high" | "critical";
|
|
alertType: string;
|
|
status: "open" | "investigating" | "resolved" | "dismissed";
|
|
title: string;
|
|
details: string | null;
|
|
metadata: Record<string, unknown> | null;
|
|
resolvedBy: string | null;
|
|
resolvedAt: Date | null;
|
|
resolutionNote: string | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}[];
|
|
total: number;
|
|
}>;
|
|
export declare function getIntegrityCheckIntervalMs(): number;
|
|
/** Dismisses false-positive alerts caused by the security_alerts INSERT detection loop (pre-fix). */
|
|
export declare function dismissSpuriousTamperAlerts(adminUserId: string): Promise<number>;
|
|
//# sourceMappingURL=securityService.d.ts.map
|