altcha 2.2.2 → 2.2.4
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 +3 -2
- package/dist/altcha.d.ts +39 -19
- package/dist/altcha.i18n.d.ts +39 -19
- package/dist/altcha.i18n.js +1688 -1729
- package/dist/altcha.i18n.umd.js +4 -4
- package/dist/altcha.js +1625 -1666
- package/dist/altcha.umd.cjs +4 -4
- package/dist_external/altcha.css +1 -1
- package/dist_external/altcha.d.ts +39 -19
- package/dist_external/altcha.js +1685 -1724
- package/dist_external/altcha.umd.cjs +3 -3
- package/dist_external/worker.js +1 -1
- package/dist_plugins/analytics.js +68 -82
- package/dist_plugins/analytics.umd.cjs +1 -1
- package/dist_plugins/obfuscation.js +70 -79
- package/dist_plugins/obfuscation.umd.cjs +1 -1
- package/dist_plugins/upload.js +360 -332
- package/dist_plugins/upload.umd.cjs +4 -4
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -158,6 +158,7 @@ Additional options:
|
|
|
158
158
|
Accepts `url: string` and `init: RequestInit` as arguments and must return a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).
|
|
159
159
|
- **delay**: Artificial delay in milliseconds before verification (defaults to 0).
|
|
160
160
|
- **disableautofocus**: If true, prevents the code-challenge input from automatically receiving focus on render (defaults to `false`).
|
|
161
|
+
- **disablerefetchonexpire**: Whether to disable automatic re-fetch and re-validation when the challenge expires (defaults to `false`).
|
|
161
162
|
- **expire**: Challenge expiration duration in milliseconds.
|
|
162
163
|
- **floating**: Enable floating UI (possible values: `auto`, `top`, `bottom`).
|
|
163
164
|
- **floatinganchor**: CSS selector of the "anchor" to which the floating UI will be attached (defaults to the `button[type="submit"]` in the related form).
|
|
@@ -172,7 +173,6 @@ Additional options:
|
|
|
172
173
|
- **overlay**: Enables overlay UI mode (automatically sets `auto="onsubmit"`).
|
|
173
174
|
- **overlaycontent**: CSS selector of the HTML element to display in the overlay modal before the widget.
|
|
174
175
|
- **strings**: JSON-encoded translation strings. Refer to [customization](https://altcha.org/docs/widget-customization).
|
|
175
|
-
- **refetchonexpire**: Automatically re-fetch and re-validate when the challenge expires (defaults to true).
|
|
176
176
|
- **verifyurl**: URL for server-side verification requests. This option is automatically configured with Sentinel. Override this setting only if using a custom server implementation. Supports `fn:function_name` format to call a global JS function instead.
|
|
177
177
|
- **workers**: Number of workers to utilize for PoW (defaults to `navigator.hardwareConcurrency || 8`, max value `16`).
|
|
178
178
|
- **workerurl**: URL of the Worker script (defaults to `./worker.js`, only works with `external` build).
|
|
@@ -306,6 +306,7 @@ export interface Configure {
|
|
|
306
306
|
debug?: boolean;
|
|
307
307
|
delay?: number;
|
|
308
308
|
disableautofocus?: boolean;
|
|
309
|
+
disablerefetchonexpire?: boolean;
|
|
309
310
|
expire?: number;
|
|
310
311
|
floating?: 'auto' | 'top' | 'bottom';
|
|
311
312
|
floatinganchor?: string;
|
|
@@ -318,7 +319,7 @@ export interface Configure {
|
|
|
318
319
|
name?: string;
|
|
319
320
|
obfuscated?: string;
|
|
320
321
|
overlay?: boolean;
|
|
321
|
-
refetchonexpire?: boolean;
|
|
322
|
+
refetchonexpire?: boolean; // deprecated, use disablerefetchonexpire
|
|
322
323
|
spamfilter?: boolean | 'ipAddress' | SpamFilter; // deprecated
|
|
323
324
|
strings?: {
|
|
324
325
|
ariaLinkLabel: strin;
|
package/dist/altcha.d.ts
CHANGED
|
@@ -10,23 +10,40 @@ declare global {
|
|
|
10
10
|
set: (language: string, translation: Record<string, string>) => void;
|
|
11
11
|
store: {
|
|
12
12
|
set(this: void, value: Record<string, Record<string, string>>): void;
|
|
13
|
-
update(
|
|
14
|
-
|
|
13
|
+
update(
|
|
14
|
+
this: void,
|
|
15
|
+
updater: (
|
|
16
|
+
value: Record<string, Record<string, string>>
|
|
17
|
+
) => Record<string, Record<string, string>>
|
|
18
|
+
): void;
|
|
19
|
+
subscribe(
|
|
20
|
+
this: void,
|
|
21
|
+
run: (value: Record<string, Record<string, string>>) => void,
|
|
22
|
+
invalidate?: () => void
|
|
23
|
+
): () => void;
|
|
15
24
|
};
|
|
16
25
|
};
|
|
17
26
|
|
|
18
|
-
type AltchaState =
|
|
27
|
+
type AltchaState =
|
|
28
|
+
| 'error'
|
|
29
|
+
| 'expired'
|
|
30
|
+
| 'verified'
|
|
31
|
+
| 'verifying'
|
|
32
|
+
| 'unverified';
|
|
19
33
|
|
|
20
|
-
interface AltchaStateChangeEvent
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
interface AltchaStateChangeEvent
|
|
35
|
+
extends CustomEvent<{
|
|
36
|
+
payload?: string;
|
|
37
|
+
state: AltchaState;
|
|
38
|
+
}> {}
|
|
24
39
|
|
|
25
|
-
interface AltchaVerifiedEvent
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
interface AltchaVerifiedEvent
|
|
41
|
+
extends CustomEvent<{
|
|
42
|
+
payload: string;
|
|
43
|
+
}> {}
|
|
28
44
|
|
|
29
|
-
interface AltchaServerVerificationEvent
|
|
45
|
+
interface AltchaServerVerificationEvent
|
|
46
|
+
extends CustomEvent<Record<string, unknown>> {}
|
|
30
47
|
|
|
31
48
|
interface AltchaWidgetOptions {
|
|
32
49
|
auto?: 'off' | 'onfocus' | 'onload' | 'onsubmit';
|
|
@@ -35,10 +52,13 @@ declare global {
|
|
|
35
52
|
challengeurl?: string;
|
|
36
53
|
challengejson?: string;
|
|
37
54
|
credentials?: 'omit' | 'same-origin' | 'include' | boolean | undefined;
|
|
38
|
-
customfetch?:
|
|
55
|
+
customfetch?:
|
|
56
|
+
| string
|
|
57
|
+
| ((url: string, init?: RequestInit) => Promise<Response>);
|
|
39
58
|
debug?: boolean;
|
|
40
59
|
delay?: number;
|
|
41
60
|
disableautofocus?: boolean;
|
|
61
|
+
disablerefetchonexpire?: boolean;
|
|
42
62
|
expire?: number;
|
|
43
63
|
floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean;
|
|
44
64
|
floatinganchor?: string;
|
|
@@ -62,6 +82,7 @@ declare global {
|
|
|
62
82
|
overlay?: boolean;
|
|
63
83
|
overlaycontent?: string;
|
|
64
84
|
plugins?: string;
|
|
85
|
+
/** @deprecated Use `disablerefetchonexpire` instead. */
|
|
65
86
|
refetchonexpire?: boolean;
|
|
66
87
|
/** @deprecated */
|
|
67
88
|
spamfilter?: boolean | 'ipAddress';
|
|
@@ -82,14 +103,13 @@ declare global {
|
|
|
82
103
|
hide: () => void;
|
|
83
104
|
repositionFloating: (viewportOffset?: number) => void;
|
|
84
105
|
reset: (newState?: AltchaState, err?: string | null) => void;
|
|
85
|
-
setFloatingAnchor: (el: HTMLElement) => void;
|
|
86
|
-
setState: (newState: AltchaState, err?: string | null) => void;
|
|
106
|
+
setFloatingAnchor: (el: HTMLElement) => void;
|
|
107
|
+
setState: (newState: AltchaState, err?: string | null) => void;
|
|
87
108
|
show: () => void;
|
|
88
109
|
verify: () => Promise<void>;
|
|
89
110
|
}
|
|
90
111
|
|
|
91
|
-
interface AltchaWidget extends AltchaWidgetOptions {
|
|
92
|
-
}
|
|
112
|
+
interface AltchaWidget extends AltchaWidgetOptions {}
|
|
93
113
|
|
|
94
114
|
interface AltchaWidgetCSSProperties extends Partial<CSSStyleDeclaration> {
|
|
95
115
|
'--altcha-border-width'?: string;
|
|
@@ -138,7 +158,7 @@ declare global {
|
|
|
138
158
|
}
|
|
139
159
|
}
|
|
140
160
|
|
|
141
|
-
declare module
|
|
161
|
+
declare module 'react' {
|
|
142
162
|
namespace JSX {
|
|
143
163
|
interface IntrinsicElements {
|
|
144
164
|
'altcha-widget': AltchaWidgetReact;
|
|
@@ -146,7 +166,7 @@ declare module "react" {
|
|
|
146
166
|
}
|
|
147
167
|
}
|
|
148
168
|
|
|
149
|
-
declare module
|
|
169
|
+
declare module 'react/jsx-runtime' {
|
|
150
170
|
namespace JSX {
|
|
151
171
|
interface IntrinsicElements {
|
|
152
172
|
'altcha-widget': AltchaWidgetReact;
|
|
@@ -154,7 +174,7 @@ declare module "react/jsx-runtime" {
|
|
|
154
174
|
}
|
|
155
175
|
}
|
|
156
176
|
|
|
157
|
-
declare module
|
|
177
|
+
declare module 'react/jsx-dev-runtime' {
|
|
158
178
|
namespace JSX {
|
|
159
179
|
interface IntrinsicElements {
|
|
160
180
|
'altcha-widget': AltchaWidgetReact;
|
package/dist/altcha.i18n.d.ts
CHANGED
|
@@ -10,23 +10,40 @@ declare global {
|
|
|
10
10
|
set: (language: string, translation: Record<string, string>) => void;
|
|
11
11
|
store: {
|
|
12
12
|
set(this: void, value: Record<string, Record<string, string>>): void;
|
|
13
|
-
update(
|
|
14
|
-
|
|
13
|
+
update(
|
|
14
|
+
this: void,
|
|
15
|
+
updater: (
|
|
16
|
+
value: Record<string, Record<string, string>>
|
|
17
|
+
) => Record<string, Record<string, string>>
|
|
18
|
+
): void;
|
|
19
|
+
subscribe(
|
|
20
|
+
this: void,
|
|
21
|
+
run: (value: Record<string, Record<string, string>>) => void,
|
|
22
|
+
invalidate?: () => void
|
|
23
|
+
): () => void;
|
|
15
24
|
};
|
|
16
25
|
};
|
|
17
26
|
|
|
18
|
-
type AltchaState =
|
|
27
|
+
type AltchaState =
|
|
28
|
+
| 'error'
|
|
29
|
+
| 'expired'
|
|
30
|
+
| 'verified'
|
|
31
|
+
| 'verifying'
|
|
32
|
+
| 'unverified';
|
|
19
33
|
|
|
20
|
-
interface AltchaStateChangeEvent
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
interface AltchaStateChangeEvent
|
|
35
|
+
extends CustomEvent<{
|
|
36
|
+
payload?: string;
|
|
37
|
+
state: AltchaState;
|
|
38
|
+
}> {}
|
|
24
39
|
|
|
25
|
-
interface AltchaVerifiedEvent
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
interface AltchaVerifiedEvent
|
|
41
|
+
extends CustomEvent<{
|
|
42
|
+
payload: string;
|
|
43
|
+
}> {}
|
|
28
44
|
|
|
29
|
-
interface AltchaServerVerificationEvent
|
|
45
|
+
interface AltchaServerVerificationEvent
|
|
46
|
+
extends CustomEvent<Record<string, unknown>> {}
|
|
30
47
|
|
|
31
48
|
interface AltchaWidgetOptions {
|
|
32
49
|
auto?: 'off' | 'onfocus' | 'onload' | 'onsubmit';
|
|
@@ -35,10 +52,13 @@ declare global {
|
|
|
35
52
|
challengeurl?: string;
|
|
36
53
|
challengejson?: string;
|
|
37
54
|
credentials?: 'omit' | 'same-origin' | 'include' | boolean | undefined;
|
|
38
|
-
customfetch?:
|
|
55
|
+
customfetch?:
|
|
56
|
+
| string
|
|
57
|
+
| ((url: string, init?: RequestInit) => Promise<Response>);
|
|
39
58
|
debug?: boolean;
|
|
40
59
|
delay?: number;
|
|
41
60
|
disableautofocus?: boolean;
|
|
61
|
+
disablerefetchonexpire?: boolean;
|
|
42
62
|
expire?: number;
|
|
43
63
|
floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean;
|
|
44
64
|
floatinganchor?: string;
|
|
@@ -62,6 +82,7 @@ declare global {
|
|
|
62
82
|
overlay?: boolean;
|
|
63
83
|
overlaycontent?: string;
|
|
64
84
|
plugins?: string;
|
|
85
|
+
/** @deprecated Use `disablerefetchonexpire` instead. */
|
|
65
86
|
refetchonexpire?: boolean;
|
|
66
87
|
/** @deprecated */
|
|
67
88
|
spamfilter?: boolean | 'ipAddress';
|
|
@@ -82,14 +103,13 @@ declare global {
|
|
|
82
103
|
hide: () => void;
|
|
83
104
|
repositionFloating: (viewportOffset?: number) => void;
|
|
84
105
|
reset: (newState?: AltchaState, err?: string | null) => void;
|
|
85
|
-
setFloatingAnchor: (el: HTMLElement) => void;
|
|
86
|
-
setState: (newState: AltchaState, err?: string | null) => void;
|
|
106
|
+
setFloatingAnchor: (el: HTMLElement) => void;
|
|
107
|
+
setState: (newState: AltchaState, err?: string | null) => void;
|
|
87
108
|
show: () => void;
|
|
88
109
|
verify: () => Promise<void>;
|
|
89
110
|
}
|
|
90
111
|
|
|
91
|
-
interface AltchaWidget extends AltchaWidgetOptions {
|
|
92
|
-
}
|
|
112
|
+
interface AltchaWidget extends AltchaWidgetOptions {}
|
|
93
113
|
|
|
94
114
|
interface AltchaWidgetCSSProperties extends Partial<CSSStyleDeclaration> {
|
|
95
115
|
'--altcha-border-width'?: string;
|
|
@@ -138,7 +158,7 @@ declare global {
|
|
|
138
158
|
}
|
|
139
159
|
}
|
|
140
160
|
|
|
141
|
-
declare module
|
|
161
|
+
declare module 'react' {
|
|
142
162
|
namespace JSX {
|
|
143
163
|
interface IntrinsicElements {
|
|
144
164
|
'altcha-widget': AltchaWidgetReact;
|
|
@@ -146,7 +166,7 @@ declare module "react" {
|
|
|
146
166
|
}
|
|
147
167
|
}
|
|
148
168
|
|
|
149
|
-
declare module
|
|
169
|
+
declare module 'react/jsx-runtime' {
|
|
150
170
|
namespace JSX {
|
|
151
171
|
interface IntrinsicElements {
|
|
152
172
|
'altcha-widget': AltchaWidgetReact;
|
|
@@ -154,7 +174,7 @@ declare module "react/jsx-runtime" {
|
|
|
154
174
|
}
|
|
155
175
|
}
|
|
156
176
|
|
|
157
|
-
declare module
|
|
177
|
+
declare module 'react/jsx-dev-runtime' {
|
|
158
178
|
namespace JSX {
|
|
159
179
|
interface IntrinsicElements {
|
|
160
180
|
'altcha-widget': AltchaWidgetReact;
|