|
3 | 3 | //! Authentication keys are used to authenticate HTTP tracker `announce` and |
4 | 4 | //! `scrape` requests. |
5 | 5 | //! |
6 | | -//! When the tracker is running in `private` or `private_listed` mode, the |
7 | | -//! authentication keys are required to announce and scrape torrents. |
| 6 | +//! When the tracker is running in `private` mode, the authentication keys are |
| 7 | +//! required to announce and scrape torrents. |
8 | 8 | //! |
9 | 9 | //! A sample `announce` request **without** authentication key: |
10 | 10 | //! |
|
22 | 22 | //! |
23 | 23 | //! # Generate a new authentication key |
24 | 24 | //! |
25 | | -//! `POST /key/:seconds_valid` |
| 25 | +//! `POST /keys` |
26 | 26 | //! |
27 | | -//! It generates a new authentication key. |
| 27 | +//! It generates a new authentication key or upload a pre-generated key. |
28 | 28 | //! |
29 | 29 | //! > **NOTICE**: keys expire after a certain amount of time. |
30 | 30 | //! |
31 | | -//! **Path parameters** |
| 31 | +//! **POST parameters** |
32 | 32 | //! |
33 | 33 | //! Name | Type | Description | Required | Example |
34 | 34 | //! ---|---|---|---|--- |
| 35 | +//! `key` | 32-char string (0-9, a-z, A-Z) | The optional pre-generated key. | No | `Xc1L4PbQJSFGlrgSRZl8wxSFAuMa21z7` |
35 | 36 | //! `seconds_valid` | positive integer | The number of seconds the key will be valid. | Yes | `3600` |
36 | 37 | //! |
| 38 | +//! > **NOTICE**: the `key` field is optional. If is not provided the tracker |
| 39 | +//! > will generated a random one. |
| 40 | +//! |
37 | 41 | //! **Example request** |
38 | 42 | //! |
39 | 43 | //! ```bash |
40 | | -//! curl -X POST "http://127.0.0.1:1212/api/v1/key/120?token=MyAccessToken" |
| 44 | +//! curl -X POST http://localhost:1212/api/v1/keys?token=MyAccessToken \ |
| 45 | +//! -H "Content-Type: application/json" \ |
| 46 | +//! -d '{ |
| 47 | +//! "key": "xqD6NWH9TcKrOCwDmqcdH5hF5RrbL0A6", |
| 48 | +//! "seconds_valid": 7200 |
| 49 | +//! }' |
41 | 50 | //! ``` |
42 | 51 | //! |
43 | 52 | //! **Example response** `200` |
|
0 commit comments