Skip to main content

weirdnet_collab/
lib.rs

1//! Collaboration control for Weirdnet apps.
2//!
3//! A [`Project`] holds who is in it ([`Member`] with a [`RoleId`]), signed allow and deny
4//! [`Rule`]s for a person or a role, owner [`ConsentGrant`]s, [`Invite`]s and a signed
5//! [`AuditLog`]. [`Project::decide`] answers "may this person do this?" with an
6//! [`Explained`] decision: the answer and the chain of steps that led to it, built by running
7//! the rules themselves, so the same inputs give the same chain.
8//!
9//! The evaluation order is fixed:
10//!
11//! 1. Identity and membership: a banned identity or a non-member is denied, and a closed
12//!    session denies everything except managing it.
13//! 2. A rule for the person, then a rule for their role. Within one level a deny beats an
14//!    allow, and expired rules are ignored (and shown in the chain).
15//! 3. The role's default.
16//! 4. Extra gates the host cannot grant or waive: the audio owner's consent
17//!    ([`Gate::OwnerConsent`]), or a switch only the person's device can check
18//!    ([`Gate::Local`]).
19//! 5. Default deny.
20//!
21//! Permissions stop at the project: there is no narrower level. Only owner consent looks at a
22//! single stream. The crate is app-neutral: the app supplies the [`RoleTable`] (roles, their
23//! permissions, who may invite as which role, which permissions are gated); weirdnet-songnotes
24//! is one such app layer.
25//!
26//! Every record is signed over a fixed binary layout by the person who made it, and a record
27//! from another node is checked before it is kept (`accept_*`). An identity is a
28//! [`weirdnet_contacts::UserId`].
29#![forbid(unsafe_code)]
30
31pub mod audit;
32pub mod chat;
33pub mod decision;
34mod enc;
35pub mod handover;
36pub mod ids;
37pub mod invite;
38pub mod project;
39pub mod records;
40pub mod roles;
41
42pub use audit::{AuditDeletion, AuditEntry, AuditKind, AuditLog};
43pub use chat::{ChatError, ChatItem, ChatLog, ChatMessage, ChatPerms};
44pub use decision::{Decision, Explained, Step};
45pub use handover::{Handover, HandoverKind};
46pub use ids::{Permission, ProjectId, RecordId, RoleId, StreamId};
47pub use invite::{Approval, Invite, InviteError, InviteSpec, InviteState, JoinRequest, Redeemed};
48pub use project::{Ctx, Error, INVITE, MANAGE, Member, Project};
49pub use records::{ConsentGrant, Duration, Effect, GrantStreams, Revocation, Rule, SignError, Subject};
50pub use roles::{Gate, RoleSpec, RoleTable};