honeypot-run
Version:
Patented threat analytics and fingerprinting library. Requires a honeypot.run account
51 lines (50 loc) • 1.77 kB
TypeScript
import { honeypot } from "./Honeypot";
export interface IHoneypot {
identify(id: string, props?: Record<string, any> | null, type?: string | null): Promise<void>;
on(eventName: string, fn: Function): void;
flow(flowId: string, instanceId?: string | null): Promise<IFlow>;
track(eventType: string, eventProperties?: Record<string, any> | null): Promise<any>;
get(): Promise<any>;
}
export type FlowState = 'empty' | 'not started' | 'started' | 'completed' | 'force completed' | 'cleared';
export interface FlowData {
flow_id: string;
instance_id?: string;
steps: StepData[];
state?: FlowState;
created?: number;
}
export interface IFlow {
data: FlowData;
steps: Map<string, IStep>;
getData(): FlowData;
getState(): FlowState;
isStarted(): boolean;
isCompleted(): boolean;
step(stepId: string): IStep;
complete(): Promise<void>;
clear(clearStepsToo?: boolean): IFlow;
on(eventId: StepEventListeners, callback: StateChangeCallback): void;
}
export type StepState = 'empty' | 'not started' | 'started' | 'completed' | 'cleared';
export interface StepData {
step_id: string;
start_time?: number;
end_time?: number;
state: StepState;
metadata?: Record<string, any>;
}
export type StateChangeCallback = (step: IStep) => void;
export type StepEventListeners = 'update' | 'clear';
export interface IStep {
data: StepData;
getState(): StepState;
isStarted(): boolean;
isCompleted(): boolean;
start(metadata?: Record<string, any>): IStep;
complete(metadata?: Record<string, any>): IStep;
clear(metadata?: Record<string, any>): IStep;
on(eventId: StepEventListeners, callback: StateChangeCallback): void;
}
export default honeypot;
export { honeypot };