Versions in this module Expand all Collapse all v0 v0.3.5 Aug 17, 2026 v0.3.4 Aug 10, 2026 v0.3.3 Aug 3, 2026 v0.3.2 Jul 27, 2026 v0.3.1 Jun 21, 2026 v0.3.0 Jun 21, 2026 v0.2.1 Jun 21, 2026 v0.2.0 Jun 21, 2026 v0.1.0 Jun 21, 2026 Changes in this version + const SettingLoginCaptchaAPIKeyID + const SettingLoginCaptchaEnabled + func CleanupExpired(db *gorm.DB) (int64, error) + func CreateHISSample(db *gorm.DB, s *HISSample) error + func DeleteAPIKey(db *gorm.DB, id int64) error + func GenerateHMACSecret() (string, error) + func GenerateKeyID() (string, error) + func GetAllKeysStatsSummary(db *gorm.DB) (map[int64]KeyStatsSummary, error) + func GetLoginCaptchaEnabled(db *gorm.DB) (bool, error) + func GetSetting(db *gorm.DB, key string) (string, error) + func IncrementChallengesIssued(db *gorm.DB, apiKeyID int64) error + func IncrementCountryVerification(db *gorm.DB, apiKeyID int64, country string, ok bool) error + func IncrementHISObservation(db *gorm.DB, apiKeyID int64, botSuspected bool) error + func IncrementVerificationsFail(db *gorm.DB, apiKeyID int64) error + func IncrementVerificationsOK(db *gorm.DB, apiKeyID int64) error + func IsConsumed(db *gorm.DB, challenge string) (bool, error) + func MarkConsumed(db *gorm.DB, challenge string, apiKeyID int64, expiresAt time.Time) error + func PruneHISSamples(db *gorm.DB, cutoff time.Time) (int64, error) + func RotateHMACSecret(db *gorm.DB, id int64) (string, error) + func SetSetting(db *gorm.DB, key, value string) error + func UpdateAPIKey(db *gorm.DB, id int64, params UpdateAPIKeyParams) error + type APIKey struct + AdaptiveDifficulty bool + Algorithm string + CreatedAt time.Time + Domain string + Enabled bool + ExpireSeconds int + HISSampling bool + HMACSecret string + ID int64 + KeyID string + MaxNumber int64 + Name string + RateLimitPerMin int + UpdatedAt time.Time + func CreateAPIKey(db *gorm.DB, name, domain string, maxNumber int64, expireSeconds int, ...) (*APIKey, error) + func EnsureLoginCaptchaAPIKey(db *gorm.DB) (*APIKey, error) + func GetAPIKeyByID(db *gorm.DB, id int64) (*APIKey, error) + func GetAPIKeyByKeyID(db *gorm.DB, keyID string) (*APIKey, error) + func ListAPIKeys(db *gorm.DB) ([]APIKey, error) + type AdminUser struct + CreatedAt time.Time + ID int64 + PasswordHash string + UpdatedAt time.Time + Username string + type ConsumedChallenge struct + APIKeyID int64 + Challenge string + ConsumedAt time.Time + ExpiresAt time.Time + ID int64 + type CountryStat struct + Country string + Total int + VerificationsFail int + VerificationsOK int + func GetCountryStats(db *gorm.DB, apiKeyID *int64, days, limit int) ([]CountryStat, error) + type DailyCountryStat struct + APIKeyID int64 + Country string + Date string + ID int64 + VerificationsFail int + VerificationsOK int + type DailyStat struct + APIKeyID int64 + ChallengesIssued int + Date string + HISBotSuspected int + HISObservations int + ID int64 + VerificationsFail int + VerificationsOK int + func GetKeyStats(db *gorm.DB, apiKeyID int64, days int) ([]DailyStat, error) + type HISCalibration struct + AvgDurationMs float64 + AvgPointer float64 + NoMotionPct float64 + Samples int + ScoreHistogram []HISScoreBucket + Suspected int + Threshold float64 + func GetHISCalibration(db *gorm.DB, apiKeyID *int64, days int, threshold float64) (*HISCalibration, error) + type HISSample struct + APIKeyID int64 + BotSuspected bool + CreatedAt time.Time + DurationMs int + ID int64 + KeyIntervalStdevMs float64 + Keydowns int + PointerDistance float64 + PointerEvents int + Score float64 + Scrolls int + TimeToFirstMs int + Touches int + type HISScoreBucket struct + Count int + Hi float64 + Lo float64 + type KeyStatsSummary struct + APIKeyID int64 + ChallengesIssued int + HISBotSuspected int + HISObservations int + LastUsedAt string + VerificationsFail int + VerificationsOK int + type Setting struct + Key string + UpdatedAt time.Time + Value string + type StatsOverview struct + ActiveKeys int + Countries []CountryStat + Daily []DailyStat + TotalChallenges int + TotalHISBotSuspected int + TotalHISObservations int + TotalVerificationsFail int + TotalVerificationsOK int + func GetStatsOverview(db *gorm.DB, days int) (*StatsOverview, error) + type UpdateAPIKeyParams struct + AdaptiveDifficulty bool + Algorithm string + Domain string + Enabled bool + ExpireSeconds int + HISSampling bool + MaxNumber int64 + Name string + RateLimitPerMin int