Documentation
¶
Overview ¶
Package his implements a lightweight, self-hosted "Human Interaction Signature": it scores aggregate client interaction signals to estimate the probability that a verification was automated.
This is GateCHA's open-source take on the concept behind ALTCHA Sentinel's proprietary HIS. It deliberately consumes only privacy-preserving aggregates (counts, distances, durations, timing variance) — never raw coordinates, timestamps, or key contents — so it leaks nothing about what the user typed or where they pointed.
The score is advisory. In "Monitor" mode callers log it and move on; they never change a verification outcome based on it.
Index ¶
Constants ¶
const ( // BotSuspectThreshold is the probability at/above which a sample is counted // as automation-suspected for Monitor statistics. BotSuspectThreshold = 0.8 )
Heuristic weights and thresholds. These are intentionally simple and transparent; Monitor mode exists precisely to calibrate them against real traffic before any enforcement is considered. Tuning here is expected.
Variables ¶
This section is empty.
Functions ¶
func IsBotSuspected ¶
IsBotSuspected reports whether the score meets the Monitor suspect threshold.
Types ¶
type Signals ¶
type Signals struct {
// DurationMs is how long the interaction window was observed.
DurationMs int `json:"duration_ms"`
// TimeToFirstMs is the delay until the first interaction event; -1 if none.
TimeToFirstMs int `json:"time_to_first_ms"`
// PointerEvents counts sampled pointer/mouse move events.
PointerEvents int `json:"pointer_events"`
// PointerDistance is the total pointer path length in CSS pixels.
PointerDistance float64 `json:"pointer_distance"`
// Scrolls counts scroll events.
Scrolls int `json:"scrolls"`
// Touches counts touch events.
Touches int `json:"touches"`
// Keydowns counts key-down events (host forms only; 0 for a bare widget).
Keydowns int `json:"keydowns"`
// KeyIntervalStdevMs is the standard deviation of inter-keydown intervals;
// genuine typing has natural jitter, scripted input tends toward 0.
KeyIntervalStdevMs float64 `json:"key_interval_stdev_ms"`
}
Signals is the privacy-preserving aggregate of a single interaction window, produced by the client collector. All fields are optional; a zero value means "not observed". Negative sentinels (-1) distinguish "no interaction happened" from "happened at t=0" for the timing fields.