altcha 0.6.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -19
- package/dist/altcha.d.ts +16 -2
- package/dist/altcha.js +1046 -682
- package/dist/altcha.umd.cjs +2 -2
- package/dist_external/altcha.d.ts +16 -2
- package/dist_external/altcha.js +1046 -682
- package/dist_external/altcha.umd.cjs +2 -2
- package/dist_external/worker.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
ALTCHA uses a proof-of-work mechanism to protect your website, APIs, and online services from spam and abuse. Unlike other solutions, ALTCHA is self-hosted, does not use cookies nor fingerprinting, does not track users, and is fully compliant with GDPR.
|
|
4
4
|
|
|
5
|
-
https://altcha.org
|
|
5
|
+
Visit [ALTCHA](https://altcha.org) for more information.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Features
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- **Frictionless CAPTCHA Alternative** - Employs proof-of-work (PoW) instead of visual puzzles.
|
|
10
|
+
- **Data Obfuscation** - Safeguards your email address from scraping.
|
|
11
|
+
- **Cookie-less** - Designed to be GDPR compliant by default.
|
|
12
|
+
- **Self-hosted** - Operates independently without relying on external providers.
|
|
13
|
+
- **SaaS Available** - Get started with the SaaS API at [altcha.org/docs/api](https://altcha.org/docs/api).
|
|
13
14
|
|
|
14
15
|
## Examples
|
|
15
16
|
|
|
@@ -26,6 +27,9 @@ https://altcha.org
|
|
|
26
27
|
- [PHP](https://github.com/altcha-org/altcha-lib-php)
|
|
27
28
|
- [Go](https://github.com/altcha-org/altcha-lib-go)
|
|
28
29
|
- [Python](https://github.com/altcha-org/altcha-lib-py)
|
|
30
|
+
- [Java](https://github.com/altcha-org/altcha-lib-java)
|
|
31
|
+
- [Ruby](https://github.com/altcha-org/altcha-lib-rb)
|
|
32
|
+
- [Elixir](https://github.com/altcha-org/altcha-lib-ex)
|
|
29
33
|
|
|
30
34
|
## Plugins
|
|
31
35
|
|
|
@@ -89,7 +93,9 @@ Required options (at least one is required):
|
|
|
89
93
|
|
|
90
94
|
Additional options:
|
|
91
95
|
|
|
96
|
+
- __analytics__ - Enable analytics with [ALTCHA Forms](https://altcha.org/forms/). See [HTML submissions documentation](https://altcha.org/docs/forms/features/html-submissions).
|
|
92
97
|
- __auto__ - Automatically verify without user interaction (possible values: `onfocus`, `onload`, `onsubmit`).
|
|
98
|
+
- __beaconurl__ - URL to which analytics data will be sent using a beacon POST if the form is abandoned. This option is only used when `analytics` is enabled.
|
|
93
99
|
- __blockspam__ - Only used in conjunction with the `spamfilter` option. If enabled, it will block form submission and fail verification if the Spam Filter returns a negative classification. This effectively prevents submission of the form.
|
|
94
100
|
- __delay__ - The artificial delay in milliseconds to apply before the verification (defaults to 0).
|
|
95
101
|
- __expire__ - The challenge expiration (duration in milliseconds).
|
|
@@ -100,10 +106,11 @@ Additional options:
|
|
|
100
106
|
- __hidelogo__ - Hide the ALTCHA logo.
|
|
101
107
|
- __maxnumber__ - The max. number to iterate to (defaults to 1,000,000).
|
|
102
108
|
- __name__ - The name of the hidden field containing the payload (defaults to "altcha").
|
|
109
|
+
- __obfuscated__ - The [obfuscated data](https://altcha.org/docs/obfuscation) provided as a base64-encoded string. Use only without `challengeurl`/`challengejson`.
|
|
103
110
|
- __spamfilter__ - Enable [Spam Filter](#spam-filter).
|
|
104
|
-
- __strings__ - JSON-encoded translation strings. Refer to [customization](/docs/widget-customization).
|
|
111
|
+
- __strings__ - JSON-encoded translation strings. Refer to [customization](https://altcha.org/docs/widget-customization).
|
|
105
112
|
- __refetchonexpire__ - Automatically re-fetch and re-validate when the challenge expires (defaults to true).
|
|
106
|
-
- __verifyurl__ -
|
|
113
|
+
- __verifyurl__ - URL for server-side verification requests. This option is automatically configured when the `spamfilter` option is used. Override this setting only if you are using a custom server implementation.
|
|
107
114
|
- __workers__ - The number of workers to utilize for PoW (defaults to `navigator.hardwareConcurrency || 8`, max. value `16`).
|
|
108
115
|
- __workerurl__ - The URL of the Worker script (defaults to `./worker.js`, only works with `external` build).
|
|
109
116
|
|
|
@@ -135,35 +142,42 @@ Available configuration options:
|
|
|
135
142
|
|
|
136
143
|
```ts
|
|
137
144
|
export interface Configure {
|
|
138
|
-
|
|
145
|
+
analytics?: boolean | string;
|
|
146
|
+
auto?: 'onfocus' | 'onload' | 'onsubmit';
|
|
147
|
+
beaconurl?: string;
|
|
139
148
|
challenge?: {
|
|
140
149
|
algorithm: string;
|
|
141
150
|
challenge: string;
|
|
151
|
+
maxnumber?: number;
|
|
142
152
|
salt: string;
|
|
143
153
|
signature: string;
|
|
144
154
|
};
|
|
155
|
+
challengeurl?: string;
|
|
145
156
|
debug?: boolean;
|
|
146
157
|
delay?: number;
|
|
147
158
|
expire?: number;
|
|
148
159
|
floating?: 'auto' | 'top' | 'bottom';
|
|
149
160
|
floatinganchor?: string;
|
|
150
161
|
floatingoffset?: number;
|
|
162
|
+
autorenew?: boolean;
|
|
151
163
|
hidefooter?: boolean;
|
|
152
164
|
hidelogo?: boolean;
|
|
153
165
|
maxnumber?: number;
|
|
154
166
|
mockerror?: boolean;
|
|
155
167
|
name?: string;
|
|
168
|
+
obfuscated?: string;
|
|
156
169
|
refetchonexpire?: boolean;
|
|
157
|
-
spamfilter
|
|
170
|
+
spamfilter?: boolean | 'ipAddress' | SpamFilter;
|
|
158
171
|
strings?: {
|
|
159
|
-
error
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
172
|
+
error: string;
|
|
173
|
+
expired: string;
|
|
174
|
+
footer: string;
|
|
175
|
+
label: string;
|
|
176
|
+
verified: string;
|
|
177
|
+
verifying: string;
|
|
178
|
+
waitAlert: string;
|
|
179
|
+
}
|
|
180
|
+
test?: boolean | number | 'delay';
|
|
167
181
|
verifyurl?: string;
|
|
168
182
|
workers?: number;
|
|
169
183
|
workerurl?: string;
|
|
@@ -196,7 +210,7 @@ document.querySelector('#altcha').addEventListener('statechange', (ev) => {
|
|
|
196
210
|
```
|
|
197
211
|
|
|
198
212
|
> [!IMPORTANT]
|
|
199
|
-
> Both programmatic configuration and event listeners have to called/attached after the ALTCHA script loads, such as within window.addEventListener('load', ...)
|
|
213
|
+
> Both programmatic configuration and event listeners have to called/attached after the ALTCHA script loads, such as within `window.addEventListener('load', ...)`.
|
|
200
214
|
|
|
201
215
|
## Spam Filter
|
|
202
216
|
|
package/dist/altcha.d.ts
CHANGED
|
@@ -16,8 +16,10 @@ declare global {
|
|
|
16
16
|
|
|
17
17
|
interface AltchaServerVerificationEvent extends CustomEvent<Record<string, unknown>> {}
|
|
18
18
|
|
|
19
|
-
interface
|
|
19
|
+
interface AltchaWidgetOptions {
|
|
20
|
+
analytics?: boolean | string;
|
|
20
21
|
auto?: 'onfocus' | 'onload' | 'onsubmit';
|
|
22
|
+
beaconurl?: string;
|
|
21
23
|
blockspam?: boolean;
|
|
22
24
|
challengeurl?: string;
|
|
23
25
|
challengejson?: string;
|
|
@@ -29,9 +31,10 @@ declare global {
|
|
|
29
31
|
floatingoffset?: number;
|
|
30
32
|
hidefooter?: boolean;
|
|
31
33
|
hidelogo?: boolean;
|
|
32
|
-
name?: string;
|
|
33
34
|
maxnumber?: number;
|
|
34
35
|
mockerror?: boolean;
|
|
36
|
+
name?: string;
|
|
37
|
+
obfuscated?: string;
|
|
35
38
|
refetchonexpire?: boolean;
|
|
36
39
|
spamfilter?: boolean | 'ipAddress';
|
|
37
40
|
strings?: string;
|
|
@@ -41,6 +44,16 @@ declare global {
|
|
|
41
44
|
workerurl?: string;
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
interface AltchaWidgetMethods {
|
|
48
|
+
configure: (options: AltchaWidgetOptions) => void;
|
|
49
|
+
clarify: () => Promise<void>;
|
|
50
|
+
reset: (newState: AltchaState = 'unverified', err: string | null = null) => void;
|
|
51
|
+
verify: () => Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface AltchaWidget extends AltchaWidgetOptions extends AltchaWidgetMethods {
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
declare namespace svelteHTML {
|
|
45
58
|
interface IntrinsicElements {
|
|
46
59
|
'altcha-widget': AltchaWidgetSvelte;
|
|
@@ -72,6 +85,7 @@ declare global {
|
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
interface AltchaWidgetReact extends AltchaWidget extends React.HTMLAttributes<HTMLElement> {
|
|
88
|
+
children?: React.ReactNode;
|
|
75
89
|
ref?: React.RefObject<HTMLElement>;
|
|
76
90
|
style?: AltchaWidgetCSSProperties;
|
|
77
91
|
}
|