aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/fold.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 20:11:05 +0000
committertv <tv@krebsco.de>2026-11-19 21:27:21 +0100
commit9bf334bedbc4b0cc3ce32fcd3baef27d3072f194 (patch)
tree6236db6799c2523ccdb899e6a42cc2153ce4eb08 /src/federation/fold.rs
parentfc6c7101cdb42666c1f79df4206029c7cf7e61c6 (diff)
federated nodes: a party's keys log in as the party, for federation work
A party's people work with the federation by signing as the party, with a key of its set; what they need of a node is to read and to put events, which a node's users, its operators, may do with every power besides. POST /auth/login/party takes a challenge (POST /auth/challenge) signed with one of the keys that sign for the party (fold::State::signing_keys: those its current version names, and its key set as it counts), for the namespace continuum-login, armored or as the federation spells a signature (keys::signer, keys::verifies_in: the federation's checks, but for the namespace), and answers a token as the party. Logins by key are counted per party as per user (challenge::take_with, shared with logging in by a registry's keys). The token names the key (Claims::party). Such a session does federation work alone (api::access::federated): what --store-readers do, and POST /events; anything else is 403. Every request checks that the key still signs for the party: once a version or the party's key set drops it, 401. A build from before reads no token naming a key, as its claims deny fields they don't know, so never takes a party's session for a user's; and only the node that issued it takes it, as every token in a federated swarm.
Diffstat (limited to 'src/federation/fold.rs')
-rw-r--r--src/federation/fold.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/federation/fold.rs b/src/federation/fold.rs
index 46dad27..dbe8d4f 100644
--- a/src/federation/fold.rs
+++ b/src/federation/fold.rs
@@ -221,6 +221,22 @@ impl State {
self.latest(&candidates)
}
+ /// The keys that sign for `party` by `current`, whatever they sign: those its version
+ /// names, and those of its key set as it counts; none where it is no party of it.
+ pub(crate) fn signing_keys(&self, party: &str, current: &Version) -> Vec<String> {
+ let mut keys = current
+ .parties
+ .get(party)
+ .map(|given| given.keys.clone())
+ .unwrap_or_default();
+ for key in self.keys_of(party, current) {
+ if !keys.contains(&key) {
+ keys.push(key);
+ }
+ }
+ keys
+ }
+
/// The keys of `party` by `current`: those of its key set, or those its version names.
pub(crate) fn keys_of(&self, party: &str, current: &Version) -> Vec<String> {
let Some(given) = current.parties.get(party) else {