weirdnet-songnotes 0.11.0

SongNotes collaboration: the roles, permissions, links and consent requests for a SongNotes session, built on weirdnet-collab.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Standalone host mode: share a link, let someone in, ask what they may do.
use weirdnet_songnotes::{JoinLink, Keypair, Session, UserId, perm};

fn main() {
    let mut session = Session::standalone("demo", Keypair::generate_ed25519(), 0).expect("session");
    let link = session.quick_link(1).expect("link");
    println!("share: {link}");

    let guest = Keypair::generate_ed25519();
    let guest_id = UserId::of_keypair(&guest);
    let parsed: JoinLink = link.to_string().parse().expect("parse");
    println!("join: {:?}", session.join(&parsed, &guest_id, 2).expect("join"));
    session.approve(&guest_id, 3).expect("approve");
    for p in [perm::RECORDING_LISTEN, perm::PROJECT_EDIT] {
        println!("{p}: {:?}", session.explain(&guest_id, p, 4).decision);
    }
}