Client-side React hook that manages invisible bot-protection signals — a honeypot field reference and a mount timestamp — for attachment to public form submissions.
## Key Components
| Export | Type | Description |
|---|---|---|
| `useHumanitySignals` | Hook | Returns honeypot input props, a signal getter, and a reset function |
| `honeypotInputProps` | `{ ref, name }` | Spread onto a hidden `` to capture bot-filled values |
| `getSignals` | `() => HumanitySignals` | Produces the wire object (`HONEYPOT_FIELD` + `ELAPSED_MS_FIELD`) to merge into a POST body |
| `resetSignals` | `() => void` | Clears the honeypot value and resets the mount timestamp after a successful submit |
**Signal strategy:**
- `HONEYPOT_FIELD` — a hidden input that legitimate users never fill; non-empty value indicates a bot.
- `ELAPSED_MS_FIELD` — milliseconds since mount using `performance.now()` (monotonic, immune to wall-clock skew); suspiciously low values indicate automated submissions.
Both signals travel in the request body, so they remain functional behind reverse proxies or prefixed URLs.
## Usage Example
```typescript
import { useHumanitySignals } from '@/hooks/use-humanity-signals'
import { HoneypotField } from '@/components/honeypot-field'
function ContactForm() {
const { honeypotInputProps, getSignals, resetSignals } = useHumanitySignals()
async function handleSubmit(formData: Record) {
await fetch('/api/contact', {
method: 'POST',
body: JSON.stringify({ ...formData, ...getSignals() }),
})
resetSignals()
}
return (
)
}
```
> This hook is SSR-safe: both `performance.now()` calls are guarded against server-side execution even though the hook is marked `'use client'`.
**Source:** [`use-humanity-signals.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/use-humanity-signals.ts)