remove(types)!: remove members from CreateGroup

Now a group can only be created with the creator as the only initial
member. This forbids group creator from adding other members without
their consent. Additional members can join the group later at their own
will.
This commit is contained in:
oxalica 2024-09-16 06:19:53 -04:00
parent 93d779b615
commit 985ea1d68a
5 changed files with 27 additions and 75 deletions

View file

@ -4,8 +4,8 @@ use std::{fs, io};
use anyhow::{Context, Result};
use blah_types::{
bitflags, get_timestamp, ChatPayload, CreateGroup, CreateRoomPayload, Id, MemberPermission,
RichText, RoomAttrs, RoomMember, RoomMemberList, ServerPermission, Signed, UserKey,
bitflags, get_timestamp, ChatPayload, CreateGroup, CreateRoomPayload, Id, RichText, RoomAttrs,
ServerPermission, Signed, UserKey,
};
use ed25519_dalek::pkcs8::spki::der::pem::LineEnding;
use ed25519_dalek::pkcs8::{DecodePrivateKey, DecodePublicKey, EncodePrivateKey, EncodePublicKey};
@ -220,12 +220,6 @@ async fn main_api(api_url: Url, command: ApiCommand) -> Result<()> {
let payload = CreateRoomPayload::Group(CreateGroup {
attrs: attrs.unwrap_or_default(),
title,
// The CLI does not support passing multiple members because `User` itself is a
// disjoint arg-group.
members: RoomMemberList(vec![RoomMember {
permission: MemberPermission::ALL,
user: UserKey(key.verifying_key().to_bytes()),
}]),
});
let payload = Signed::sign(&key, get_timestamp(), &mut OsRng, payload)?;