@friendlycaptcha/server-sdk 0.1.2 → 0.2.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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/api/types.d.ts +13 -1
- package/dist/api/typesRiskIntelligence.d.ts +778 -0
- package/dist/api/typesRiskIntelligence.js +25 -0
- package/dist/api/typesRiskIntelligence.js.map +1 -0
- package/dist/client/client.d.ts +15 -0
- package/dist/client/client.js +28 -8
- package/dist/client/client.js.map +1 -1
- package/dist/client/version.gen.d.ts +1 -1
- package/dist/client/version.gen.js +1 -1
- package/dist/index.d.ts +829 -0
- package/package.json +16 -2
- package/.github/workflows/ci.yml +0 -50
- package/.github/workflows/publish.yml +0 -18
- package/.prettierrc +0 -3
- package/docs/index.md +0 -12
- package/docs/server-sdk.failed_due_to_client_error_code.md +0 -15
- package/docs/server-sdk.failed_to_decode_response_error_code.md +0 -13
- package/docs/server-sdk.failed_to_encode_error_code.md +0 -13
- package/docs/server-sdk.friendlycaptchaclient._constructor_.md +0 -20
- package/docs/server-sdk.friendlycaptchaclient.md +0 -26
- package/docs/server-sdk.friendlycaptchaclient.verifycaptcharesponse.md +0 -30
- package/docs/server-sdk.friendlycaptchaoptions.apikey.md +0 -13
- package/docs/server-sdk.friendlycaptchaoptions.fetch.md +0 -13
- package/docs/server-sdk.friendlycaptchaoptions.md +0 -24
- package/docs/server-sdk.friendlycaptchaoptions.sitekey.md +0 -11
- package/docs/server-sdk.friendlycaptchaoptions.siteverifyendpoint.md +0 -15
- package/docs/server-sdk.friendlycaptchaoptions.strict.md +0 -15
- package/docs/server-sdk.md +0 -41
- package/docs/server-sdk.request_failed_error_code.md +0 -13
- package/docs/server-sdk.request_failed_timeout_error_code.md +0 -13
- package/docs/server-sdk.siteverifyerrorresponse.error.md +0 -11
- package/docs/server-sdk.siteverifyerrorresponse.md +0 -20
- package/docs/server-sdk.siteverifyerrorresponse.success.md +0 -11
- package/docs/server-sdk.siteverifyerrorresponseerrordata.detail.md +0 -11
- package/docs/server-sdk.siteverifyerrorresponseerrordata.error_code.md +0 -11
- package/docs/server-sdk.siteverifyerrorresponseerrordata.md +0 -20
- package/docs/server-sdk.siteverifyresponse.md +0 -14
- package/docs/server-sdk.siteverifyresponsechallengedata.md +0 -20
- package/docs/server-sdk.siteverifyresponsechallengedata.origin.md +0 -13
- package/docs/server-sdk.siteverifyresponsechallengedata.timestamp.md +0 -13
- package/docs/server-sdk.siteverifyresponsedata.challenge.md +0 -11
- package/docs/server-sdk.siteverifyresponsedata.md +0 -19
- package/docs/server-sdk.siteverifysuccessresponse.data.md +0 -11
- package/docs/server-sdk.siteverifysuccessresponse.md +0 -20
- package/docs/server-sdk.siteverifysuccessresponse.success.md +0 -11
- package/docs/server-sdk.verifyclienterrorcode.md +0 -14
- package/docs/server-sdk.verifyresult._constructor_.md +0 -20
- package/docs/server-sdk.verifyresult.clienterrortype.md +0 -11
- package/docs/server-sdk.verifyresult.geterrorcode.md +0 -15
- package/docs/server-sdk.verifyresult.getresponse.md +0 -17
- package/docs/server-sdk.verifyresult.getresponseerror.md +0 -17
- package/docs/server-sdk.verifyresult.isclienterror.md +0 -19
- package/docs/server-sdk.verifyresult.isdecodeerror.md +0 -17
- package/docs/server-sdk.verifyresult.isencodeerror.md +0 -17
- package/docs/server-sdk.verifyresult.isrequestortimeouterror.md +0 -17
- package/docs/server-sdk.verifyresult.isstrict.md +0 -17
- package/docs/server-sdk.verifyresult.md +0 -44
- package/docs/server-sdk.verifyresult.response.md +0 -13
- package/docs/server-sdk.verifyresult.shouldaccept.md +0 -17
- package/docs/server-sdk.verifyresult.shouldreject.md +0 -17
- package/docs/server-sdk.verifyresult.status.md +0 -13
- package/docs/server-sdk.verifyresult.wasabletoverify.md +0 -17
- package/example/README.md +0 -29
- package/example/package-lock.json +0 -1404
- package/example/package.json +0 -24
- package/example/src/index.ts +0 -84
- package/example/tsconfig.json +0 -13
- package/example/views/index.ejs +0 -86
- package/src/api/errors.ts +0 -77
- package/src/api/index.ts +0 -1
- package/src/api/types.ts +0 -66
- package/src/client/client.ts +0 -157
- package/src/client/errors.ts +0 -42
- package/src/client/index.ts +0 -3
- package/src/client/result.ts +0 -152
- package/src/client/version.gen.ts +0 -3
- package/src/index.ts +0 -2
- package/test/client/client.test.ts +0 -47
- package/test/client/mock.test.ts +0 -44
- package/tsconfig.json +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friendlycaptcha/server-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Serverside client SDK for the Friendly Captcha V2 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,6 +17,20 @@
|
|
|
17
17
|
},
|
|
18
18
|
"author": "Friendly Captcha GmbH",
|
|
19
19
|
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/FriendlyCaptcha/friendly-captcha-javascript"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md",
|
|
28
|
+
"CHANGELOG.md"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
20
34
|
"devDependencies": {
|
|
21
35
|
"@ava/typescript": "^3.0.1",
|
|
22
36
|
"@babel/cli": "^7.19.3",
|
|
@@ -25,7 +39,7 @@
|
|
|
25
39
|
"@microsoft/api-documenter": "^7.22.27",
|
|
26
40
|
"@microsoft/api-extractor": "^7.36.2",
|
|
27
41
|
"ava": "^4.3.1",
|
|
28
|
-
"esbuild": "^0.
|
|
42
|
+
"esbuild": "^0.27.2",
|
|
29
43
|
"prettier": "^3.0.0",
|
|
30
44
|
"sync-request": "^6.1.0",
|
|
31
45
|
"typescript": "^4.7.4"
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: Javascript SDK tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build_and_test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
|
|
16
|
-
- name: Use Node.js 18.x
|
|
17
|
-
uses: actions/setup-node@v3
|
|
18
|
-
with:
|
|
19
|
-
node-version: 18.x
|
|
20
|
-
cache: "npm"
|
|
21
|
-
cache-dependency-path: "package-lock.json"
|
|
22
|
-
|
|
23
|
-
- name: Install dependencies
|
|
24
|
-
run: |
|
|
25
|
-
npm ci
|
|
26
|
-
|
|
27
|
-
- name: Check formatting with Prettier
|
|
28
|
-
run: npm run fmt:ci
|
|
29
|
-
|
|
30
|
-
- name: Run the SDK testserver
|
|
31
|
-
run: |
|
|
32
|
-
docker run -d -p 1090:1090 friendlycaptcha/sdk-testserver:latest
|
|
33
|
-
echo "SDK Test server started. Checking its health..."
|
|
34
|
-
for i in {1..20}; do
|
|
35
|
-
if curl -s http://localhost:1090; then
|
|
36
|
-
echo "SDK test server is responding!"
|
|
37
|
-
break
|
|
38
|
-
else
|
|
39
|
-
echo "Attempt $i: SDK test server not yet responding. Waiting for 1 second..."
|
|
40
|
-
sleep 1
|
|
41
|
-
fi
|
|
42
|
-
done
|
|
43
|
-
|
|
44
|
-
- name: Test
|
|
45
|
-
run: |
|
|
46
|
-
npm t
|
|
47
|
-
|
|
48
|
-
- name: Build
|
|
49
|
-
run: |
|
|
50
|
-
npm run build:dist
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
on:
|
|
3
|
-
release:
|
|
4
|
-
types: [published]
|
|
5
|
-
jobs:
|
|
6
|
-
publish:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v4
|
|
10
|
-
- uses: actions/setup-node@v3
|
|
11
|
-
with:
|
|
12
|
-
node-version: '20.x'
|
|
13
|
-
registry-url: 'https://registry.npmjs.org'
|
|
14
|
-
- run: npm ci
|
|
15
|
-
- run: npm run build:dist
|
|
16
|
-
- run: npm publish --access public
|
|
17
|
-
env:
|
|
18
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.prettierrc
DELETED
package/docs/index.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FAILED\_DUE\_TO\_CLIENT\_ERROR\_CODE](./server-sdk.failed_due_to_client_error_code.md)
|
|
4
|
-
|
|
5
|
-
## FAILED\_DUE\_TO\_CLIENT\_ERROR\_CODE variable
|
|
6
|
-
|
|
7
|
-
An error occured on the client side that could've been prevented. This generally means your configuration is wrong.
|
|
8
|
-
|
|
9
|
-
Check your API key and sitekey.
|
|
10
|
-
|
|
11
|
-
**Signature:**
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
FAILED_DUE_TO_CLIENT_ERROR_CODE = "request_failed_due_to_client_error"
|
|
15
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FAILED\_TO\_DECODE\_RESPONSE\_ERROR\_CODE](./server-sdk.failed_to_decode_response_error_code.md)
|
|
4
|
-
|
|
5
|
-
## FAILED\_TO\_DECODE\_RESPONSE\_ERROR\_CODE variable
|
|
6
|
-
|
|
7
|
-
The response from the Friendly Captcha API could not be decoded.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
FAILED_TO_DECODE_RESPONSE_ERROR_CODE = "verification_response_could_not_be_decoded"
|
|
13
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FAILED\_TO\_ENCODE\_ERROR\_CODE](./server-sdk.failed_to_encode_error_code.md)
|
|
4
|
-
|
|
5
|
-
## FAILED\_TO\_ENCODE\_ERROR\_CODE variable
|
|
6
|
-
|
|
7
|
-
Failed to encode the captcha response. This means the captcha response was invalid and should never be accepted.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
FAILED_TO_ENCODE_ERROR_CODE = "failed_to_encode_request"
|
|
13
|
-
```
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaClient](./server-sdk.friendlycaptchaclient.md) > [(constructor)](./server-sdk.friendlycaptchaclient._constructor_.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaClient.(constructor)
|
|
6
|
-
|
|
7
|
-
Constructs a new instance of the `FriendlyCaptchaClient` class
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
constructor(opts: FriendlyCaptchaOptions);
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
| Parameter | Type | Description |
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| opts | [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md) | |
|
|
20
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaClient](./server-sdk.friendlycaptchaclient.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaClient class
|
|
6
|
-
|
|
7
|
-
A client for the Friendly Captcha API.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
export declare class FriendlyCaptchaClient
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Constructors
|
|
16
|
-
|
|
17
|
-
| Constructor | Modifiers | Description |
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| [(constructor)(opts)](./server-sdk.friendlycaptchaclient._constructor_.md) | | Constructs a new instance of the <code>FriendlyCaptchaClient</code> class |
|
|
20
|
-
|
|
21
|
-
## Methods
|
|
22
|
-
|
|
23
|
-
| Method | Modifiers | Description |
|
|
24
|
-
| --- | --- | --- |
|
|
25
|
-
| [verifyCaptchaResponse(response, opts)](./server-sdk.friendlycaptchaclient.verifycaptcharesponse.md) | | Verify a captcha response. |
|
|
26
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaClient](./server-sdk.friendlycaptchaclient.md) > [verifyCaptchaResponse](./server-sdk.friendlycaptchaclient.verifycaptcharesponse.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaClient.verifyCaptchaResponse() method
|
|
6
|
-
|
|
7
|
-
Verify a captcha response.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
verifyCaptchaResponse(response: string, opts?: {
|
|
13
|
-
timeout?: number;
|
|
14
|
-
sitekey?: string;
|
|
15
|
-
}): Promise<VerifyResult>;
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Parameters
|
|
19
|
-
|
|
20
|
-
| Parameter | Type | Description |
|
|
21
|
-
| --- | --- | --- |
|
|
22
|
-
| response | string | The response token from the captcha. |
|
|
23
|
-
| opts | { timeout?: number; sitekey?: string; } | _(Optional)_ Optional options object: \* <code>timeout</code>: The timeout in milliseconds. Defaults to 20 seconds. \* <code>sitekey</code>: The sitekey to use for this request. Defaults to the sitekey passed to the constructor (if any). |
|
|
24
|
-
|
|
25
|
-
**Returns:**
|
|
26
|
-
|
|
27
|
-
Promise<[VerifyResult](./server-sdk.verifyresult.md)<!-- -->>
|
|
28
|
-
|
|
29
|
-
A promise that always resolves to a `VerifyResult` object, which contains the fields `shouldAccept()` and `wasAbleToVerify()`<!-- -->. This promise never rejects.
|
|
30
|
-
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md) > [apiKey](./server-sdk.friendlycaptchaoptions.apikey.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaOptions.apiKey property
|
|
6
|
-
|
|
7
|
-
Friendly Captcha API Key.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
apiKey: string;
|
|
13
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md) > [fetch](./server-sdk.friendlycaptchaoptions.fetch.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaOptions.fetch property
|
|
6
|
-
|
|
7
|
-
The fetch implementation to use. Defaults to `globalThis.fetch`<!-- -->.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
fetch?: typeof globalThis.fetch;
|
|
13
|
-
```
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaOptions interface
|
|
6
|
-
|
|
7
|
-
Configuration options when creating a new `FriendlyCaptchaClient`<!-- -->.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
export interface FriendlyCaptchaOptions
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Properties
|
|
16
|
-
|
|
17
|
-
| Property | Modifiers | Type | Description |
|
|
18
|
-
| --- | --- | --- | --- |
|
|
19
|
-
| [apiKey](./server-sdk.friendlycaptchaoptions.apikey.md) | | string | Friendly Captcha API Key. |
|
|
20
|
-
| [fetch?](./server-sdk.friendlycaptchaoptions.fetch.md) | | typeof globalThis.fetch | _(Optional)_ The fetch implementation to use. Defaults to <code>globalThis.fetch</code>. |
|
|
21
|
-
| [sitekey?](./server-sdk.friendlycaptchaoptions.sitekey.md) | | string | _(Optional)_ |
|
|
22
|
-
| [siteverifyEndpoint?](./server-sdk.friendlycaptchaoptions.siteverifyendpoint.md) | | string | <p>_(Optional)_ The endpoint to use for the API. Can be "eu", "global", or a custom URL.</p><p>Defaults to <code>"global"</code>.</p> |
|
|
23
|
-
| [strict?](./server-sdk.friendlycaptchaoptions.strict.md) | | boolean | <p>_(Optional)_ Whether to use strict mode, which rejects all captcha responses which were not strictly verified.</p><p>This is not recommended. Defaults to <code>false</code>.</p> |
|
|
24
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md) > [sitekey](./server-sdk.friendlycaptchaoptions.sitekey.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaOptions.sitekey property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
sitekey?: string;
|
|
11
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md) > [siteverifyEndpoint](./server-sdk.friendlycaptchaoptions.siteverifyendpoint.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaOptions.siteverifyEndpoint property
|
|
6
|
-
|
|
7
|
-
The endpoint to use for the API. Can be "eu", "global", or a custom URL.
|
|
8
|
-
|
|
9
|
-
Defaults to `"global"`<!-- -->.
|
|
10
|
-
|
|
11
|
-
**Signature:**
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
siteverifyEndpoint?: string;
|
|
15
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md) > [strict](./server-sdk.friendlycaptchaoptions.strict.md)
|
|
4
|
-
|
|
5
|
-
## FriendlyCaptchaOptions.strict property
|
|
6
|
-
|
|
7
|
-
Whether to use strict mode, which rejects all captcha responses which were not strictly verified.
|
|
8
|
-
|
|
9
|
-
This is not recommended. Defaults to `false`<!-- -->.
|
|
10
|
-
|
|
11
|
-
**Signature:**
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
strict?: boolean;
|
|
15
|
-
```
|
package/docs/server-sdk.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md)
|
|
4
|
-
|
|
5
|
-
## server-sdk package
|
|
6
|
-
|
|
7
|
-
## Classes
|
|
8
|
-
|
|
9
|
-
| Class | Description |
|
|
10
|
-
| --- | --- |
|
|
11
|
-
| [FriendlyCaptchaClient](./server-sdk.friendlycaptchaclient.md) | A client for the Friendly Captcha API. |
|
|
12
|
-
| [VerifyResult](./server-sdk.verifyresult.md) | The result of a captcha siteverify request. |
|
|
13
|
-
|
|
14
|
-
## Interfaces
|
|
15
|
-
|
|
16
|
-
| Interface | Description |
|
|
17
|
-
| --- | --- |
|
|
18
|
-
| [FriendlyCaptchaOptions](./server-sdk.friendlycaptchaoptions.md) | Configuration options when creating a new <code>FriendlyCaptchaClient</code>. |
|
|
19
|
-
| [SiteverifyErrorResponse](./server-sdk.siteverifyerrorresponse.md) | |
|
|
20
|
-
| [SiteverifyErrorResponseErrorData](./server-sdk.siteverifyerrorresponseerrordata.md) | |
|
|
21
|
-
| [SiteverifyResponseChallengeData](./server-sdk.siteverifyresponsechallengedata.md) | |
|
|
22
|
-
| [SiteverifyResponseData](./server-sdk.siteverifyresponsedata.md) | |
|
|
23
|
-
| [SiteverifySuccessResponse](./server-sdk.siteverifysuccessresponse.md) | |
|
|
24
|
-
|
|
25
|
-
## Variables
|
|
26
|
-
|
|
27
|
-
| Variable | Description |
|
|
28
|
-
| --- | --- |
|
|
29
|
-
| [FAILED\_DUE\_TO\_CLIENT\_ERROR\_CODE](./server-sdk.failed_due_to_client_error_code.md) | <p>An error occured on the client side that could've been prevented. This generally means your configuration is wrong.</p><p>Check your API key and sitekey.</p> |
|
|
30
|
-
| [FAILED\_TO\_DECODE\_RESPONSE\_ERROR\_CODE](./server-sdk.failed_to_decode_response_error_code.md) | The response from the Friendly Captcha API could not be decoded. |
|
|
31
|
-
| [FAILED\_TO\_ENCODE\_ERROR\_CODE](./server-sdk.failed_to_encode_error_code.md) | Failed to encode the captcha response. This means the captcha response was invalid and should never be accepted. |
|
|
32
|
-
| [REQUEST\_FAILED\_ERROR\_CODE](./server-sdk.request_failed_error_code.md) | The request couldn't be made, perhaps there is a network outage, DNS issue, or the API is unreachable. |
|
|
33
|
-
| [REQUEST\_FAILED\_TIMEOUT\_ERROR\_CODE](./server-sdk.request_failed_timeout_error_code.md) | The request couldn't be made, perhaps there is a network outage, DNS issue, or the API is unreachable. |
|
|
34
|
-
|
|
35
|
-
## Type Aliases
|
|
36
|
-
|
|
37
|
-
| Type Alias | Description |
|
|
38
|
-
| --- | --- |
|
|
39
|
-
| [SiteverifyResponse](./server-sdk.siteverifyresponse.md) | |
|
|
40
|
-
| [VerifyClientErrorCode](./server-sdk.verifyclienterrorcode.md) | |
|
|
41
|
-
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [REQUEST\_FAILED\_ERROR\_CODE](./server-sdk.request_failed_error_code.md)
|
|
4
|
-
|
|
5
|
-
## REQUEST\_FAILED\_ERROR\_CODE variable
|
|
6
|
-
|
|
7
|
-
The request couldn't be made, perhaps there is a network outage, DNS issue, or the API is unreachable.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
REQUEST_FAILED_ERROR_CODE = "request_failed"
|
|
13
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [REQUEST\_FAILED\_TIMEOUT\_ERROR\_CODE](./server-sdk.request_failed_timeout_error_code.md)
|
|
4
|
-
|
|
5
|
-
## REQUEST\_FAILED\_TIMEOUT\_ERROR\_CODE variable
|
|
6
|
-
|
|
7
|
-
The request couldn't be made, perhaps there is a network outage, DNS issue, or the API is unreachable.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
REQUEST_FAILED_TIMEOUT_ERROR_CODE = "request_failed_due_to_timeout"
|
|
13
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyErrorResponse](./server-sdk.siteverifyerrorresponse.md) > [error](./server-sdk.siteverifyerrorresponse.error.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyErrorResponse.error property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
error: SiteverifyErrorResponseErrorData;
|
|
11
|
-
```
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyErrorResponse](./server-sdk.siteverifyerrorresponse.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyErrorResponse interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export interface SiteverifyErrorResponse
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Properties
|
|
15
|
-
|
|
16
|
-
| Property | Modifiers | Type | Description |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| [error](./server-sdk.siteverifyerrorresponse.error.md) | | [SiteverifyErrorResponseErrorData](./server-sdk.siteverifyerrorresponseerrordata.md) | |
|
|
19
|
-
| [success](./server-sdk.siteverifyerrorresponse.success.md) | | false | |
|
|
20
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyErrorResponse](./server-sdk.siteverifyerrorresponse.md) > [success](./server-sdk.siteverifyerrorresponse.success.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyErrorResponse.success property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
success: false;
|
|
11
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyErrorResponseErrorData](./server-sdk.siteverifyerrorresponseerrordata.md) > [detail](./server-sdk.siteverifyerrorresponseerrordata.detail.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyErrorResponseErrorData.detail property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
detail: string;
|
|
11
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyErrorResponseErrorData](./server-sdk.siteverifyerrorresponseerrordata.md) > [error\_code](./server-sdk.siteverifyerrorresponseerrordata.error_code.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyErrorResponseErrorData.error\_code property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
error_code: SiteverifyErrorCode;
|
|
11
|
-
```
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyErrorResponseErrorData](./server-sdk.siteverifyerrorresponseerrordata.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyErrorResponseErrorData interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export interface SiteverifyErrorResponseErrorData
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Properties
|
|
15
|
-
|
|
16
|
-
| Property | Modifiers | Type | Description |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| [detail](./server-sdk.siteverifyerrorresponseerrordata.detail.md) | | string | |
|
|
19
|
-
| [error\_code](./server-sdk.siteverifyerrorresponseerrordata.error_code.md) | | SiteverifyErrorCode | |
|
|
20
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyResponse](./server-sdk.siteverifyresponse.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyResponse type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export type SiteverifyResponse = SiteverifySuccessResponse | SiteverifyErrorResponse;
|
|
12
|
-
```
|
|
13
|
-
**References:** [SiteverifySuccessResponse](./server-sdk.siteverifysuccessresponse.md)<!-- -->, [SiteverifyErrorResponse](./server-sdk.siteverifyerrorresponse.md)
|
|
14
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyResponseChallengeData](./server-sdk.siteverifyresponsechallengedata.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyResponseChallengeData interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export interface SiteverifyResponseChallengeData
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Properties
|
|
15
|
-
|
|
16
|
-
| Property | Modifiers | Type | Description |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| [origin](./server-sdk.siteverifyresponsechallengedata.origin.md) | | string | The origin of the site where the captcha was solved (if known, can be empty string if not known). |
|
|
19
|
-
| [timestamp](./server-sdk.siteverifyresponsechallengedata.timestamp.md) | | string | Timestamp when the captcha challenge was completed (RFC3339). |
|
|
20
|
-
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyResponseChallengeData](./server-sdk.siteverifyresponsechallengedata.md) > [origin](./server-sdk.siteverifyresponsechallengedata.origin.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyResponseChallengeData.origin property
|
|
6
|
-
|
|
7
|
-
The origin of the site where the captcha was solved (if known, can be empty string if not known).
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
origin: string;
|
|
13
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyResponseChallengeData](./server-sdk.siteverifyresponsechallengedata.md) > [timestamp](./server-sdk.siteverifyresponsechallengedata.timestamp.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyResponseChallengeData.timestamp property
|
|
6
|
-
|
|
7
|
-
Timestamp when the captcha challenge was completed (RFC3339).
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
timestamp: string;
|
|
13
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyResponseData](./server-sdk.siteverifyresponsedata.md) > [challenge](./server-sdk.siteverifyresponsedata.challenge.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyResponseData.challenge property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
challenge: SiteverifyResponseChallengeData;
|
|
11
|
-
```
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifyResponseData](./server-sdk.siteverifyresponsedata.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifyResponseData interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export interface SiteverifyResponseData
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Properties
|
|
15
|
-
|
|
16
|
-
| Property | Modifiers | Type | Description |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| [challenge](./server-sdk.siteverifyresponsedata.challenge.md) | | [SiteverifyResponseChallengeData](./server-sdk.siteverifyresponsechallengedata.md) | |
|
|
19
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifySuccessResponse](./server-sdk.siteverifysuccessresponse.md) > [data](./server-sdk.siteverifysuccessresponse.data.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifySuccessResponse.data property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
data: SiteverifyResponseData;
|
|
11
|
-
```
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@friendlycaptcha/server-sdk](./server-sdk.md) > [SiteverifySuccessResponse](./server-sdk.siteverifysuccessresponse.md)
|
|
4
|
-
|
|
5
|
-
## SiteverifySuccessResponse interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export interface SiteverifySuccessResponse
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Properties
|
|
15
|
-
|
|
16
|
-
| Property | Modifiers | Type | Description |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| [data](./server-sdk.siteverifysuccessresponse.data.md) | | [SiteverifyResponseData](./server-sdk.siteverifyresponsedata.md) | |
|
|
19
|
-
| [success](./server-sdk.siteverifysuccessresponse.success.md) | | true | |
|
|
20
|
-
|