diff --git a/crates/xmtp_proto/proto_version b/crates/xmtp_proto/proto_version index 50fff82353..36b35658da 100644 --- a/crates/xmtp_proto/proto_version +++ b/crates/xmtp_proto/proto_version @@ -1 +1 @@ -845ad62c2285c531dcd775a769ebb0e7fe611eea +602f7056ab3092a43cd35dba8feca3e724f45332 diff --git a/crates/xmtp_proto/src/gen/proto_descriptor.bin b/crates/xmtp_proto/src/gen/proto_descriptor.bin index 48ee48c56a..14dcfe2091 100644 Binary files a/crates/xmtp_proto/src/gen/proto_descriptor.bin and b/crates/xmtp_proto/src/gen/proto_descriptor.bin differ diff --git a/crates/xmtp_proto/src/gen/xmtp.message_contents.rs b/crates/xmtp_proto/src/gen/xmtp.message_contents.rs index 5e4f142c79..4776c9cf99 100644 --- a/crates/xmtp_proto/src/gen/xmtp.message_contents.rs +++ b/crates/xmtp_proto/src/gen/xmtp.message_contents.rs @@ -69,6 +69,106 @@ impl ::prost::Name for Signature { "/xmtp.message_contents.Signature".into() } } +/// Ciphertext represents encrypted payload. +/// It is definited as a union to support cryptographic algorithm agility. +/// The payload is accompanied by the cryptographic parameters +/// required by the chosen encryption scheme. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Ciphertext { + #[prost(oneof = "ciphertext::Union", tags = "1")] + pub union: ::core::option::Option, +} +/// Nested message and enum types in `Ciphertext`. +pub mod ciphertext { + /// Encryption: AES256-GCM + /// Key derivation function: HKDF-SHA256 + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] + pub struct Aes256gcmHkdfsha256 { + /// 32 bytes + #[prost(bytes = "vec", tag = "1")] + pub hkdf_salt: ::prost::alloc::vec::Vec, + /// 12 bytes + #[prost(bytes = "vec", tag = "2")] + pub gcm_nonce: ::prost::alloc::vec::Vec, + /// encrypted payload + #[prost(bytes = "vec", tag = "3")] + pub payload: ::prost::alloc::vec::Vec, + } + impl ::prost::Name for Aes256gcmHkdfsha256 { + const NAME: &'static str = "Aes256gcmHkdfsha256"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.Ciphertext.Aes256gcmHkdfsha256".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.Ciphertext.Aes256gcmHkdfsha256".into() + } + } + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Union { + #[prost(message, tag = "1")] + Aes256GcmHkdfSha256(Aes256gcmHkdfsha256), + } +} +impl ::prost::Name for Ciphertext { + const NAME: &'static str = "Ciphertext"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.Ciphertext".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.Ciphertext".into() + } +} +/// SignedEciesCiphertext represents an ECIES encrypted payload and a signature +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SignedEciesCiphertext { + /// serialized Ecies message + #[prost(bytes = "vec", tag = "1")] + pub ecies_bytes: ::prost::alloc::vec::Vec, + /// signature of sha256(ecies_bytes) signed with the IdentityKey + #[prost(message, optional, tag = "2")] + pub signature: ::core::option::Option, +} +/// Nested message and enum types in `SignedEciesCiphertext`. +pub mod signed_ecies_ciphertext { + /// Ecies is ciphertext encrypted using ECIES with a MAC + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] + pub struct Ecies { + /// 65 bytes + #[prost(bytes = "vec", tag = "1")] + pub ephemeral_public_key: ::prost::alloc::vec::Vec, + /// 16 bytes + #[prost(bytes = "vec", tag = "2")] + pub iv: ::prost::alloc::vec::Vec, + /// 32 bytes + #[prost(bytes = "vec", tag = "3")] + pub mac: ::prost::alloc::vec::Vec, + /// encrypted payload with block size of 16 + #[prost(bytes = "vec", tag = "4")] + pub ciphertext: ::prost::alloc::vec::Vec, + } + impl ::prost::Name for Ecies { + const NAME: &'static str = "Ecies"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.SignedEciesCiphertext.Ecies".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.SignedEciesCiphertext.Ecies".into() + } + } +} +impl ::prost::Name for SignedEciesCiphertext { + const NAME: &'static str = "SignedEciesCiphertext"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.SignedEciesCiphertext".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.SignedEciesCiphertext".into() + } +} /// UnsignedPublicKey represents a generalized public key, /// defined as a union to support cryptographic algorithm agility. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] @@ -220,106 +320,6 @@ impl ::prost::Name for PublicKeyBundle { "/xmtp.message_contents.PublicKeyBundle".into() } } -/// Ciphertext represents encrypted payload. -/// It is definited as a union to support cryptographic algorithm agility. -/// The payload is accompanied by the cryptographic parameters -/// required by the chosen encryption scheme. -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct Ciphertext { - #[prost(oneof = "ciphertext::Union", tags = "1")] - pub union: ::core::option::Option, -} -/// Nested message and enum types in `Ciphertext`. -pub mod ciphertext { - /// Encryption: AES256-GCM - /// Key derivation function: HKDF-SHA256 - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] - pub struct Aes256gcmHkdfsha256 { - /// 32 bytes - #[prost(bytes = "vec", tag = "1")] - pub hkdf_salt: ::prost::alloc::vec::Vec, - /// 12 bytes - #[prost(bytes = "vec", tag = "2")] - pub gcm_nonce: ::prost::alloc::vec::Vec, - /// encrypted payload - #[prost(bytes = "vec", tag = "3")] - pub payload: ::prost::alloc::vec::Vec, - } - impl ::prost::Name for Aes256gcmHkdfsha256 { - const NAME: &'static str = "Aes256gcmHkdfsha256"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.Ciphertext.Aes256gcmHkdfsha256".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.Ciphertext.Aes256gcmHkdfsha256".into() - } - } - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum Union { - #[prost(message, tag = "1")] - Aes256GcmHkdfSha256(Aes256gcmHkdfsha256), - } -} -impl ::prost::Name for Ciphertext { - const NAME: &'static str = "Ciphertext"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.Ciphertext".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.Ciphertext".into() - } -} -/// SignedEciesCiphertext represents an ECIES encrypted payload and a signature -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct SignedEciesCiphertext { - /// serialized Ecies message - #[prost(bytes = "vec", tag = "1")] - pub ecies_bytes: ::prost::alloc::vec::Vec, - /// signature of sha256(ecies_bytes) signed with the IdentityKey - #[prost(message, optional, tag = "2")] - pub signature: ::core::option::Option, -} -/// Nested message and enum types in `SignedEciesCiphertext`. -pub mod signed_ecies_ciphertext { - /// Ecies is ciphertext encrypted using ECIES with a MAC - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] - pub struct Ecies { - /// 65 bytes - #[prost(bytes = "vec", tag = "1")] - pub ephemeral_public_key: ::prost::alloc::vec::Vec, - /// 16 bytes - #[prost(bytes = "vec", tag = "2")] - pub iv: ::prost::alloc::vec::Vec, - /// 32 bytes - #[prost(bytes = "vec", tag = "3")] - pub mac: ::prost::alloc::vec::Vec, - /// encrypted payload with block size of 16 - #[prost(bytes = "vec", tag = "4")] - pub ciphertext: ::prost::alloc::vec::Vec, - } - impl ::prost::Name for Ecies { - const NAME: &'static str = "Ecies"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.SignedEciesCiphertext.Ecies".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.SignedEciesCiphertext.Ecies".into() - } - } -} -impl ::prost::Name for SignedEciesCiphertext { - const NAME: &'static str = "SignedEciesCiphertext"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.SignedEciesCiphertext".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.SignedEciesCiphertext".into() - } -} /// Unsealed invitation V1 #[derive(Clone, PartialEq, ::prost::Message)] pub struct InvitationV1 { @@ -922,85 +922,198 @@ impl ::prost::Name for PrivatePreferencesPayload { "/xmtp.message_contents.PrivatePreferencesPayload".into() } } -/// The message that will be signed by the Client and returned inside the -/// `action_body` field of the FrameAction message +/// SignedPayload is a wrapper for a signature and a payload #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct FrameActionBody { - /// The URL of the frame that was clicked - /// May be different from `post_url` - #[prost(string, tag = "1")] - pub frame_url: ::prost::alloc::string::String, - /// The 1-indexed button that was clicked - #[prost(int32, tag = "2")] - pub button_index: i32, - /// Timestamp of the click in milliseconds since the epoch - #[deprecated] - #[prost(uint64, tag = "3")] - pub timestamp: u64, - /// A unique identifier for the conversation, not tied to anything on the - /// network. Will not match the topic or conversation_id - #[prost(string, tag = "4")] - pub opaque_conversation_identifier: ::prost::alloc::string::String, - /// Unix timestamp - #[prost(uint32, tag = "5")] - pub unix_timestamp: u32, - /// Input text from a text input field - #[prost(string, tag = "6")] - pub input_text: ::prost::alloc::string::String, - /// A state serialized to a string (for example via JSON.stringify()). Maximum 4096 bytes. - #[prost(string, tag = "7")] - pub state: ::prost::alloc::string::String, - /// A 0x wallet address - #[prost(string, tag = "8")] - pub address: ::prost::alloc::string::String, - /// A hash from a transaction - #[prost(string, tag = "9")] - pub transaction_id: ::prost::alloc::string::String, +pub struct SignedPayload { + #[prost(bytes = "vec", tag = "1")] + pub payload: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub signature: ::core::option::Option, } -impl ::prost::Name for FrameActionBody { - const NAME: &'static str = "FrameActionBody"; +impl ::prost::Name for SignedPayload { + const NAME: &'static str = "SignedPayload"; const PACKAGE: &'static str = "xmtp.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.FrameActionBody".into() + "xmtp.message_contents.SignedPayload".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.FrameActionBody".into() + "/xmtp.message_contents.SignedPayload".into() } } -/// The outer payload that will be sent as the `messageBytes` in the -/// `trusted_data` part of the Frames message +/// EciesMessage is a wrapper for ECIES encrypted payloads #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct FrameAction { - #[deprecated] - #[prost(message, optional, tag = "1")] - pub signature: ::core::option::Option, - /// The SignedPublicKeyBundle of the signer, used to link the XMTP signature - /// with a blockchain account through a chain of signatures. - #[deprecated] +pub struct EciesMessage { + #[prost(oneof = "ecies_message::Version", tags = "1")] + pub version: ::core::option::Option, +} +/// Nested message and enum types in `EciesMessage`. +pub mod ecies_message { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Version { + /// Expected to be an ECIES encrypted SignedPayload + #[prost(bytes, tag = "1")] + V1(::prost::alloc::vec::Vec), + } +} +impl ::prost::Name for EciesMessage { + const NAME: &'static str = "EciesMessage"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.EciesMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.EciesMessage".into() + } +} +/// Message header is encoded separately as the bytes are also used +/// as associated data for authenticated encryption +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MessageHeaderV1 { + #[prost(message, optional, tag = "1")] + pub sender: ::core::option::Option, #[prost(message, optional, tag = "2")] - pub signed_public_key_bundle: ::core::option::Option, - /// Serialized FrameActionBody message, so that the signature verification can - /// happen on a byte-perfect representation of the message - #[prost(bytes = "vec", tag = "3")] - pub action_body: ::prost::alloc::vec::Vec, - /// The installation signature - #[prost(bytes = "vec", tag = "4")] - pub installation_signature: ::prost::alloc::vec::Vec, - /// The public installation id used to sign. - #[prost(bytes = "vec", tag = "5")] - pub installation_id: ::prost::alloc::vec::Vec, - /// The inbox id of the installation used to sign. + pub recipient: ::core::option::Option, + #[prost(uint64, tag = "3")] + pub timestamp: u64, +} +impl ::prost::Name for MessageHeaderV1 { + const NAME: &'static str = "MessageHeaderV1"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.MessageHeaderV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.MessageHeaderV1".into() + } +} +/// Message is the top level protocol element +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MessageV1 { + /// encapsulates encoded MessageHeaderV1 + #[prost(bytes = "vec", tag = "1")] + pub header_bytes: ::prost::alloc::vec::Vec, + /// Ciphertext.payload MUST contain encrypted EncodedContent + #[prost(message, optional, tag = "2")] + pub ciphertext: ::core::option::Option, +} +impl ::prost::Name for MessageV1 { + const NAME: &'static str = "MessageV1"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.MessageV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.MessageV1".into() + } +} +/// Message header carries information that is not encrypted, and is therefore +/// observable by the network. It is however authenticated as associated data +/// of the AEAD encryption used to protect the message, +/// thus providing tamper evidence. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MessageHeaderV2 { + /// sender specified message creation time + #[prost(uint64, tag = "1")] + pub created_ns: u64, + /// the topic the message belongs to + #[prost(string, tag = "2")] + pub topic: ::prost::alloc::string::String, +} +impl ::prost::Name for MessageHeaderV2 { + const NAME: &'static str = "MessageHeaderV2"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.MessageHeaderV2".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.MessageHeaderV2".into() + } +} +/// Message combines the encoded header with the encrypted payload. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MessageV2 { + /// encapsulates encoded MessageHeaderV2 + #[prost(bytes = "vec", tag = "1")] + pub header_bytes: ::prost::alloc::vec::Vec, + /// Ciphertext.payload MUST contain encrypted SignedContent + #[prost(message, optional, tag = "2")] + pub ciphertext: ::core::option::Option, + /// HMAC of the message ciphertext, with the HMAC key derived from the topic + /// key + #[prost(bytes = "vec", optional, tag = "3")] + pub sender_hmac: ::core::option::Option<::prost::alloc::vec::Vec>, + /// Flag indicating whether the message should be pushed from a notification + /// server + #[prost(bool, optional, tag = "4")] + pub should_push: ::core::option::Option, +} +impl ::prost::Name for MessageV2 { + const NAME: &'static str = "MessageV2"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.MessageV2".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.MessageV2".into() + } +} +/// Versioned Message +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Message { + #[prost(oneof = "message::Version", tags = "1, 2")] + pub version: ::core::option::Option, +} +/// Nested message and enum types in `Message`. +pub mod message { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Version { + #[prost(message, tag = "1")] + V1(super::MessageV1), + #[prost(message, tag = "2")] + V2(super::MessageV2), + } +} +impl ::prost::Name for Message { + const NAME: &'static str = "Message"; + const PACKAGE: &'static str = "xmtp.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.message_contents.Message".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.message_contents.Message".into() + } +} +/// DecodedMessage represents the decrypted message contents. +/// DecodedMessage instances are not stored on the network, but +/// may be serialized and stored by clients +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DecodedMessage { + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub message_version: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub sender_address: ::prost::alloc::string::String, + #[prost(string, optional, tag = "4")] + pub recipient_address: ::core::option::Option<::prost::alloc::string::String>, + #[prost(uint64, tag = "5")] + pub sent_ns: u64, #[prost(string, tag = "6")] - pub inbox_id: ::prost::alloc::string::String, + pub content_topic: ::prost::alloc::string::String, + #[prost(message, optional, tag = "7")] + pub conversation: ::core::option::Option, + /// encapsulates EncodedContent + #[prost(bytes = "vec", tag = "8")] + pub content_bytes: ::prost::alloc::vec::Vec, } -impl ::prost::Name for FrameAction { - const NAME: &'static str = "FrameAction"; +impl ::prost::Name for DecodedMessage { + const NAME: &'static str = "DecodedMessage"; const PACKAGE: &'static str = "xmtp.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.FrameAction".into() + "xmtp.message_contents.DecodedMessage".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.FrameAction".into() + "/xmtp.message_contents.DecodedMessage".into() } } /// ContentTypeId is used to identify the type of content stored in a Message. @@ -1117,83 +1230,6 @@ impl Compression { } } } -/// LEGACY: User key bundle V1 using PublicKeys. -/// The PublicKeys MUST be signed. -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct ContactBundleV1 { - #[prost(message, optional, tag = "1")] - pub key_bundle: ::core::option::Option, -} -impl ::prost::Name for ContactBundleV1 { - const NAME: &'static str = "ContactBundleV1"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.ContactBundleV1".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.ContactBundleV1".into() - } -} -/// User key bundle V2 using SignedPublicKeys. -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct ContactBundleV2 { - #[prost(message, optional, tag = "1")] - pub key_bundle: ::core::option::Option, -} -impl ::prost::Name for ContactBundleV2 { - const NAME: &'static str = "ContactBundleV2"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.ContactBundleV2".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.ContactBundleV2".into() - } -} -/// Versioned ContactBundle -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct ContactBundle { - #[prost(oneof = "contact_bundle::Version", tags = "1, 2")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `ContactBundle`. -pub mod contact_bundle { - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum Version { - #[prost(message, tag = "1")] - V1(super::ContactBundleV1), - #[prost(message, tag = "2")] - V2(super::ContactBundleV2), - } -} -impl ::prost::Name for ContactBundle { - const NAME: &'static str = "ContactBundle"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.ContactBundle".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.ContactBundle".into() - } -} -/// SignedPayload is a wrapper for a signature and a payload -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct SignedPayload { - #[prost(bytes = "vec", tag = "1")] - pub payload: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub signature: ::core::option::Option, -} -impl ::prost::Name for SignedPayload { - const NAME: &'static str = "SignedPayload"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.SignedPayload".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.SignedPayload".into() - } -} /// Composite is used to implement xmtp.org/composite content type #[derive(Clone, PartialEq, ::prost::Message)] pub struct Composite { @@ -1239,179 +1275,143 @@ impl ::prost::Name for Composite { "/xmtp.message_contents.Composite".into() } } -/// Message header is encoded separately as the bytes are also used -/// as associated data for authenticated encryption +/// LEGACY: User key bundle V1 using PublicKeys. +/// The PublicKeys MUST be signed. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct MessageHeaderV1 { +pub struct ContactBundleV1 { #[prost(message, optional, tag = "1")] - pub sender: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub recipient: ::core::option::Option, - #[prost(uint64, tag = "3")] - pub timestamp: u64, -} -impl ::prost::Name for MessageHeaderV1 { - const NAME: &'static str = "MessageHeaderV1"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.MessageHeaderV1".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.MessageHeaderV1".into() - } -} -/// Message is the top level protocol element -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct MessageV1 { - /// encapsulates encoded MessageHeaderV1 - #[prost(bytes = "vec", tag = "1")] - pub header_bytes: ::prost::alloc::vec::Vec, - /// Ciphertext.payload MUST contain encrypted EncodedContent - #[prost(message, optional, tag = "2")] - pub ciphertext: ::core::option::Option, -} -impl ::prost::Name for MessageV1 { - const NAME: &'static str = "MessageV1"; - const PACKAGE: &'static str = "xmtp.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.MessageV1".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.MessageV1".into() - } -} -/// Message header carries information that is not encrypted, and is therefore -/// observable by the network. It is however authenticated as associated data -/// of the AEAD encryption used to protect the message, -/// thus providing tamper evidence. -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct MessageHeaderV2 { - /// sender specified message creation time - #[prost(uint64, tag = "1")] - pub created_ns: u64, - /// the topic the message belongs to - #[prost(string, tag = "2")] - pub topic: ::prost::alloc::string::String, + pub key_bundle: ::core::option::Option, } -impl ::prost::Name for MessageHeaderV2 { - const NAME: &'static str = "MessageHeaderV2"; +impl ::prost::Name for ContactBundleV1 { + const NAME: &'static str = "ContactBundleV1"; const PACKAGE: &'static str = "xmtp.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.MessageHeaderV2".into() + "xmtp.message_contents.ContactBundleV1".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.MessageHeaderV2".into() + "/xmtp.message_contents.ContactBundleV1".into() } } -/// Message combines the encoded header with the encrypted payload. +/// User key bundle V2 using SignedPublicKeys. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct MessageV2 { - /// encapsulates encoded MessageHeaderV2 - #[prost(bytes = "vec", tag = "1")] - pub header_bytes: ::prost::alloc::vec::Vec, - /// Ciphertext.payload MUST contain encrypted SignedContent - #[prost(message, optional, tag = "2")] - pub ciphertext: ::core::option::Option, - /// HMAC of the message ciphertext, with the HMAC key derived from the topic - /// key - #[prost(bytes = "vec", optional, tag = "3")] - pub sender_hmac: ::core::option::Option<::prost::alloc::vec::Vec>, - /// Flag indicating whether the message should be pushed from a notification - /// server - #[prost(bool, optional, tag = "4")] - pub should_push: ::core::option::Option, +pub struct ContactBundleV2 { + #[prost(message, optional, tag = "1")] + pub key_bundle: ::core::option::Option, } -impl ::prost::Name for MessageV2 { - const NAME: &'static str = "MessageV2"; +impl ::prost::Name for ContactBundleV2 { + const NAME: &'static str = "ContactBundleV2"; const PACKAGE: &'static str = "xmtp.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.MessageV2".into() + "xmtp.message_contents.ContactBundleV2".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.MessageV2".into() + "/xmtp.message_contents.ContactBundleV2".into() } } -/// Versioned Message +/// Versioned ContactBundle #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct Message { - #[prost(oneof = "message::Version", tags = "1, 2")] - pub version: ::core::option::Option, +pub struct ContactBundle { + #[prost(oneof = "contact_bundle::Version", tags = "1, 2")] + pub version: ::core::option::Option, } -/// Nested message and enum types in `Message`. -pub mod message { +/// Nested message and enum types in `ContactBundle`. +pub mod contact_bundle { #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Version { #[prost(message, tag = "1")] - V1(super::MessageV1), + V1(super::ContactBundleV1), #[prost(message, tag = "2")] - V2(super::MessageV2), + V2(super::ContactBundleV2), } } -impl ::prost::Name for Message { - const NAME: &'static str = "Message"; +impl ::prost::Name for ContactBundle { + const NAME: &'static str = "ContactBundle"; const PACKAGE: &'static str = "xmtp.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.Message".into() + "xmtp.message_contents.ContactBundle".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.Message".into() + "/xmtp.message_contents.ContactBundle".into() } } -/// DecodedMessage represents the decrypted message contents. -/// DecodedMessage instances are not stored on the network, but -/// may be serialized and stored by clients -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DecodedMessage { +/// The message that will be signed by the Client and returned inside the +/// `action_body` field of the FrameAction message +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct FrameActionBody { + /// The URL of the frame that was clicked + /// May be different from `post_url` #[prost(string, tag = "1")] - pub id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub message_version: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub sender_address: ::prost::alloc::string::String, - #[prost(string, optional, tag = "4")] - pub recipient_address: ::core::option::Option<::prost::alloc::string::String>, - #[prost(uint64, tag = "5")] - pub sent_ns: u64, + pub frame_url: ::prost::alloc::string::String, + /// The 1-indexed button that was clicked + #[prost(int32, tag = "2")] + pub button_index: i32, + /// Timestamp of the click in milliseconds since the epoch + #[deprecated] + #[prost(uint64, tag = "3")] + pub timestamp: u64, + /// A unique identifier for the conversation, not tied to anything on the + /// network. Will not match the topic or conversation_id + #[prost(string, tag = "4")] + pub opaque_conversation_identifier: ::prost::alloc::string::String, + /// Unix timestamp + #[prost(uint32, tag = "5")] + pub unix_timestamp: u32, + /// Input text from a text input field #[prost(string, tag = "6")] - pub content_topic: ::prost::alloc::string::String, - #[prost(message, optional, tag = "7")] - pub conversation: ::core::option::Option, - /// encapsulates EncodedContent - #[prost(bytes = "vec", tag = "8")] - pub content_bytes: ::prost::alloc::vec::Vec, + pub input_text: ::prost::alloc::string::String, + /// A state serialized to a string (for example via JSON.stringify()). Maximum 4096 bytes. + #[prost(string, tag = "7")] + pub state: ::prost::alloc::string::String, + /// A 0x wallet address + #[prost(string, tag = "8")] + pub address: ::prost::alloc::string::String, + /// A hash from a transaction + #[prost(string, tag = "9")] + pub transaction_id: ::prost::alloc::string::String, } -impl ::prost::Name for DecodedMessage { - const NAME: &'static str = "DecodedMessage"; +impl ::prost::Name for FrameActionBody { + const NAME: &'static str = "FrameActionBody"; const PACKAGE: &'static str = "xmtp.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.DecodedMessage".into() + "xmtp.message_contents.FrameActionBody".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.DecodedMessage".into() + "/xmtp.message_contents.FrameActionBody".into() } } -/// EciesMessage is a wrapper for ECIES encrypted payloads +/// The outer payload that will be sent as the `messageBytes` in the +/// `trusted_data` part of the Frames message #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct EciesMessage { - #[prost(oneof = "ecies_message::Version", tags = "1")] - pub version: ::core::option::Option, -} -/// Nested message and enum types in `EciesMessage`. -pub mod ecies_message { - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum Version { - /// Expected to be an ECIES encrypted SignedPayload - #[prost(bytes, tag = "1")] - V1(::prost::alloc::vec::Vec), - } +pub struct FrameAction { + #[deprecated] + #[prost(message, optional, tag = "1")] + pub signature: ::core::option::Option, + /// The SignedPublicKeyBundle of the signer, used to link the XMTP signature + /// with a blockchain account through a chain of signatures. + #[deprecated] + #[prost(message, optional, tag = "2")] + pub signed_public_key_bundle: ::core::option::Option, + /// Serialized FrameActionBody message, so that the signature verification can + /// happen on a byte-perfect representation of the message + #[prost(bytes = "vec", tag = "3")] + pub action_body: ::prost::alloc::vec::Vec, + /// The installation signature + #[prost(bytes = "vec", tag = "4")] + pub installation_signature: ::prost::alloc::vec::Vec, + /// The public installation id used to sign. + #[prost(bytes = "vec", tag = "5")] + pub installation_id: ::prost::alloc::vec::Vec, + /// The inbox id of the installation used to sign. + #[prost(string, tag = "6")] + pub inbox_id: ::prost::alloc::string::String, } -impl ::prost::Name for EciesMessage { - const NAME: &'static str = "EciesMessage"; +impl ::prost::Name for FrameAction { + const NAME: &'static str = "FrameAction"; const PACKAGE: &'static str = "xmtp.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.message_contents.EciesMessage".into() + "xmtp.message_contents.FrameAction".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.message_contents.EciesMessage".into() + "/xmtp.message_contents.FrameAction".into() } } diff --git a/crates/xmtp_proto/src/gen/xmtp.mls.database.rs b/crates/xmtp_proto/src/gen/xmtp.mls.database.rs index f1efd395c3..578defb088 100644 --- a/crates/xmtp_proto/src/gen/xmtp.mls.database.rs +++ b/crates/xmtp_proto/src/gen/xmtp.mls.database.rs @@ -1,50 +1,4 @@ // This file is @generated by prost-build. -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct Task { - #[prost(oneof = "task::Task", tags = "1, 2")] - pub task: ::core::option::Option, -} -/// Nested message and enum types in `Task`. -pub mod task { - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum Task { - #[prost(message, tag = "1")] - ProcessWelcomePointer(super::super::message_contents::WelcomePointer), - #[prost(message, tag = "2")] - SendSyncArchive(super::SendSyncArchive), - } -} -impl ::prost::Name for Task { - const NAME: &'static str = "Task"; - const PACKAGE: &'static str = "xmtp.mls.database"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.database.Task".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.database.Task".into() - } -} -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct SendSyncArchive { - #[prost(message, optional, tag = "1")] - pub options: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - pub sync_group_id: ::prost::alloc::vec::Vec, - #[prost(string, optional, tag = "3")] - pub pin: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, tag = "4")] - pub server_url: ::prost::alloc::string::String, -} -impl ::prost::Name for SendSyncArchive { - const NAME: &'static str = "SendSyncArchive"; - const PACKAGE: &'static str = "xmtp.mls.database"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.database.SendSyncArchive".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.database.SendSyncArchive".into() - } -} /// The data required to publish a message #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct SendMessageData { @@ -754,3 +708,49 @@ impl PermissionPolicyOption { } } } +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Task { + #[prost(oneof = "task::Task", tags = "1, 2")] + pub task: ::core::option::Option, +} +/// Nested message and enum types in `Task`. +pub mod task { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Task { + #[prost(message, tag = "1")] + ProcessWelcomePointer(super::super::message_contents::WelcomePointer), + #[prost(message, tag = "2")] + SendSyncArchive(super::SendSyncArchive), + } +} +impl ::prost::Name for Task { + const NAME: &'static str = "Task"; + const PACKAGE: &'static str = "xmtp.mls.database"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.database.Task".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.database.Task".into() + } +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SendSyncArchive { + #[prost(message, optional, tag = "1")] + pub options: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub sync_group_id: ::prost::alloc::vec::Vec, + #[prost(string, optional, tag = "3")] + pub pin: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag = "4")] + pub server_url: ::prost::alloc::string::String, +} +impl ::prost::Name for SendSyncArchive { + const NAME: &'static str = "SendSyncArchive"; + const PACKAGE: &'static str = "xmtp.mls.database"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.database.SendSyncArchive".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.database.SendSyncArchive".into() + } +} diff --git a/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.content_types.rs b/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.content_types.rs index de3b0d73b7..6db127f3aa 100644 --- a/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.content_types.rs +++ b/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.content_types.rs @@ -1,112 +1,39 @@ // This file is @generated by prost-build. -/// Reaction message type +/// DeleteMessage message type #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct ReactionV2 { - /// The message ID being reacted to +pub struct DeleteMessage { + /// ID of the message to delete #[prost(string, tag = "1")] - pub reference: ::prost::alloc::string::String, - /// The inbox ID of the user who sent the message being reacted to - /// Optional for group messages - #[prost(string, tag = "2")] - pub reference_inbox_id: ::prost::alloc::string::String, - /// The action of the reaction (added or removed) - #[prost(enumeration = "ReactionAction", tag = "3")] - pub action: i32, - /// The content of the reaction - #[prost(string, tag = "4")] - pub content: ::prost::alloc::string::String, - /// The schema of the reaction content - #[prost(enumeration = "ReactionSchema", tag = "5")] - pub schema: i32, + pub message_id: ::prost::alloc::string::String, } -impl ::prost::Name for ReactionV2 { - const NAME: &'static str = "ReactionV2"; +impl ::prost::Name for DeleteMessage { + const NAME: &'static str = "DeleteMessage"; const PACKAGE: &'static str = "xmtp.mls.message_contents.content_types"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.content_types.ReactionV2".into() + "xmtp.mls.message_contents.content_types.DeleteMessage".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.content_types.ReactionV2".into() - } -} -/// Action enum to represent reaction states -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum ReactionAction { - Unspecified = 0, - Added = 1, - Removed = 2, -} -impl ReactionAction { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "REACTION_ACTION_UNSPECIFIED", - Self::Added => "REACTION_ACTION_ADDED", - Self::Removed => "REACTION_ACTION_REMOVED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "REACTION_ACTION_UNSPECIFIED" => Some(Self::Unspecified), - "REACTION_ACTION_ADDED" => Some(Self::Added), - "REACTION_ACTION_REMOVED" => Some(Self::Removed), - _ => None, - } - } -} -/// Schema enum to represent reaction content types -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum ReactionSchema { - Unspecified = 0, - Unicode = 1, - Shortcode = 2, - Custom = 3, -} -impl ReactionSchema { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "REACTION_SCHEMA_UNSPECIFIED", - Self::Unicode => "REACTION_SCHEMA_UNICODE", - Self::Shortcode => "REACTION_SCHEMA_SHORTCODE", - Self::Custom => "REACTION_SCHEMA_CUSTOM", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "REACTION_SCHEMA_UNSPECIFIED" => Some(Self::Unspecified), - "REACTION_SCHEMA_UNICODE" => Some(Self::Unicode), - "REACTION_SCHEMA_SHORTCODE" => Some(Self::Shortcode), - "REACTION_SCHEMA_CUSTOM" => Some(Self::Custom), - _ => None, - } + "/xmtp.mls.message_contents.content_types.DeleteMessage".into() } } -/// DeleteMessage message type -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct DeleteMessage { - /// ID of the message to delete +/// EditMessage message type +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EditMessage { + /// ID of the message to edit #[prost(string, tag = "1")] pub message_id: ::prost::alloc::string::String, + /// The new content for the message + #[prost(message, optional, tag = "2")] + pub edited_content: ::core::option::Option, } -impl ::prost::Name for DeleteMessage { - const NAME: &'static str = "DeleteMessage"; +impl ::prost::Name for EditMessage { + const NAME: &'static str = "EditMessage"; const PACKAGE: &'static str = "xmtp.mls.message_contents.content_types"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.content_types.DeleteMessage".into() + "xmtp.mls.message_contents.content_types.EditMessage".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.content_types.DeleteMessage".into() + "/xmtp.mls.message_contents.content_types.EditMessage".into() } } /// MultiRemoteAttachment message type @@ -242,23 +169,96 @@ impl ::prost::Name for Call { "/xmtp.mls.message_contents.content_types.Call".into() } } -/// EditMessage message type -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EditMessage { - /// ID of the message to edit +/// Reaction message type +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ReactionV2 { + /// The message ID being reacted to #[prost(string, tag = "1")] - pub message_id: ::prost::alloc::string::String, - /// The new content for the message - #[prost(message, optional, tag = "2")] - pub edited_content: ::core::option::Option, + pub reference: ::prost::alloc::string::String, + /// The inbox ID of the user who sent the message being reacted to + /// Optional for group messages + #[prost(string, tag = "2")] + pub reference_inbox_id: ::prost::alloc::string::String, + /// The action of the reaction (added or removed) + #[prost(enumeration = "ReactionAction", tag = "3")] + pub action: i32, + /// The content of the reaction + #[prost(string, tag = "4")] + pub content: ::prost::alloc::string::String, + /// The schema of the reaction content + #[prost(enumeration = "ReactionSchema", tag = "5")] + pub schema: i32, } -impl ::prost::Name for EditMessage { - const NAME: &'static str = "EditMessage"; +impl ::prost::Name for ReactionV2 { + const NAME: &'static str = "ReactionV2"; const PACKAGE: &'static str = "xmtp.mls.message_contents.content_types"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.content_types.EditMessage".into() + "xmtp.mls.message_contents.content_types.ReactionV2".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.content_types.EditMessage".into() + "/xmtp.mls.message_contents.content_types.ReactionV2".into() + } +} +/// Action enum to represent reaction states +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ReactionAction { + Unspecified = 0, + Added = 1, + Removed = 2, +} +impl ReactionAction { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "REACTION_ACTION_UNSPECIFIED", + Self::Added => "REACTION_ACTION_ADDED", + Self::Removed => "REACTION_ACTION_REMOVED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "REACTION_ACTION_UNSPECIFIED" => Some(Self::Unspecified), + "REACTION_ACTION_ADDED" => Some(Self::Added), + "REACTION_ACTION_REMOVED" => Some(Self::Removed), + _ => None, + } + } +} +/// Schema enum to represent reaction content types +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ReactionSchema { + Unspecified = 0, + Unicode = 1, + Shortcode = 2, + Custom = 3, +} +impl ReactionSchema { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "REACTION_SCHEMA_UNSPECIFIED", + Self::Unicode => "REACTION_SCHEMA_UNICODE", + Self::Shortcode => "REACTION_SCHEMA_SHORTCODE", + Self::Custom => "REACTION_SCHEMA_CUSTOM", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "REACTION_SCHEMA_UNSPECIFIED" => Some(Self::Unspecified), + "REACTION_SCHEMA_UNICODE" => Some(Self::Unicode), + "REACTION_SCHEMA_SHORTCODE" => Some(Self::Shortcode), + "REACTION_SCHEMA_CUSTOM" => Some(Self::Custom), + _ => None, + } } } diff --git a/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.rs b/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.rs index bd21161a1a..2226d095a1 100644 --- a/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.rs +++ b/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.rs @@ -186,386 +186,195 @@ impl WelcomeWrapperAlgorithm { } } } -/// Message for group mutable metadata -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GroupMutableMetadataV1 { - /// Map to store various metadata attributes (Group name, etc.) - #[prost(map = "string, string", tag = "1")] - pub attributes: ::std::collections::HashMap< - ::prost::alloc::string::String, - ::prost::alloc::string::String, - >, - #[prost(message, optional, tag = "2")] - pub admin_list: ::core::option::Option, - /// Creator starts as only super_admin - /// Only super_admin can add/remove other super_admin - #[prost(message, optional, tag = "3")] - pub super_admin_list: ::core::option::Option, +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct OneshotMessage { + #[prost(oneof = "oneshot_message::MessageType", tags = "1")] + pub message_type: ::core::option::Option, } -impl ::prost::Name for GroupMutableMetadataV1 { - const NAME: &'static str = "GroupMutableMetadataV1"; +/// Nested message and enum types in `OneshotMessage`. +pub mod oneshot_message { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum MessageType { + #[prost(message, tag = "1")] + ReaddRequest(super::ReaddRequest), + } +} +impl ::prost::Name for OneshotMessage { + const NAME: &'static str = "OneshotMessage"; const PACKAGE: &'static str = "xmtp.mls.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.GroupMutableMetadataV1".into() + "xmtp.mls.message_contents.OneshotMessage".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.GroupMutableMetadataV1".into() + "/xmtp.mls.message_contents.OneshotMessage".into() } } -/// Wrapper around a list of repeated Inbox Ids +/// A request sent by an installation to recover from a fork. Other members +/// may remove and readd that installation from the group. +/// XIP: #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct Inboxes { - #[prost(string, repeated, tag = "1")] - pub inbox_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +pub struct ReaddRequest { + #[prost(bytes = "vec", tag = "1")] + pub group_id: ::prost::alloc::vec::Vec, + /// The sequence ID of the latest commit log entry at the time the request + /// is sent; used to disambiguate cases where an installation forks + /// and is readded multiple times. + #[prost(uint64, tag = "2")] + pub latest_commit_sequence_id: u64, } -impl ::prost::Name for Inboxes { - const NAME: &'static str = "Inboxes"; +impl ::prost::Name for ReaddRequest { + const NAME: &'static str = "ReaddRequest"; const PACKAGE: &'static str = "xmtp.mls.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.Inboxes".into() + "xmtp.mls.message_contents.ReaddRequest".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.Inboxes".into() + "/xmtp.mls.message_contents.ReaddRequest".into() } } -/// PlaintextCommitLogEntry indicates whether a commit was successful or not, -/// when applied on top of the indicated `last_epoch_authenticator`. +/// Parent message for group metadata #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct PlaintextCommitLogEntry { - /// The group_id of the group that the commit belongs to. - #[prost(bytes = "vec", tag = "1")] - pub group_id: ::prost::alloc::vec::Vec, - /// The sequence ID of the commit payload being validated. - #[prost(uint64, tag = "2")] - pub commit_sequence_id: u64, - /// The encryption state before the commit was applied. - #[prost(bytes = "vec", tag = "3")] - pub last_epoch_authenticator: ::prost::alloc::vec::Vec, - /// Indicates whether the commit was successful, or why it failed. - #[prost(enumeration = "CommitResult", tag = "4")] - pub commit_result: i32, - /// The epoch number after the commit was applied, if successful. - #[prost(uint64, tag = "5")] - pub applied_epoch_number: u64, - /// The encryption state after the commit was applied, if successful. - #[prost(bytes = "vec", tag = "6")] - pub applied_epoch_authenticator: ::prost::alloc::vec::Vec, +pub struct GroupMetadataV1 { + #[prost(enumeration = "ConversationType", tag = "1")] + pub conversation_type: i32, + /// This will be removed soon + #[prost(string, tag = "2")] + pub creator_account_address: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub creator_inbox_id: ::prost::alloc::string::String, + /// Should only be present for CONVERSATION_TYPE_DM + #[prost(message, optional, tag = "4")] + pub dm_members: ::core::option::Option, + /// Should only be present for CONVERSATION_TYPE_ONESHOT + #[prost(message, optional, tag = "5")] + pub oneshot_message: ::core::option::Option, } -impl ::prost::Name for PlaintextCommitLogEntry { - const NAME: &'static str = "PlaintextCommitLogEntry"; +impl ::prost::Name for GroupMetadataV1 { + const NAME: &'static str = "GroupMetadataV1"; const PACKAGE: &'static str = "xmtp.mls.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.PlaintextCommitLogEntry".into() + "xmtp.mls.message_contents.GroupMetadataV1".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.PlaintextCommitLogEntry".into() + "/xmtp.mls.message_contents.GroupMetadataV1".into() } } +/// Wrapper around an Inbox Id #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct CommitLogEntry { - #[prost(uint64, tag = "1")] - pub sequence_id: u64, - #[prost(bytes = "vec", tag = "2")] - pub serialized_commit_log_entry: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub signature: ::core::option::Option< - super::super::identity::associations::RecoverableEd25519Signature, - >, +pub struct Inbox { + #[prost(string, tag = "1")] + pub inbox_id: ::prost::alloc::string::String, } -impl ::prost::Name for CommitLogEntry { - const NAME: &'static str = "CommitLogEntry"; +impl ::prost::Name for Inbox { + const NAME: &'static str = "Inbox"; const PACKAGE: &'static str = "xmtp.mls.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.CommitLogEntry".into() + "xmtp.mls.message_contents.Inbox".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.CommitLogEntry".into() + "/xmtp.mls.message_contents.Inbox".into() + } +} +/// Ordering does not matter here +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DmMembers { + #[prost(message, optional, tag = "1")] + pub dm_member_one: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub dm_member_two: ::core::option::Option, +} +impl ::prost::Name for DmMembers { + const NAME: &'static str = "DmMembers"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.DmMembers".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.DmMembers".into() } } +/// Defines the type of conversation #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] -pub enum CommitResult { +pub enum ConversationType { Unspecified = 0, - Applied = 1, - WrongEpoch = 2, - Undecryptable = 3, - Invalid = 4, + Group = 1, + Dm = 2, + Sync = 3, + Oneshot = 4, } -impl CommitResult { +impl ConversationType { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Self::Unspecified => "COMMIT_RESULT_UNSPECIFIED", - Self::Applied => "COMMIT_RESULT_APPLIED", - Self::WrongEpoch => "COMMIT_RESULT_WRONG_EPOCH", - Self::Undecryptable => "COMMIT_RESULT_UNDECRYPTABLE", - Self::Invalid => "COMMIT_RESULT_INVALID", + Self::Unspecified => "CONVERSATION_TYPE_UNSPECIFIED", + Self::Group => "CONVERSATION_TYPE_GROUP", + Self::Dm => "CONVERSATION_TYPE_DM", + Self::Sync => "CONVERSATION_TYPE_SYNC", + Self::Oneshot => "CONVERSATION_TYPE_ONESHOT", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { - "COMMIT_RESULT_UNSPECIFIED" => Some(Self::Unspecified), - "COMMIT_RESULT_APPLIED" => Some(Self::Applied), - "COMMIT_RESULT_WRONG_EPOCH" => Some(Self::WrongEpoch), - "COMMIT_RESULT_UNDECRYPTABLE" => Some(Self::Undecryptable), - "COMMIT_RESULT_INVALID" => Some(Self::Invalid), + "CONVERSATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "CONVERSATION_TYPE_GROUP" => Some(Self::Group), + "CONVERSATION_TYPE_DM" => Some(Self::Dm), + "CONVERSATION_TYPE_SYNC" => Some(Self::Sync), + "CONVERSATION_TYPE_ONESHOT" => Some(Self::Oneshot), _ => None, } } } -/// Extension data for proposal support in group context. -/// When present in the group context extensions, indicates the group -/// uses proposal-by-reference flow. -#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] -pub struct ProposalSupport { - #[prost(uint32, tag = "1")] - pub version: u32, +/// Message for group mutable metadata +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GroupMutablePermissionsV1 { + #[prost(message, optional, tag = "1")] + pub policies: ::core::option::Option, } -impl ::prost::Name for ProposalSupport { - const NAME: &'static str = "ProposalSupport"; +impl ::prost::Name for GroupMutablePermissionsV1 { + const NAME: &'static str = "GroupMutablePermissionsV1"; const PACKAGE: &'static str = "xmtp.mls.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.ProposalSupport".into() + "xmtp.mls.message_contents.GroupMutablePermissionsV1".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.ProposalSupport".into() + "/xmtp.mls.message_contents.GroupMutablePermissionsV1".into() } } -/// ContentTypeId is used to identify the type of content stored in a Message. -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct ContentTypeId { - /// authority governing this content type - #[prost(string, tag = "1")] - pub authority_id: ::prost::alloc::string::String, - /// type identifier - #[prost(string, tag = "2")] - pub type_id: ::prost::alloc::string::String, - /// major version of the type - #[prost(uint32, tag = "3")] - pub version_major: u32, - /// minor version of the type - #[prost(uint32, tag = "4")] - pub version_minor: u32, +/// The set of policies that govern the group +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PolicySet { + #[prost(message, optional, tag = "1")] + pub add_member_policy: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub remove_member_policy: ::core::option::Option, + #[prost(map = "string, message", tag = "3")] + pub update_metadata_policy: ::std::collections::HashMap< + ::prost::alloc::string::String, + MetadataPolicy, + >, + #[prost(message, optional, tag = "4")] + pub add_admin_policy: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub remove_admin_policy: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub update_permissions_policy: ::core::option::Option, } -impl ::prost::Name for ContentTypeId { - const NAME: &'static str = "ContentTypeId"; +impl ::prost::Name for PolicySet { + const NAME: &'static str = "PolicySet"; const PACKAGE: &'static str = "xmtp.mls.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.ContentTypeId".into() + "xmtp.mls.message_contents.PolicySet".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.ContentTypeId".into() + "/xmtp.mls.message_contents.PolicySet".into() } } -/// EncodedContent bundles the content with metadata identifying its type -/// and parameters required for correct decoding and presentation of the content. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EncodedContent { - /// content type identifier used to match the payload with - /// the correct decoding machinery - #[prost(message, optional, tag = "1")] - pub r#type: ::core::option::Option, - /// optional encoding parameters required to correctly decode the content - #[prost(map = "string, string", tag = "2")] - pub parameters: ::std::collections::HashMap< - ::prost::alloc::string::String, - ::prost::alloc::string::String, - >, - /// optional fallback description of the content that can be used in case - /// the client cannot decode or render the content - #[prost(string, optional, tag = "3")] - pub fallback: ::core::option::Option<::prost::alloc::string::String>, - /// optional compression; the value indicates algorithm used to - /// compress the encoded content bytes - #[prost(enumeration = "Compression", optional, tag = "5")] - pub compression: ::core::option::Option, - /// encoded content itself - #[prost(bytes = "vec", tag = "4")] - pub content: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for EncodedContent { - const NAME: &'static str = "EncodedContent"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.EncodedContent".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.EncodedContent".into() - } -} -/// A PlaintextEnvelope is the outermost payload that gets encrypted by MLS -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct PlaintextEnvelope { - /// Selector which declares which version of the EncodedContent this - /// PlaintextEnvelope is - #[prost(oneof = "plaintext_envelope::Content", tags = "1, 2")] - pub content: ::core::option::Option, -} -/// Nested message and enum types in `PlaintextEnvelope`. -pub mod plaintext_envelope { - /// Version 1 of the encrypted envelope - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] - pub struct V1 { - /// Expected to be EncodedContent - #[prost(bytes = "vec", tag = "1")] - pub content: ::prost::alloc::vec::Vec, - /// A unique value that can be used to ensure that the same content can - /// produce different hashes. May be the sender timestamp. - #[prost(string, tag = "2")] - pub idempotency_key: ::prost::alloc::string::String, - } - impl ::prost::Name for V1 { - const NAME: &'static str = "V1"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.PlaintextEnvelope.V1".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.PlaintextEnvelope.V1".into() - } - } - /// Version 2 of the encrypted envelope - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] - pub struct V2 { - /// A unique value that can be used to ensure that the same content can - /// produce different hashes. May be the sender timestamp. - #[prost(string, tag = "1")] - pub idempotency_key: ::prost::alloc::string::String, - #[prost(oneof = "v2::MessageType", tags = "2, 3, 4, 5")] - pub message_type: ::core::option::Option, - } - /// Nested message and enum types in `V2`. - pub mod v2 { - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum MessageType { - /// Expected to be EncodedContent - #[prost(bytes, tag = "2")] - Content(::prost::alloc::vec::Vec), - /// Initiator sends a request to receive sync payload - #[prost(message, tag = "3")] - DeviceSyncRequest( - super::super::super::super::device_sync::content::DeviceSyncRequest, - ), - /// Some other authorized installation sends a reply with a link to payload - #[prost(message, tag = "4")] - DeviceSyncReply( - super::super::super::super::device_sync::content::DeviceSyncReply, - ), - /// A serialized user preference update - #[prost(message, tag = "5")] - UserPreferenceUpdate( - super::super::super::super::device_sync::content::V1UserPreferenceUpdate, - ), - } - } - impl ::prost::Name for V2 { - const NAME: &'static str = "V2"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.PlaintextEnvelope.V2".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.PlaintextEnvelope.V2".into() - } - } - /// Selector which declares which version of the EncodedContent this - /// PlaintextEnvelope is - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum Content { - #[prost(message, tag = "1")] - V1(V1), - #[prost(message, tag = "2")] - V2(V2), - } -} -impl ::prost::Name for PlaintextEnvelope { - const NAME: &'static str = "PlaintextEnvelope"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.PlaintextEnvelope".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.PlaintextEnvelope".into() - } -} -/// Recognized compression algorithms -/// protolint:disable ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum Compression { - Deflate = 0, - Gzip = 1, -} -impl Compression { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Deflate => "COMPRESSION_DEFLATE", - Self::Gzip => "COMPRESSION_GZIP", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "COMPRESSION_DEFLATE" => Some(Self::Deflate), - "COMPRESSION_GZIP" => Some(Self::Gzip), - _ => None, - } - } -} -/// Message for group mutable metadata -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GroupMutablePermissionsV1 { - #[prost(message, optional, tag = "1")] - pub policies: ::core::option::Option, -} -impl ::prost::Name for GroupMutablePermissionsV1 { - const NAME: &'static str = "GroupMutablePermissionsV1"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.GroupMutablePermissionsV1".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.GroupMutablePermissionsV1".into() - } -} -/// The set of policies that govern the group -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PolicySet { - #[prost(message, optional, tag = "1")] - pub add_member_policy: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub remove_member_policy: ::core::option::Option, - #[prost(map = "string, message", tag = "3")] - pub update_metadata_policy: ::std::collections::HashMap< - ::prost::alloc::string::String, - MetadataPolicy, - >, - #[prost(message, optional, tag = "4")] - pub add_admin_policy: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub remove_admin_policy: ::core::option::Option, - #[prost(message, optional, tag = "6")] - pub update_permissions_policy: ::core::option::Option, -} -impl ::prost::Name for PolicySet { - const NAME: &'static str = "PolicySet"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.PolicySet".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.PolicySet".into() - } -} -/// A policy that governs adding/removing members or installations +/// A policy that governs adding/removing members or installations #[derive(Clone, PartialEq, ::prost::Message)] pub struct MembershipPolicy { #[prost(oneof = "membership_policy::Kind", tags = "1, 2, 3")] @@ -868,24 +677,435 @@ pub mod permissions_update_policy { } } } - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Kind { - #[prost(enumeration = "PermissionsBasePolicy", tag = "1")] - Base(i32), - #[prost(message, tag = "2")] - AndCondition(AndCondition), - #[prost(message, tag = "3")] - AnyCondition(AnyCondition), + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Kind { + #[prost(enumeration = "PermissionsBasePolicy", tag = "1")] + Base(i32), + #[prost(message, tag = "2")] + AndCondition(AndCondition), + #[prost(message, tag = "3")] + AnyCondition(AnyCondition), + } +} +impl ::prost::Name for PermissionsUpdatePolicy { + const NAME: &'static str = "PermissionsUpdatePolicy"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.PermissionsUpdatePolicy".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.PermissionsUpdatePolicy".into() + } +} +/// Extension data for proposal support in group context. +/// When present in the group context extensions, indicates the group +/// uses proposal-by-reference flow. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ProposalSupport { + #[prost(uint32, tag = "1")] + pub version: u32, +} +impl ::prost::Name for ProposalSupport { + const NAME: &'static str = "ProposalSupport"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.ProposalSupport".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.ProposalSupport".into() + } +} +/// Contains a mapping of `inbox_id` -> `sequence_id` for all members of a group. +/// Designed to be stored in the group context extension of the MLS group +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GroupMembership { + #[prost(map = "string, uint64", tag = "1")] + pub members: ::std::collections::HashMap<::prost::alloc::string::String, u64>, + /// List of installations that failed to be added due to errors encountered during the evaluation process. + #[prost(bytes = "vec", repeated, tag = "2")] + pub failed_installations: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +impl ::prost::Name for GroupMembership { + const NAME: &'static str = "GroupMembership"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.GroupMembership".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.GroupMembership".into() + } +} +/// Per-member membership state stored inside the GROUP_MEMBERSHIP component +/// as a TlsMap\. Keys are 32-byte inbox ids, values are the +/// encoded bytes of this message. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GroupMembershipEntry { + #[prost(oneof = "group_membership_entry::Version", tags = "1")] + pub version: ::core::option::Option, +} +/// Nested message and enum types in `GroupMembershipEntry`. +pub mod group_membership_entry { + /// V1 of the per-member membership state. + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] + pub struct V1 { + /// Latest identity-update sequence id this client has applied for this + /// member. Validator-checked at bootstrap against the pre-flip + /// `GroupMembership.members\[inbox_id\]` value. + #[prost(uint64, tag = "1")] + pub sequence_id: u64, + /// Installation ids belonging to this member that we previously failed + /// to add (expired key package, validation failure, etc.). Used to + /// suppress retries on later membership updates. + /// + /// Sender-authoritative at migration: the migrator partitions the + /// global `failed_installations` per inbox by walking identity-update + /// history. Receivers accept these bytes as-is — the validator only + /// checks `sequence_id`, so the blast radius of a bad partition is + /// bounded to extra or silenced retries. Installations whose owning + /// inbox can't be determined are dropped. + #[prost(bytes = "vec", repeated, tag = "2")] + pub failed_installations: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + } + impl ::prost::Name for V1 { + const NAME: &'static str = "V1"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.GroupMembershipEntry.V1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.GroupMembershipEntry.V1".into() + } + } + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Version { + #[prost(message, tag = "1")] + V1(V1), + } +} +impl ::prost::Name for GroupMembershipEntry { + const NAME: &'static str = "GroupMembershipEntry"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.GroupMembershipEntry".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.GroupMembershipEntry".into() + } +} +/// Message for group mutable metadata +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GroupMutableMetadataV1 { + /// Map to store various metadata attributes (Group name, etc.) + #[prost(map = "string, string", tag = "1")] + pub attributes: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + #[prost(message, optional, tag = "2")] + pub admin_list: ::core::option::Option, + /// Creator starts as only super_admin + /// Only super_admin can add/remove other super_admin + #[prost(message, optional, tag = "3")] + pub super_admin_list: ::core::option::Option, +} +impl ::prost::Name for GroupMutableMetadataV1 { + const NAME: &'static str = "GroupMutableMetadataV1"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.GroupMutableMetadataV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.GroupMutableMetadataV1".into() + } +} +/// Wrapper around a list of repeated Inbox Ids +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Inboxes { + #[prost(string, repeated, tag = "1")] + pub inbox_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +impl ::prost::Name for Inboxes { + const NAME: &'static str = "Inboxes"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.Inboxes".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.Inboxes".into() + } +} +/// ContentTypeId is used to identify the type of content stored in a Message. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ContentTypeId { + /// authority governing this content type + #[prost(string, tag = "1")] + pub authority_id: ::prost::alloc::string::String, + /// type identifier + #[prost(string, tag = "2")] + pub type_id: ::prost::alloc::string::String, + /// major version of the type + #[prost(uint32, tag = "3")] + pub version_major: u32, + /// minor version of the type + #[prost(uint32, tag = "4")] + pub version_minor: u32, +} +impl ::prost::Name for ContentTypeId { + const NAME: &'static str = "ContentTypeId"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.ContentTypeId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.ContentTypeId".into() + } +} +/// EncodedContent bundles the content with metadata identifying its type +/// and parameters required for correct decoding and presentation of the content. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EncodedContent { + /// content type identifier used to match the payload with + /// the correct decoding machinery + #[prost(message, optional, tag = "1")] + pub r#type: ::core::option::Option, + /// optional encoding parameters required to correctly decode the content + #[prost(map = "string, string", tag = "2")] + pub parameters: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// optional fallback description of the content that can be used in case + /// the client cannot decode or render the content + #[prost(string, optional, tag = "3")] + pub fallback: ::core::option::Option<::prost::alloc::string::String>, + /// optional compression; the value indicates algorithm used to + /// compress the encoded content bytes + #[prost(enumeration = "Compression", optional, tag = "5")] + pub compression: ::core::option::Option, + /// encoded content itself + #[prost(bytes = "vec", tag = "4")] + pub content: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for EncodedContent { + const NAME: &'static str = "EncodedContent"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.EncodedContent".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.EncodedContent".into() + } +} +/// A PlaintextEnvelope is the outermost payload that gets encrypted by MLS +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct PlaintextEnvelope { + /// Selector which declares which version of the EncodedContent this + /// PlaintextEnvelope is + #[prost(oneof = "plaintext_envelope::Content", tags = "1, 2")] + pub content: ::core::option::Option, +} +/// Nested message and enum types in `PlaintextEnvelope`. +pub mod plaintext_envelope { + /// Version 1 of the encrypted envelope + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] + pub struct V1 { + /// Expected to be EncodedContent + #[prost(bytes = "vec", tag = "1")] + pub content: ::prost::alloc::vec::Vec, + /// A unique value that can be used to ensure that the same content can + /// produce different hashes. May be the sender timestamp. + #[prost(string, tag = "2")] + pub idempotency_key: ::prost::alloc::string::String, + } + impl ::prost::Name for V1 { + const NAME: &'static str = "V1"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.PlaintextEnvelope.V1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.PlaintextEnvelope.V1".into() + } + } + /// Version 2 of the encrypted envelope + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] + pub struct V2 { + /// A unique value that can be used to ensure that the same content can + /// produce different hashes. May be the sender timestamp. + #[prost(string, tag = "1")] + pub idempotency_key: ::prost::alloc::string::String, + #[prost(oneof = "v2::MessageType", tags = "2, 3, 4, 5")] + pub message_type: ::core::option::Option, + } + /// Nested message and enum types in `V2`. + pub mod v2 { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum MessageType { + /// Expected to be EncodedContent + #[prost(bytes, tag = "2")] + Content(::prost::alloc::vec::Vec), + /// Initiator sends a request to receive sync payload + #[prost(message, tag = "3")] + DeviceSyncRequest( + super::super::super::super::device_sync::content::DeviceSyncRequest, + ), + /// Some other authorized installation sends a reply with a link to payload + #[prost(message, tag = "4")] + DeviceSyncReply( + super::super::super::super::device_sync::content::DeviceSyncReply, + ), + /// A serialized user preference update + #[prost(message, tag = "5")] + UserPreferenceUpdate( + super::super::super::super::device_sync::content::V1UserPreferenceUpdate, + ), + } + } + impl ::prost::Name for V2 { + const NAME: &'static str = "V2"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.PlaintextEnvelope.V2".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.PlaintextEnvelope.V2".into() + } + } + /// Selector which declares which version of the EncodedContent this + /// PlaintextEnvelope is + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Content { + #[prost(message, tag = "1")] + V1(V1), + #[prost(message, tag = "2")] + V2(V2), + } +} +impl ::prost::Name for PlaintextEnvelope { + const NAME: &'static str = "PlaintextEnvelope"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.PlaintextEnvelope".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.PlaintextEnvelope".into() + } +} +/// Recognized compression algorithms +/// protolint:disable ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Compression { + Deflate = 0, + Gzip = 1, +} +impl Compression { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Deflate => "COMPRESSION_DEFLATE", + Self::Gzip => "COMPRESSION_GZIP", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "COMPRESSION_DEFLATE" => Some(Self::Deflate), + "COMPRESSION_GZIP" => Some(Self::Gzip), + _ => None, + } + } +} +/// PlaintextCommitLogEntry indicates whether a commit was successful or not, +/// when applied on top of the indicated `last_epoch_authenticator`. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct PlaintextCommitLogEntry { + /// The group_id of the group that the commit belongs to. + #[prost(bytes = "vec", tag = "1")] + pub group_id: ::prost::alloc::vec::Vec, + /// The sequence ID of the commit payload being validated. + #[prost(uint64, tag = "2")] + pub commit_sequence_id: u64, + /// The encryption state before the commit was applied. + #[prost(bytes = "vec", tag = "3")] + pub last_epoch_authenticator: ::prost::alloc::vec::Vec, + /// Indicates whether the commit was successful, or why it failed. + #[prost(enumeration = "CommitResult", tag = "4")] + pub commit_result: i32, + /// The epoch number after the commit was applied, if successful. + #[prost(uint64, tag = "5")] + pub applied_epoch_number: u64, + /// The encryption state after the commit was applied, if successful. + #[prost(bytes = "vec", tag = "6")] + pub applied_epoch_authenticator: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for PlaintextCommitLogEntry { + const NAME: &'static str = "PlaintextCommitLogEntry"; + const PACKAGE: &'static str = "xmtp.mls.message_contents"; + fn full_name() -> ::prost::alloc::string::String { + "xmtp.mls.message_contents.PlaintextCommitLogEntry".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/xmtp.mls.message_contents.PlaintextCommitLogEntry".into() } } -impl ::prost::Name for PermissionsUpdatePolicy { - const NAME: &'static str = "PermissionsUpdatePolicy"; +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CommitLogEntry { + #[prost(uint64, tag = "1")] + pub sequence_id: u64, + #[prost(bytes = "vec", tag = "2")] + pub serialized_commit_log_entry: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub signature: ::core::option::Option< + super::super::identity::associations::RecoverableEd25519Signature, + >, +} +impl ::prost::Name for CommitLogEntry { + const NAME: &'static str = "CommitLogEntry"; const PACKAGE: &'static str = "xmtp.mls.message_contents"; fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.PermissionsUpdatePolicy".into() + "xmtp.mls.message_contents.CommitLogEntry".into() } fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.PermissionsUpdatePolicy".into() + "/xmtp.mls.message_contents.CommitLogEntry".into() + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum CommitResult { + Unspecified = 0, + Applied = 1, + WrongEpoch = 2, + Undecryptable = 3, + Invalid = 4, +} +impl CommitResult { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "COMMIT_RESULT_UNSPECIFIED", + Self::Applied => "COMMIT_RESULT_APPLIED", + Self::WrongEpoch => "COMMIT_RESULT_WRONG_EPOCH", + Self::Undecryptable => "COMMIT_RESULT_UNDECRYPTABLE", + Self::Invalid => "COMMIT_RESULT_INVALID", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "COMMIT_RESULT_UNSPECIFIED" => Some(Self::Unspecified), + "COMMIT_RESULT_APPLIED" => Some(Self::Applied), + "COMMIT_RESULT_WRONG_EPOCH" => Some(Self::WrongEpoch), + "COMMIT_RESULT_UNDECRYPTABLE" => Some(Self::Undecryptable), + "COMMIT_RESULT_INVALID" => Some(Self::Invalid), + _ => None, + } } } /// Per-component permission policy with separate rules for insert, update, @@ -924,12 +1144,12 @@ impl ::prost::Name for ComponentPermissions { /// it holds and who can insert, update, or delete it. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ComponentMetadata { - /// Permission policies for this component - #[prost(message, optional, tag = "1")] - pub permissions: ::core::option::Option, /// The data structure type of the component's value - #[prost(enumeration = "ComponentType", tag = "2")] + #[prost(enumeration = "ComponentType", tag = "1")] pub component_type: i32, + /// Permission policies for this component + #[prost(message, optional, tag = "2")] + pub permissions: ::core::option::Option, } impl ::prost::Name for ComponentMetadata { const NAME: &'static str = "ComponentMetadata"; @@ -948,14 +1168,16 @@ pub enum ComponentType { Unspecified = 0, /// Opaque bytes, replaced atomically Bytes = 1, + /// A utf-8 encoded string, replaced atomically + String = 2, /// A TlsMap\ supporting key-level insert/update/delete via deltas - TlsMapBytesBytes = 2, + TlsMapBytesBytes = 3, /// A TlsMap\ supporting key-level insert/update/delete via deltas - TlsMapInboxIdBytes = 3, + TlsMapInboxIdBytes = 4, /// A TlsSet supporting insert/remove/remove-by-hash via deltas - SetBytes = 4, + TlsSetBytes = 5, /// A TlsSet supporting insert/remove/remove-by-hash via deltas - SetInboxId = 5, + TlsSetInboxId = 6, } impl ComponentType { /// String value of the enum field names used in the ProtoBuf definition. @@ -966,10 +1188,11 @@ impl ComponentType { match self { Self::Unspecified => "COMPONENT_TYPE_UNSPECIFIED", Self::Bytes => "COMPONENT_TYPE_BYTES", + Self::String => "COMPONENT_TYPE_STRING", Self::TlsMapBytesBytes => "COMPONENT_TYPE_TLS_MAP_BYTES_BYTES", Self::TlsMapInboxIdBytes => "COMPONENT_TYPE_TLS_MAP_INBOX_ID_BYTES", - Self::SetBytes => "COMPONENT_TYPE_SET_BYTES", - Self::SetInboxId => "COMPONENT_TYPE_SET_INBOX_ID", + Self::TlsSetBytes => "COMPONENT_TYPE_TLS_SET_BYTES", + Self::TlsSetInboxId => "COMPONENT_TYPE_TLS_SET_INBOX_ID", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -977,10 +1200,11 @@ impl ComponentType { match value { "COMPONENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), "COMPONENT_TYPE_BYTES" => Some(Self::Bytes), + "COMPONENT_TYPE_STRING" => Some(Self::String), "COMPONENT_TYPE_TLS_MAP_BYTES_BYTES" => Some(Self::TlsMapBytesBytes), "COMPONENT_TYPE_TLS_MAP_INBOX_ID_BYTES" => Some(Self::TlsMapInboxIdBytes), - "COMPONENT_TYPE_SET_BYTES" => Some(Self::SetBytes), - "COMPONENT_TYPE_SET_INBOX_ID" => Some(Self::SetInboxId), + "COMPONENT_TYPE_TLS_SET_BYTES" => Some(Self::TlsSetBytes), + "COMPONENT_TYPE_TLS_SET_INBOX_ID" => Some(Self::TlsSetInboxId), _ => None, } } @@ -1118,166 +1342,3 @@ impl ::prost::Name for GroupUpdated { "/xmtp.mls.message_contents.GroupUpdated".into() } } -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct OneshotMessage { - #[prost(oneof = "oneshot_message::MessageType", tags = "1")] - pub message_type: ::core::option::Option, -} -/// Nested message and enum types in `OneshotMessage`. -pub mod oneshot_message { - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum MessageType { - #[prost(message, tag = "1")] - ReaddRequest(super::ReaddRequest), - } -} -impl ::prost::Name for OneshotMessage { - const NAME: &'static str = "OneshotMessage"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.OneshotMessage".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.OneshotMessage".into() - } -} -/// A request sent by an installation to recover from a fork. Other members -/// may remove and readd that installation from the group. -/// XIP: -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct ReaddRequest { - #[prost(bytes = "vec", tag = "1")] - pub group_id: ::prost::alloc::vec::Vec, - /// The sequence ID of the latest commit log entry at the time the request - /// is sent; used to disambiguate cases where an installation forks - /// and is readded multiple times. - #[prost(uint64, tag = "2")] - pub latest_commit_sequence_id: u64, -} -impl ::prost::Name for ReaddRequest { - const NAME: &'static str = "ReaddRequest"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.ReaddRequest".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.ReaddRequest".into() - } -} -/// Parent message for group metadata -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct GroupMetadataV1 { - #[prost(enumeration = "ConversationType", tag = "1")] - pub conversation_type: i32, - /// This will be removed soon - #[prost(string, tag = "2")] - pub creator_account_address: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub creator_inbox_id: ::prost::alloc::string::String, - /// Should only be present for CONVERSATION_TYPE_DM - #[prost(message, optional, tag = "4")] - pub dm_members: ::core::option::Option, - /// Should only be present for CONVERSATION_TYPE_ONESHOT - #[prost(message, optional, tag = "5")] - pub oneshot_message: ::core::option::Option, -} -impl ::prost::Name for GroupMetadataV1 { - const NAME: &'static str = "GroupMetadataV1"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.GroupMetadataV1".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.GroupMetadataV1".into() - } -} -/// Wrapper around an Inbox Id -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct Inbox { - #[prost(string, tag = "1")] - pub inbox_id: ::prost::alloc::string::String, -} -impl ::prost::Name for Inbox { - const NAME: &'static str = "Inbox"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.Inbox".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.Inbox".into() - } -} -/// Ordering does not matter here -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct DmMembers { - #[prost(message, optional, tag = "1")] - pub dm_member_one: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub dm_member_two: ::core::option::Option, -} -impl ::prost::Name for DmMembers { - const NAME: &'static str = "DmMembers"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.DmMembers".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.DmMembers".into() - } -} -/// Defines the type of conversation -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum ConversationType { - Unspecified = 0, - Group = 1, - Dm = 2, - Sync = 3, - Oneshot = 4, -} -impl ConversationType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "CONVERSATION_TYPE_UNSPECIFIED", - Self::Group => "CONVERSATION_TYPE_GROUP", - Self::Dm => "CONVERSATION_TYPE_DM", - Self::Sync => "CONVERSATION_TYPE_SYNC", - Self::Oneshot => "CONVERSATION_TYPE_ONESHOT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "CONVERSATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified), - "CONVERSATION_TYPE_GROUP" => Some(Self::Group), - "CONVERSATION_TYPE_DM" => Some(Self::Dm), - "CONVERSATION_TYPE_SYNC" => Some(Self::Sync), - "CONVERSATION_TYPE_ONESHOT" => Some(Self::Oneshot), - _ => None, - } - } -} -/// Contains a mapping of `inbox_id` -> `sequence_id` for all members of a group. -/// Designed to be stored in the group context extension of the MLS group -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GroupMembership { - #[prost(map = "string, uint64", tag = "1")] - pub members: ::std::collections::HashMap<::prost::alloc::string::String, u64>, - /// List of installations that failed to be added due to errors encountered during the evaluation process. - #[prost(bytes = "vec", repeated, tag = "2")] - pub failed_installations: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -impl ::prost::Name for GroupMembership { - const NAME: &'static str = "GroupMembership"; - const PACKAGE: &'static str = "xmtp.mls.message_contents"; - fn full_name() -> ::prost::alloc::string::String { - "xmtp.mls.message_contents.GroupMembership".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/xmtp.mls.message_contents.GroupMembership".into() - } -} diff --git a/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs b/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs index 09b6e01452..0cd787ed36 100644 --- a/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs +++ b/crates/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs @@ -225,21 +225,21 @@ impl serde::Serialize for ComponentMetadata { { use serde::ser::SerializeStruct; let mut len = 0; - if self.permissions.is_some() { + if self.component_type != 0 { len += 1; } - if self.component_type != 0 { + if self.permissions.is_some() { len += 1; } let mut struct_ser = serializer.serialize_struct("xmtp.mls.message_contents.ComponentMetadata", len)?; - if let Some(v) = self.permissions.as_ref() { - struct_ser.serialize_field("permissions", v)?; - } if self.component_type != 0 { let v = ComponentType::try_from(self.component_type) .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.component_type)))?; struct_ser.serialize_field("component_type", &v)?; } + if let Some(v) = self.permissions.as_ref() { + struct_ser.serialize_field("permissions", v)?; + } struct_ser.end() } } @@ -250,15 +250,15 @@ impl<'de> serde::Deserialize<'de> for ComponentMetadata { D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "permissions", "component_type", "componentType", + "permissions", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Permissions, ComponentType, + Permissions, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -281,8 +281,8 @@ impl<'de> serde::Deserialize<'de> for ComponentMetadata { E: serde::de::Error, { match value { - "permissions" => Ok(GeneratedField::Permissions), "componentType" | "component_type" => Ok(GeneratedField::ComponentType), + "permissions" => Ok(GeneratedField::Permissions), _ => Ok(GeneratedField::__SkipField__), } } @@ -302,30 +302,30 @@ impl<'de> serde::Deserialize<'de> for ComponentMetadata { where V: serde::de::MapAccess<'de>, { - let mut permissions__ = None; let mut component_type__ = None; + let mut permissions__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Permissions => { - if permissions__.is_some() { - return Err(serde::de::Error::duplicate_field("permissions")); - } - permissions__ = map_.next_value()?; - } GeneratedField::ComponentType => { if component_type__.is_some() { return Err(serde::de::Error::duplicate_field("componentType")); } component_type__ = Some(map_.next_value::()? as i32); } + GeneratedField::Permissions => { + if permissions__.is_some() { + return Err(serde::de::Error::duplicate_field("permissions")); + } + permissions__ = map_.next_value()?; + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } Ok(ComponentMetadata { - permissions: permissions__, component_type: component_type__.unwrap_or_default(), + permissions: permissions__, }) } } @@ -473,10 +473,11 @@ impl serde::Serialize for ComponentType { let variant = match self { Self::Unspecified => "COMPONENT_TYPE_UNSPECIFIED", Self::Bytes => "COMPONENT_TYPE_BYTES", + Self::String => "COMPONENT_TYPE_STRING", Self::TlsMapBytesBytes => "COMPONENT_TYPE_TLS_MAP_BYTES_BYTES", Self::TlsMapInboxIdBytes => "COMPONENT_TYPE_TLS_MAP_INBOX_ID_BYTES", - Self::SetBytes => "COMPONENT_TYPE_SET_BYTES", - Self::SetInboxId => "COMPONENT_TYPE_SET_INBOX_ID", + Self::TlsSetBytes => "COMPONENT_TYPE_TLS_SET_BYTES", + Self::TlsSetInboxId => "COMPONENT_TYPE_TLS_SET_INBOX_ID", }; serializer.serialize_str(variant) } @@ -490,10 +491,11 @@ impl<'de> serde::Deserialize<'de> for ComponentType { const FIELDS: &[&str] = &[ "COMPONENT_TYPE_UNSPECIFIED", "COMPONENT_TYPE_BYTES", + "COMPONENT_TYPE_STRING", "COMPONENT_TYPE_TLS_MAP_BYTES_BYTES", "COMPONENT_TYPE_TLS_MAP_INBOX_ID_BYTES", - "COMPONENT_TYPE_SET_BYTES", - "COMPONENT_TYPE_SET_INBOX_ID", + "COMPONENT_TYPE_TLS_SET_BYTES", + "COMPONENT_TYPE_TLS_SET_INBOX_ID", ]; struct GeneratedVisitor; @@ -536,10 +538,11 @@ impl<'de> serde::Deserialize<'de> for ComponentType { match value { "COMPONENT_TYPE_UNSPECIFIED" => Ok(ComponentType::Unspecified), "COMPONENT_TYPE_BYTES" => Ok(ComponentType::Bytes), + "COMPONENT_TYPE_STRING" => Ok(ComponentType::String), "COMPONENT_TYPE_TLS_MAP_BYTES_BYTES" => Ok(ComponentType::TlsMapBytesBytes), "COMPONENT_TYPE_TLS_MAP_INBOX_ID_BYTES" => Ok(ComponentType::TlsMapInboxIdBytes), - "COMPONENT_TYPE_SET_BYTES" => Ok(ComponentType::SetBytes), - "COMPONENT_TYPE_SET_INBOX_ID" => Ok(ComponentType::SetInboxId), + "COMPONENT_TYPE_TLS_SET_BYTES" => Ok(ComponentType::TlsSetBytes), + "COMPONENT_TYPE_TLS_SET_INBOX_ID" => Ok(ComponentType::TlsSetInboxId), _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } @@ -1408,6 +1411,227 @@ impl<'de> serde::Deserialize<'de> for GroupMembershipChanges { deserializer.deserialize_struct("xmtp.mls.message_contents.GroupMembershipChanges", FIELDS, GeneratedVisitor) } } +impl serde::Serialize for GroupMembershipEntry { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.version.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("xmtp.mls.message_contents.GroupMembershipEntry", len)?; + if let Some(v) = self.version.as_ref() { + match v { + group_membership_entry::Version::V1(v) => { + struct_ser.serialize_field("v1", v)?; + } + } + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for GroupMembershipEntry { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "v1", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + V1, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl serde::de::Visitor<'_> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "v1" => Ok(GeneratedField::V1), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GroupMembershipEntry; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct xmtp.mls.message_contents.GroupMembershipEntry") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut version__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::V1 => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("v1")); + } + version__ = map_.next_value::<::std::option::Option<_>>()?.map(group_membership_entry::Version::V1) +; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(GroupMembershipEntry { + version: version__, + }) + } + } + deserializer.deserialize_struct("xmtp.mls.message_contents.GroupMembershipEntry", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for group_membership_entry::V1 { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.sequence_id != 0 { + len += 1; + } + if !self.failed_installations.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("xmtp.mls.message_contents.GroupMembershipEntry.V1", len)?; + if self.sequence_id != 0 { + #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] + struct_ser.serialize_field("sequence_id", ToString::to_string(&self.sequence_id).as_str())?; + } + if !self.failed_installations.is_empty() { + struct_ser.serialize_field("failed_installations", &self.failed_installations.iter().map(pbjson::private::base64::encode).collect::>())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for group_membership_entry::V1 { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sequence_id", + "sequenceId", + "failed_installations", + "failedInstallations", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SequenceId, + FailedInstallations, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl serde::de::Visitor<'_> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sequenceId" | "sequence_id" => Ok(GeneratedField::SequenceId), + "failedInstallations" | "failed_installations" => Ok(GeneratedField::FailedInstallations), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = group_membership_entry::V1; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct xmtp.mls.message_contents.GroupMembershipEntry.V1") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sequence_id__ = None; + let mut failed_installations__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SequenceId => { + if sequence_id__.is_some() { + return Err(serde::de::Error::duplicate_field("sequenceId")); + } + sequence_id__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::FailedInstallations => { + if failed_installations__.is_some() { + return Err(serde::de::Error::duplicate_field("failedInstallations")); + } + failed_installations__ = + Some(map_.next_value::>>()? + .into_iter().map(|x| x.0).collect()) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(group_membership_entry::V1 { + sequence_id: sequence_id__.unwrap_or_default(), + failed_installations: failed_installations__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("xmtp.mls.message_contents.GroupMembershipEntry.V1", FIELDS, GeneratedVisitor) + } +} impl serde::Serialize for GroupMetadataV1 { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result diff --git a/crates/xmtp_proto/src/gen/xmtp.xmtpv4.message_api.rs b/crates/xmtp_proto/src/gen/xmtp.xmtpv4.message_api.rs index 0740fb53c3..073dc3b4ff 100644 --- a/crates/xmtp_proto/src/gen/xmtp.xmtpv4.message_api.rs +++ b/crates/xmtp_proto/src/gen/xmtp.xmtpv4.message_api.rs @@ -1027,390 +1027,6 @@ pub mod replication_api_server { const NAME: &'static str = SERVICE_NAME; } } -/// Generated server implementations. -#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))] -pub mod notification_api_server { - #![allow( - unused_variables, - dead_code, - missing_docs, - clippy::wildcard_imports, - clippy::let_unit_value, - )] - use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with NotificationApiServer. - #[async_trait] - pub trait NotificationApi: std::marker::Send + std::marker::Sync + 'static { - /// Server streaming response type for the SubscribeAllEnvelopes method. - type SubscribeAllEnvelopesStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result< - super::SubscribeEnvelopesResponse, - tonic::Status, - >, - > - + std::marker::Send - + 'static; - async fn subscribe_all_envelopes( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - } - /// Full envelope stream for notification services. - #[derive(Debug)] - pub struct NotificationApiServer { - inner: Arc, - accept_compression_encodings: EnabledCompressionEncodings, - send_compression_encodings: EnabledCompressionEncodings, - max_decoding_message_size: Option, - max_encoding_message_size: Option, - } - impl NotificationApiServer { - pub fn new(inner: T) -> Self { - Self::from_arc(Arc::new(inner)) - } - pub fn from_arc(inner: Arc) -> Self { - Self { - inner, - accept_compression_encodings: Default::default(), - send_compression_encodings: Default::default(), - max_decoding_message_size: None, - max_encoding_message_size: None, - } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService - where - F: tonic::service::Interceptor, - { - InterceptedService::new(Self::new(inner), interceptor) - } - /// Enable decompressing requests with the given encoding. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.accept_compression_encodings.enable(encoding); - self - } - /// Compress responses with the given encoding, if the client supports it. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.send_compression_encodings.enable(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.max_decoding_message_size = Some(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.max_encoding_message_size = Some(limit); - self - } - } - impl tonic::codegen::Service> for NotificationApiServer - where - T: NotificationApi, - B: Body + std::marker::Send + 'static, - B::Error: Into + std::marker::Send + 'static, - { - type Response = http::Response; - type Error = std::convert::Infallible; - type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { - Poll::Ready(Ok(())) - } - fn call(&mut self, req: http::Request) -> Self::Future { - match req.uri().path() { - "/xmtp.xmtpv4.message_api.NotificationApi/SubscribeAllEnvelopes" => { - #[allow(non_camel_case_types)] - struct SubscribeAllEnvelopesSvc(pub Arc); - impl< - T: NotificationApi, - > tonic::server::ServerStreamingService< - super::SubscribeAllEnvelopesRequest, - > for SubscribeAllEnvelopesSvc { - type Response = super::SubscribeEnvelopesResponse; - type ResponseStream = T::SubscribeAllEnvelopesStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::subscribe_all_envelopes( - &inner, - request, - ) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = SubscribeAllEnvelopesSvc(inner); - let codec = tonic_prost::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.server_streaming(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - _ => { - Box::pin(async move { - let mut response = http::Response::new( - tonic::body::Body::default(), - ); - let headers = response.headers_mut(); - headers - .insert( - tonic::Status::GRPC_STATUS, - (tonic::Code::Unimplemented as i32).into(), - ); - headers - .insert( - http::header::CONTENT_TYPE, - tonic::metadata::GRPC_CONTENT_TYPE, - ); - Ok(response) - }) - } - } - } - } - impl Clone for NotificationApiServer { - fn clone(&self) -> Self { - let inner = self.inner.clone(); - Self { - inner, - accept_compression_encodings: self.accept_compression_encodings, - send_compression_encodings: self.send_compression_encodings, - max_decoding_message_size: self.max_decoding_message_size, - max_encoding_message_size: self.max_encoding_message_size, - } - } - } - /// Generated gRPC service name - pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.NotificationApi"; - impl tonic::server::NamedService for NotificationApiServer { - const NAME: &'static str = SERVICE_NAME; - } -} -/// Generated server implementations. -#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))] -pub mod publish_api_server { - #![allow( - unused_variables, - dead_code, - missing_docs, - clippy::wildcard_imports, - clippy::let_unit_value, - )] - use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with PublishApiServer. - #[async_trait] - pub trait PublishApi: std::marker::Send + std::marker::Sync + 'static { - async fn publish_payer_envelopes( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - } - /// Gateway -> Node. - #[derive(Debug)] - pub struct PublishApiServer { - inner: Arc, - accept_compression_encodings: EnabledCompressionEncodings, - send_compression_encodings: EnabledCompressionEncodings, - max_decoding_message_size: Option, - max_encoding_message_size: Option, - } - impl PublishApiServer { - pub fn new(inner: T) -> Self { - Self::from_arc(Arc::new(inner)) - } - pub fn from_arc(inner: Arc) -> Self { - Self { - inner, - accept_compression_encodings: Default::default(), - send_compression_encodings: Default::default(), - max_decoding_message_size: None, - max_encoding_message_size: None, - } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService - where - F: tonic::service::Interceptor, - { - InterceptedService::new(Self::new(inner), interceptor) - } - /// Enable decompressing requests with the given encoding. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.accept_compression_encodings.enable(encoding); - self - } - /// Compress responses with the given encoding, if the client supports it. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.send_compression_encodings.enable(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.max_decoding_message_size = Some(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.max_encoding_message_size = Some(limit); - self - } - } - impl tonic::codegen::Service> for PublishApiServer - where - T: PublishApi, - B: Body + std::marker::Send + 'static, - B::Error: Into + std::marker::Send + 'static, - { - type Response = http::Response; - type Error = std::convert::Infallible; - type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { - Poll::Ready(Ok(())) - } - fn call(&mut self, req: http::Request) -> Self::Future { - match req.uri().path() { - "/xmtp.xmtpv4.message_api.PublishApi/PublishPayerEnvelopes" => { - #[allow(non_camel_case_types)] - struct PublishPayerEnvelopesSvc(pub Arc); - impl< - T: PublishApi, - > tonic::server::UnaryService - for PublishPayerEnvelopesSvc { - type Response = super::PublishPayerEnvelopesResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::publish_payer_envelopes(&inner, request) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = PublishPayerEnvelopesSvc(inner); - let codec = tonic_prost::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - _ => { - Box::pin(async move { - let mut response = http::Response::new( - tonic::body::Body::default(), - ); - let headers = response.headers_mut(); - headers - .insert( - tonic::Status::GRPC_STATUS, - (tonic::Code::Unimplemented as i32).into(), - ); - headers - .insert( - http::header::CONTENT_TYPE, - tonic::metadata::GRPC_CONTENT_TYPE, - ); - Ok(response) - }) - } - } - } - } - impl Clone for PublishApiServer { - fn clone(&self) -> Self { - let inner = self.inner.clone(); - Self { - inner, - accept_compression_encodings: self.accept_compression_encodings, - send_compression_encodings: self.send_compression_encodings, - max_decoding_message_size: self.max_decoding_message_size, - max_encoding_message_size: self.max_encoding_message_size, - } - } - } - /// Generated gRPC service name - pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.PublishApi"; - impl tonic::server::NamedService for PublishApiServer { - const NAME: &'static str = SERVICE_NAME; - } -} #[derive(Clone, PartialEq, ::prost::Message)] pub struct LivenessFailure { #[prost(uint32, tag = "1")] @@ -1775,28 +1391,213 @@ pub mod misbehavior_api_server { } "/xmtp.xmtpv4.message_api.MisbehaviorApi/QueryMisbehaviorReports" => { #[allow(non_camel_case_types)] - struct QueryMisbehaviorReportsSvc(pub Arc); + struct QueryMisbehaviorReportsSvc(pub Arc); + impl< + T: MisbehaviorApi, + > tonic::server::UnaryService + for QueryMisbehaviorReportsSvc { + type Response = super::QueryMisbehaviorReportsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryMisbehaviorReportsRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::query_misbehavior_reports( + &inner, + request, + ) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = QueryMisbehaviorReportsSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for MisbehaviorApiServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.MisbehaviorApi"; + impl tonic::server::NamedService for MisbehaviorApiServer { + const NAME: &'static str = SERVICE_NAME; + } +} +/// Generated server implementations. +#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))] +pub mod publish_api_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with PublishApiServer. + #[async_trait] + pub trait PublishApi: std::marker::Send + std::marker::Sync + 'static { + async fn publish_payer_envelopes( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Gateway -> Node. + #[derive(Debug)] + pub struct PublishApiServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl PublishApiServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for PublishApiServer + where + T: PublishApi, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/xmtp.xmtpv4.message_api.PublishApi/PublishPayerEnvelopes" => { + #[allow(non_camel_case_types)] + struct PublishPayerEnvelopesSvc(pub Arc); impl< - T: MisbehaviorApi, - > tonic::server::UnaryService - for QueryMisbehaviorReportsSvc { - type Response = super::QueryMisbehaviorReportsResponse; + T: PublishApi, + > tonic::server::UnaryService + for PublishPayerEnvelopesSvc { + type Response = super::PublishPayerEnvelopesResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, - request: tonic::Request< - super::QueryMisbehaviorReportsRequest, - >, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::query_misbehavior_reports( - &inner, - request, - ) + ::publish_payer_envelopes(&inner, request) .await }; Box::pin(fut) @@ -1808,7 +1609,7 @@ pub mod misbehavior_api_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = QueryMisbehaviorReportsSvc(inner); + let method = PublishPayerEnvelopesSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -1846,7 +1647,7 @@ pub mod misbehavior_api_server { } } } - impl Clone for MisbehaviorApiServer { + impl Clone for PublishApiServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { @@ -1859,8 +1660,8 @@ pub mod misbehavior_api_server { } } /// Generated gRPC service name - pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.MisbehaviorApi"; - impl tonic::server::NamedService for MisbehaviorApiServer { + pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.PublishApi"; + impl tonic::server::NamedService for PublishApiServer { const NAME: &'static str = SERVICE_NAME; } } @@ -2212,3 +2013,202 @@ pub mod query_api_server { const NAME: &'static str = SERVICE_NAME; } } +/// Generated server implementations. +#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))] +pub mod notification_api_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with NotificationApiServer. + #[async_trait] + pub trait NotificationApi: std::marker::Send + std::marker::Sync + 'static { + /// Server streaming response type for the SubscribeAllEnvelopes method. + type SubscribeAllEnvelopesStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result< + super::SubscribeEnvelopesResponse, + tonic::Status, + >, + > + + std::marker::Send + + 'static; + async fn subscribe_all_envelopes( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Full envelope stream for notification services. + #[derive(Debug)] + pub struct NotificationApiServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl NotificationApiServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for NotificationApiServer + where + T: NotificationApi, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/xmtp.xmtpv4.message_api.NotificationApi/SubscribeAllEnvelopes" => { + #[allow(non_camel_case_types)] + struct SubscribeAllEnvelopesSvc(pub Arc); + impl< + T: NotificationApi, + > tonic::server::ServerStreamingService< + super::SubscribeAllEnvelopesRequest, + > for SubscribeAllEnvelopesSvc { + type Response = super::SubscribeEnvelopesResponse; + type ResponseStream = T::SubscribeAllEnvelopesStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::subscribe_all_envelopes( + &inner, + request, + ) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = SubscribeAllEnvelopesSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.server_streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for NotificationApiServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.NotificationApi"; + impl tonic::server::NamedService for NotificationApiServer { + const NAME: &'static str = SERVICE_NAME; + } +}