mirror of
https://github.com/versia-pub/server.git
synced 2026-04-28 13:19:16 +02:00
refactor: 📝 Move documentation to a custom VitePress site
This commit is contained in:
parent
19d8680289
commit
06a8dd1c0a
26 changed files with 1449 additions and 775 deletions
|
|
@ -8,6 +8,21 @@ This is a form of proof of work CAPTCHA, and should be mostly invisible to users
|
|||
|
||||
Challenges are powered by the [Altcha](https://altcha.org/) library. You may either reimplement their solution code (which is very simple), or use [`altcha-lib`](https://github.com/altcha-org/altcha-lib) to solve the challenges.
|
||||
|
||||
## Challenge
|
||||
|
||||
```typescript
|
||||
type UUID = string;
|
||||
|
||||
interface Challenge {
|
||||
id: UUID;
|
||||
algorithm: "SHA-256" | "SHA-384" | "SHA-512";
|
||||
challenge: string;
|
||||
maxnumber?: number;
|
||||
salt: string;
|
||||
signature: string;
|
||||
}
|
||||
```
|
||||
|
||||
## Request Challenge
|
||||
|
||||
```http
|
||||
|
|
@ -16,17 +31,32 @@ POST /api/v1/challenges
|
|||
|
||||
Generates a new challenge for the client to solve.
|
||||
|
||||
- **Returns:**: [`Challenge`](#challenge)
|
||||
- **Authentication:**: Not required
|
||||
- **Permissions:**: None
|
||||
- **Version History**:
|
||||
- `0.7.0`: Added.
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
POST /api/v1/challenges
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```ts
|
||||
// 200 OK
|
||||
#### `200 OK`
|
||||
|
||||
Challenge data.
|
||||
|
||||
```json
|
||||
{
|
||||
id: string,
|
||||
algorithm: "SHA-256" | "SHA-384" | "SHA-512",
|
||||
challenge: string;
|
||||
maxnumber?: number;
|
||||
salt: string;
|
||||
signature: string;
|
||||
"id":"01931621-1456-7b5b-be65-c044e6b47cbb",
|
||||
"salt":"d15e43fa3709d85ce3c74644?challenge_id=01931621-1456-7b5b-be65-c044e6b47cbb&expires=1731243386",
|
||||
"algorithm":"SHA-256",
|
||||
"challenge":"5dc6b352632912664583940e14b9dfbdf447459d4517708ce8766a39ac040eb5",
|
||||
"maxnumber":50000,
|
||||
"signature":"22c3a687dc2500cbffcb022ae8474360d5c2f63a50ba376325c211bb2ca06b7f"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -52,4 +82,4 @@ A challenge solution is valid for 5 minutes (configurable) after the challenge i
|
|||
If challenges are enabled, the following routes will require a challenge to be solved before the request can be made:
|
||||
- `POST /api/v1/accounts`
|
||||
|
||||
Which routes require challenges may eventually be expanded or made configurable.
|
||||
Routes requiring challenges may eventually be expanded or made configurable.
|
||||
Loading…
Add table
Add a link
Reference in a new issue