Skip to main content

co_primitives/types/
invite.rs

1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (C) 2026 1io BRANDGUARDIAN GmbH
3
4use crate::{Did, IsDefault, Network};
5use serde::{Deserialize, Serialize};
6use std::collections::BTreeSet;
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct CoInviteMetadata {
10	/// Invite message ID.
11	pub id: String,
12
13	/// Invite remote sender.
14	pub from: Did,
15
16	/// Invite remote peer.
17	#[serde(with = "serde_bytes")]
18	pub peer: Option<Vec<u8>>,
19
20	/// CO Connectivity
21	#[serde(default, skip_serializing_if = "IsDefault::is_default")]
22	pub network: CoConnectivity,
23}
24
25#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
26pub struct CoConnectivity {
27	/// Networks to connect to.
28	/// Maybe empty.
29	#[serde(rename = "n", default, skip_serializing_if = "BTreeSet::is_empty")]
30	pub network: BTreeSet<Network>,
31
32	/// Participants to connect to.
33	/// Maybe empty.
34	/// Network should be preferred.
35	#[serde(rename = "p", default, skip_serializing_if = "BTreeSet::is_empty")]
36	pub participants: BTreeSet<Did>,
37}