altcha-lib 1.1.1 → 1.3.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/cjs/dist/types.d.ts +8 -2
- package/cjs/dist/worker.js +2 -2
- package/dist/types.d.ts +8 -2
- package/dist/worker.js +2 -2
- package/package.json +2 -2
package/cjs/dist/types.d.ts
CHANGED
|
@@ -27,23 +27,29 @@ export interface Payload {
|
|
|
27
27
|
}
|
|
28
28
|
export interface ServerSignaturePayload {
|
|
29
29
|
algorithm: Algorithm;
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
id?: string;
|
|
30
32
|
signature: string;
|
|
31
33
|
verificationData: string;
|
|
32
34
|
verified: boolean;
|
|
33
35
|
}
|
|
34
36
|
export interface ServerSignatureVerificationData {
|
|
37
|
+
[key: string]: string | unknown;
|
|
35
38
|
classification?: Classification;
|
|
36
|
-
country?: string;
|
|
37
|
-
detectedLanguage?: string;
|
|
38
39
|
email?: string;
|
|
39
40
|
expire: number;
|
|
40
41
|
fields?: string[];
|
|
41
42
|
fieldsHash?: string;
|
|
43
|
+
id?: string;
|
|
42
44
|
ipAddress?: string;
|
|
43
45
|
reasons?: string[];
|
|
44
46
|
score?: number;
|
|
45
47
|
time: number;
|
|
46
48
|
verified: boolean;
|
|
49
|
+
/** @deprecated With Sentinel, use location.countryCode */
|
|
50
|
+
country?: string;
|
|
51
|
+
/** @deprecated With Sentinel, use text.language */
|
|
52
|
+
detectedLanguage?: string;
|
|
47
53
|
}
|
|
48
54
|
export interface Solution {
|
|
49
55
|
number: number;
|
package/cjs/dist/worker.js
CHANGED
|
@@ -9,8 +9,8 @@ onmessage = async (message) => {
|
|
|
9
9
|
controller = undefined;
|
|
10
10
|
}
|
|
11
11
|
else if (type === 'work') {
|
|
12
|
-
const {
|
|
13
|
-
const result = (0, index_js_1.solveChallenge)(challenge, salt,
|
|
12
|
+
const { algorithm, challenge, max, salt, start } = payload || {};
|
|
13
|
+
const result = (0, index_js_1.solveChallenge)(challenge, salt, algorithm, max, start);
|
|
14
14
|
controller = result.controller;
|
|
15
15
|
result.promise.then((solution) => {
|
|
16
16
|
self.postMessage(solution ? { ...solution, worker: true } : solution);
|
package/dist/types.d.ts
CHANGED
|
@@ -27,23 +27,29 @@ export interface Payload {
|
|
|
27
27
|
}
|
|
28
28
|
export interface ServerSignaturePayload {
|
|
29
29
|
algorithm: Algorithm;
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
id?: string;
|
|
30
32
|
signature: string;
|
|
31
33
|
verificationData: string;
|
|
32
34
|
verified: boolean;
|
|
33
35
|
}
|
|
34
36
|
export interface ServerSignatureVerificationData {
|
|
37
|
+
[key: string]: string | unknown;
|
|
35
38
|
classification?: Classification;
|
|
36
|
-
country?: string;
|
|
37
|
-
detectedLanguage?: string;
|
|
38
39
|
email?: string;
|
|
39
40
|
expire: number;
|
|
40
41
|
fields?: string[];
|
|
41
42
|
fieldsHash?: string;
|
|
43
|
+
id?: string;
|
|
42
44
|
ipAddress?: string;
|
|
43
45
|
reasons?: string[];
|
|
44
46
|
score?: number;
|
|
45
47
|
time: number;
|
|
46
48
|
verified: boolean;
|
|
49
|
+
/** @deprecated With Sentinel, use location.countryCode */
|
|
50
|
+
country?: string;
|
|
51
|
+
/** @deprecated With Sentinel, use text.language */
|
|
52
|
+
detectedLanguage?: string;
|
|
47
53
|
}
|
|
48
54
|
export interface Solution {
|
|
49
55
|
number: number;
|
package/dist/worker.js
CHANGED
|
@@ -7,8 +7,8 @@ onmessage = async (message) => {
|
|
|
7
7
|
controller = undefined;
|
|
8
8
|
}
|
|
9
9
|
else if (type === 'work') {
|
|
10
|
-
const {
|
|
11
|
-
const result = solveChallenge(challenge, salt,
|
|
10
|
+
const { algorithm, challenge, max, salt, start } = payload || {};
|
|
11
|
+
const result = solveChallenge(challenge, salt, algorithm, max, start);
|
|
12
12
|
controller = result.controller;
|
|
13
13
|
result.promise.then((solution) => {
|
|
14
14
|
self.postMessage(solution ? { ...solution, worker: true } : solution);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "altcha-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A library for creating and verifying ALTCHA challenges for Node.js, Bun and Deno.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Daniel Regeci",
|
|
@@ -71,6 +71,6 @@
|
|
|
71
71
|
"ts-node": "^10.9.2",
|
|
72
72
|
"tsx": "^4.19.0",
|
|
73
73
|
"typescript": "^5.5.4",
|
|
74
|
-
"vitest": "^
|
|
74
|
+
"vitest": "^3.2.2"
|
|
75
75
|
}
|
|
76
76
|
}
|