pub struct Group {
pub id: String,
pub name: String,
pub key: String,
pub members: Vec<GroupMember>,
pub created_at: u64,
}Expand description
A room as known on this device. There is no authoritative server roster; every member holds a signed copy of this state.
Fields§
§id: StringRoom id, 16 bytes as lowercase hex.
name: StringRoom name shown in the UI.
key: StringShared room key as lowercase hex. Anyone holding it can read and post.
members: Vec<GroupMember>Local copy of the member list, including this identity.
created_at: u64Unix milliseconds when the room was created.
Implementations§
Source§impl Group
impl Group
Sourcepub fn create(
name: &str,
members: Vec<GroupMember>,
own: GroupMember,
) -> Result<Self>
pub fn create( name: &str, members: Vec<GroupMember>, own: GroupMember, ) -> Result<Self>
Create a local room including own and at least one peer.
Sourcepub fn conversation_id(&self) -> String
pub fn conversation_id(&self) -> String
Conversation id used for this room in history: group:<room id>.
Sourcepub fn member(&self, pubkey: &str) -> Option<&GroupMember>
pub fn member(&self, pubkey: &str) -> Option<&GroupMember>
Look up a member by public key.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Check the whole room state: id and key sizes, name bounds, member count, and duplicate member keys.
Sourcepub fn invite(&self, inviter: &ChatIdentity) -> Result<String>
pub fn invite(&self, inviter: &ChatIdentity) -> Result<String>
Produce the signed invite that hands the room key to the other members.
Sourcepub fn from_invite(json: &str, own_pubkey: &str) -> Result<Self>
pub fn from_invite(json: &str, own_pubkey: &str) -> Result<Self>
Join a room from a signed invite. Fails unless this identity’s public key is in the invited member list and the signature verifies.