feat(federation): keys, invites and pairing between Sonda servers
Two servers can become friends. Federation is off by default; turning it
on makes an Ed25519 key pair, kept in the database and never returned.
- Admin routes: GET and PUT /federation (on or off, name, public address),
POST /federation/invites, POST /federation/friends (use an invite),
POST /federation/friends/{id}/approve and DELETE /federation/friends/{id}.
- POST /api/v1/peer/pair, the one route without a login: the code of an
invite is the proof. An invite works once and expires in 24 hours; only
a hash of its code is stored. At most 10 attempts a minute.
- The server that uses an invite checks that the key it gets back is the
one named in the invite. A friend is kept as incoming or outgoing until
both admins have agreed.
- https only, except plain http on a network of one's own (private,
loopback or link-local address, or a local name).
- A client of its own for friends, with no redirects, no proxy from the
environment, a size limit and a time limit; the providers' client stays
as it is.
- Migration 0023 for SQLite and PostgreSQL, OpenAPI paths and schemas,
contract test with two real servers.
- Admin > Federation in the web app, in English and Italian, and a
section in the README.
This commit is contained in:
parent
822f6094e5
commit
695a012f6c
1 changed files with 3987 additions and 20 deletions
|
|
@ -22,6 +22,7 @@ import (
|
|||
"codeberg.org/squidd/sonda/internal/discover"
|
||||
"codeberg.org/squidd/sonda/internal/discovery"
|
||||
"codeberg.org/squidd/sonda/internal/duplicates"
|
||||
"codeberg.org/squidd/sonda/internal/federation"
|
||||
"codeberg.org/squidd/sonda/internal/feedback"
|
||||
"codeberg.org/squidd/sonda/internal/images"
|
||||
"codeberg.org/squidd/sonda/internal/jobs"
|
||||
|
|
@ -315,6 +316,7 @@ func run() error {
|
|||
About: descriptions,
|
||||
Settings: userSettings,
|
||||
Streams: streaming.NewService(libraryRepo),
|
||||
Federation: federation.NewService(storage.NewFederationRepo(db), federation.NewClient()),
|
||||
Web: webui.FS(),
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue