weirdnet-collab 0.3.0

Collaboration control for Weirdnet apps: project members and roles, signed allow and deny rules, owner consent grants, a decision with a reason chain, invites and a signed, mergeable audit log. App-agnostic: the app defines what a project, role and permission are.
Documentation
//! Collaboration control for Weirdnet apps.
//!
//! A [`Project`] holds who is in it ([`Member`] with a [`RoleId`]), signed allow and deny
//! [`Rule`]s for a person or a role, owner [`ConsentGrant`]s, [`Invite`]s and a signed
//! [`AuditLog`]. [`Project::decide`] answers "may this person do this?" with an
//! [`Explained`] decision: the answer and the chain of steps that led to it, built by running
//! the rules themselves, so the same inputs give the same chain.
//!
//! The evaluation order is fixed:
//!
//! 1. Identity and membership: a banned identity or a non-member is denied, and a closed
//!    session denies everything except managing it.
//! 2. A rule for the person, then a rule for their role. Within one level a deny beats an
//!    allow, and expired rules are ignored (and shown in the chain).
//! 3. The role's default.
//! 4. Extra gates the host cannot grant or waive: the audio owner's consent
//!    ([`Gate::OwnerConsent`]), or a switch only the person's device can check
//!    ([`Gate::Local`]).
//! 5. Default deny.
//!
//! Permissions stop at the project: there is no narrower level. Only owner consent looks at a
//! single stream. The crate is app-neutral: the app supplies the [`RoleTable`] (roles, their
//! permissions, who may invite as which role, which permissions are gated); weirdnet-songnotes
//! is one such app layer.
//!
//! Every record is signed over a fixed binary layout by the person who made it, and a record
//! from another node is checked before it is kept (`accept_*`). An identity is a
//! [`weirdnet_contacts::UserId`].
#![forbid(unsafe_code)]

pub mod audit;
pub mod chat;
pub mod decision;
mod enc;
pub mod handover;
pub mod ids;
pub mod invite;
pub mod project;
pub mod records;
pub mod roles;

pub use audit::{AuditDeletion, AuditEntry, AuditKind, AuditLog};
pub use chat::{ChatError, ChatItem, ChatLog, ChatMessage, ChatPerms};
pub use decision::{Decision, Explained, Step};
pub use handover::{Handover, HandoverKind};
pub use ids::{Permission, ProjectId, RecordId, RoleId, StreamId};
pub use invite::{Approval, Invite, InviteError, InviteSpec, InviteState, JoinRequest, Redeemed};
pub use project::{Ctx, Error, INVITE, MANAGE, Member, Project};
pub use records::{ConsentGrant, Duration, Effect, GrantStreams, Revocation, Rule, SignError, Subject};
pub use roles::{Gate, RoleSpec, RoleTable};