-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,20 @@ | ||
# Server-Client API | ||
# Start | ||
|
||
### Authorization | ||
The following pages document the server-client API of polyproto. Each file represents a group of | ||
routes, organizing them by their purpose. | ||
|
||
**Bearer token**, unless specified otherwise. | ||
The core of the protocol lies in the [federation](federation.md) routes, which are used to | ||
negotiate and establish connections between foreign servers and clients. | ||
|
||
### Server | ||
|
||
`http://localhost:3001/api` | ||
Theoretically, the polyproto-core federation protocol can be used with a different set of chat-APIs | ||
However, a full implementation of the protocol requires the use of the | ||
[polyproto-chat](chat/index.md) routes. There is no interoperability if different chat-APIs/protocols | ||
are used. | ||
|
||
--- | ||
|
||
## Federation tokens | ||
|
||
Routes concerning the creation, deletion and management of federation tokens. | ||
|
||
### <p class="request-h"><span class="request request-get">GET</span> Generate Federation Token</p> | ||
|
||
`http://localhost:3001/api/federation/token` | ||
|
||
Ask your home server to generate a federation token for you. You can use this token to authenticate on another server. | ||
|
||
The token is signed using the home server's public signing key, so that other servers can verify its authenticity. | ||
|
||
#### Body | ||
--8<-- "snippets/api.md" | ||
|
||
```json | ||
{ | ||
"server": "https://server.example.com" | ||
} | ||
``` | ||
|
||
#### Response | ||
|
||
=== "200 OK" | ||
|
||
##### Body | ||
|
||
```json | ||
"exampletoken" | ||
``` | ||
|
||
=== "404 Not Found" | ||
|
||
##### Body | ||
--- | ||
|
||
```json | ||
{ | ||
"errcode": "PR_NOT_FEDERATED", | ||
"error": "The server you are trying to generate a token for does not federate with this server. Either this server does not have federation enabled or at least one of the servers has denied federation with the other. Check with a server administrator for more information." | ||
} | ||
``` | ||
--8<-- "snippets/glossary.md" |