Checkpoint
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Tune a Protection Profile
|
||||
---
|
||||
|
||||
### Throttling Windows
|
||||
|
||||
The first of all settings a protection profile has are the throttling windows. Throttling windows
|
||||
rate-limit challenge issuance.
|
||||
|
||||

|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Write Your Own SDK
|
||||
description: Learn to write your own Duckity SDK, for when an official one is not yet available.
|
||||
---
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Introduction
|
||||
title: Overview
|
||||
description: Welcome to Duckity's documentation site!
|
||||
icon: Fish
|
||||
---
|
||||
@@ -16,4 +16,3 @@ DDoS protection service. Use Cloudflare, Bunny.net, or similar for protection of
|
||||
|
||||
If you're new to Duckity, head over to the [Quick Start](/quick-start). It'll guide you on how to get started and
|
||||
give you some templates to reduce the boilerplate configuration tasks.
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"pages": [
|
||||
"---Introduction---",
|
||||
"index",
|
||||
"quick-start",
|
||||
"---[BookOpenText]Guides---",
|
||||
"guides/tune-a-protection-profile",
|
||||
"guides/write-your-own-sdk",
|
||||
"---[CodeXml]Integrate---",
|
||||
"sdks/javascript",
|
||||
"sdks/react",
|
||||
"sdks/c",
|
||||
"sdks/python",
|
||||
"sdks/rust-std",
|
||||
"sdks/rust-no-std"
|
||||
]
|
||||
}
|
||||
+65
-29
@@ -8,34 +8,24 @@ Getting started with Duckity is quite simple. Head over to
|
||||
[Duckity's Dashboard](https://app.duckity.com/) and log in using your favorite method. If it's your
|
||||
first time logging in, your account will be automatically created.
|
||||
|
||||
If it's your first time logging into Duckity, your dashboard will be empty.
|
||||
|
||||

|
||||
|
||||
## Applications
|
||||
## Create an Application [step]
|
||||
|
||||
Duckity is divided into one or more applications within your account. You create one application
|
||||
per project in which you want to integrate Duckity. To create a new application, press on the
|
||||
yellow **+ New Application** button at the top right corner of the screen.
|
||||
|
||||

|
||||
|
||||
Once you've set the name of it, press on the **✓ Create Application** button. Congratulations! You
|
||||
now have your first application created.
|
||||
|
||||

|
||||
<Callout>
|
||||
Additionally, in case your application is a web app, you can set up the CORS
|
||||
origins to fit your application's origins. For example, if you'll be
|
||||
protecting the login form of your app hosted at `https://example.com/login`,
|
||||
add `https://example.com` (scheme and host, no path) to your app's origins. If
|
||||
your application is not a web app, you can leave the CORS origins empty.
|
||||
</Callout>
|
||||
|
||||
Each application has a credentials pair consisting of:
|
||||
|
||||
- **Application ID**: The unique identifier of your app.
|
||||
- **Application Secret**: Your app's "password". As the name implies, keep it secret.
|
||||
|
||||
Additionally, in case your application is a web app, you can set up the CORS origins to fit your
|
||||
application's origins. For example, if you'll be protecting the login form of your app hosted at
|
||||
`https://example.com/login`, add `https://example.com` (scheme and host, no path) to your app's
|
||||
origins. If your application is not a web app, you can leave the CORS origins empty.
|
||||
|
||||
## Protection Profiles
|
||||
## Create a Protection Profile [step]
|
||||
|
||||
Applications commonly have multiple features that need to be protected. For example, you may have a
|
||||
signup form and a login form with different protection needs. For each, you'll create one
|
||||
@@ -44,20 +34,66 @@ signup form and a login form with different protection needs. For each, you'll c
|
||||
Each application needs at least one protection profile to work. To create your first one, press the
|
||||
**+ Create Protection Profile** button.
|
||||
|
||||

|
||||
|
||||
Set the name to the name of the feature you'll be protecting, like "Sign-up Form" or "Add Friend".
|
||||
This is for you to recognize it later, it won't be displayed to your users. Once you're done
|
||||
filling it, press on **✓ Create Protection Profile**.
|
||||
filling it, press on **✓ Create Protection Profile**.
|
||||
|
||||
Congrats! Your first protection profile is now created. You'll see a lot of configuration options,
|
||||
but don't worry; We'll go one by one explaining them below.
|
||||
Copy your protection profile's ID using the button at the top right corner, that's all you'll need
|
||||
to integrate it into your application.
|
||||
|
||||

|
||||
<Callout>
|
||||
Don't worry about all the settings displayed for now, you'll learn to tune
|
||||
them later.
|
||||
</Callout>
|
||||
|
||||
### Throttling Windows
|
||||
## Install an SDK [step]
|
||||
|
||||
The first of all settings a protection profile has are the throttling windows. Throttling windows
|
||||
rate-limit challenge issuance.
|
||||
To integrate your protection profile with your application, you'll need a client-side SDK and a
|
||||
server-side SDK.
|
||||
|
||||

|
||||
Duckity has multiple official SDKs for you to plug and play.
|
||||
|
||||
import {
|
||||
SiC,
|
||||
SiJavascript,
|
||||
SiPython,
|
||||
SiRust,
|
||||
SiReact,
|
||||
} from "@icons-pack/react-simple-icons";
|
||||
|
||||
<Cards>
|
||||
<Card href="/sdks/javascript" title="JavaScript" icon={<SiJavascript />}>
|
||||
Integrate client-side code with Duckity using the JavaScript SDK.
|
||||
</Card>
|
||||
<Card href="/sdks/react" title="React" icon={<SiReact />}>
|
||||
Integrate client-side code with Duckity using the React SDK.
|
||||
</Card>
|
||||
<Card href="/sdks/c" title="C" icon={<SiC />}>
|
||||
Integrate client-side code with Duckity using the C SDK.
|
||||
</Card>
|
||||
<Card href="/sdks/python" title="Python 3" icon={<SiPython />}>
|
||||
Integrate client-side code with Duckity using the Python SDK.
|
||||
</Card>
|
||||
<Card href="/sdks/rust-std" title="Rust (STD)" icon={<SiRust />}>
|
||||
Integrate client-side code with Duckity using the Rust SDK. Uses GMP via
|
||||
`rug`.
|
||||
</Card>
|
||||
<Card href="/sdks/rust-no-std" title="Rust (No STD)" icon={<SiRust />}>
|
||||
Integrate client-side code with Duckity using the Rust SDK. Uses
|
||||
`num-bigint-dig`.
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
In case we don't have a client SDK for your language yet, you can use the C SDK. It's written in
|
||||
Rust, you can link to it through the exposed C API, and it wraps all the required encoding and
|
||||
decoding in a simple API. You may also find the following guide useful:
|
||||
|
||||
import { FileCodeCorner } from "lucide-react";
|
||||
|
||||
<Card
|
||||
title="Write Your Own SDK"
|
||||
icon={<FileCodeCorner />}
|
||||
href="/guides/write-your-own-sdk"
|
||||
>
|
||||
Learn how to write your own SDK in any language.
|
||||
</Card>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: C
|
||||
icon: SiC
|
||||
---
|
||||
@@ -0,0 +1,137 @@
|
||||
---
|
||||
title: JavaScript (Client-Side)
|
||||
description: Learn how to integrate Duckity into your web application.
|
||||
icon: SiJavascript
|
||||
---
|
||||
|
||||
Welcome to the Duckity JavaScript + WASM SDK documentation! This guide will teach you how to
|
||||
install and set up the SDK in no time.
|
||||
|
||||
The following SDKs depend on this one and provide specialized wrappers for different frameworks:
|
||||
|
||||
import { SiReact } from "@icons-pack/react-simple-icons";
|
||||
|
||||
<Cards>
|
||||
<Card href="/sdks/react" title="React" icon={<SiReact />}>
|
||||
Integrate client-side code with Duckity using the React SDK.
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Quick Start
|
||||
|
||||
Before you can integrate Duckity into your application, you'll need to have the following:
|
||||
|
||||
1. An application,
|
||||
2. CORS origins set up pointing to your application's origin(s),
|
||||
3. At least one protection profile created in that application, and
|
||||
4. The ID of the protection profiles to use
|
||||
|
||||
If you're missing either of those, head over to the [Duckity Dashboard](https://app.duckity.com) or
|
||||
read the [Quick Start](/quick-start) guide to learn how to set those up.
|
||||
|
||||
Once you got those ready, follow these steps to get things running on your client:
|
||||
|
||||
### Install the SDK [step]
|
||||
|
||||
Follow these steps depending on your application:
|
||||
|
||||
<Tabs items={["Installed", "Via CDN"]}>
|
||||
<Tab>
|
||||
Run the following line in your terminal to install the Duckity SDK.
|
||||
|
||||
```package-install
|
||||
@duckity/js
|
||||
```
|
||||
|
||||
Then import it in your code:
|
||||
|
||||
```ts twoslash
|
||||
import duckity from "@duckity/js";
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
If you're using the SDK from a static site, import it using a CDN like [esm.sh](https://esm.sh/)
|
||||
instead.
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
// Using esm.sh
|
||||
import duckity from "https://esm.sh/@duckity/js";
|
||||
|
||||
// Using jsdelivr.net
|
||||
import duckity from "https://cdn.jsdelivr.net/npm/@duckity/js";
|
||||
|
||||
// Using UNPKG
|
||||
import duckity from "https://unpkg.com/@duckity/js";
|
||||
</script>
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Solve a Challenge [step]
|
||||
|
||||
Once you have the SDK installed, you can request a challenge whenever you need it using
|
||||
`duckity.solve()`.
|
||||
|
||||
```ts twoslash
|
||||
const PROTECTION_PROFILE_ID: string = "";
|
||||
// ---cut---
|
||||
import duckity from "@duckity/js";
|
||||
|
||||
let solution = await duckity.solve(PROTECTION_PROFILE_ID);
|
||||
```
|
||||
|
||||
<Callout title="TIP">
|
||||
Hover over the code to see the type definitions.
|
||||
</Callout>
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
Solving a challenge on request works well for simple setups. However, both security and UX can be
|
||||
greatly improved changing a few settings and planning when to solve challenges.
|
||||
|
||||
If your challenges do not require threat correlation keys (set up in the protection profile's
|
||||
settings), issue the challenge as soon as possible. Note, however, that the challenge
|
||||
|
||||
### Threat Correlation Keys
|
||||
|
||||
To pass threat correlation keys when issuing a challenge, set them in the `options` argument of
|
||||
`duckity.solve()`.
|
||||
|
||||
```ts twoslash
|
||||
const PROTECTION_PROFILE_ID: string = "py83YHkXV6ZpIsJZGVxzS";
|
||||
// ---cut---
|
||||
import duckity from "@duckity/js";
|
||||
|
||||
let solution = await duckity.solve(
|
||||
PROTECTION_PROFILE_ID,
|
||||
{
|
||||
keys: {
|
||||
email: "[email protected]",
|
||||
}
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Using On Self-Hosted Ducklings
|
||||
|
||||
Self-hosted ducklings are hosted at a different domain from Duckity-hosted ducklings. To point it
|
||||
to a custom domain, change the following setting:
|
||||
|
||||
```ts twoslash
|
||||
const PROTECTION_PROFILE_ID: string = "py83YHkXV6ZpIsJZGVxzS";
|
||||
// ---cut---
|
||||
import duckity from "@duckity/js";
|
||||
|
||||
let solution = await duckity.solve(
|
||||
PROTECTION_PROFILE_ID,
|
||||
{
|
||||
api: "https://quack.duckity.com",
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
The default value for the `api` parameter is `"https://quack.duckity.com"`, which points to
|
||||
Duckity's hosted duckling. Change the domain name to your
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Python 3
|
||||
icon: SiPython
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: React
|
||||
icon: SiReact
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Rust (No STD)
|
||||
icon: SiRust
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Rust (STD)
|
||||
icon: SiRust
|
||||
---
|
||||
Reference in New Issue
Block a user