xmtp_proto/gen/
xmtp.identity.associations.rs

1// This file is @generated by prost-build.
2/// RecoverableEcdsaSignature for EIP-191 and V2 signatures
3#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct RecoverableEcdsaSignature {
5    /// 65-bytes \[ R || S || V \], with recovery id as the last byte
6    #[prost(bytes = "vec", tag = "1")]
7    pub bytes: ::prost::alloc::vec::Vec<u8>,
8}
9impl ::prost::Name for RecoverableEcdsaSignature {
10    const NAME: &'static str = "RecoverableEcdsaSignature";
11    const PACKAGE: &'static str = "xmtp.identity.associations";
12    fn full_name() -> ::prost::alloc::string::String {
13        "xmtp.identity.associations.RecoverableEcdsaSignature".into()
14    }
15    fn type_url() -> ::prost::alloc::string::String {
16        "/xmtp.identity.associations.RecoverableEcdsaSignature".into()
17    }
18}
19/// EdDSA signature for 25519
20#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
21pub struct RecoverableEd25519Signature {
22    /// 64 bytes \[R(32 bytes) || S(32 bytes)\]
23    #[prost(bytes = "vec", tag = "1")]
24    pub bytes: ::prost::alloc::vec::Vec<u8>,
25    /// 32 bytes
26    #[prost(bytes = "vec", tag = "2")]
27    pub public_key: ::prost::alloc::vec::Vec<u8>,
28}
29impl ::prost::Name for RecoverableEd25519Signature {
30    const NAME: &'static str = "RecoverableEd25519Signature";
31    const PACKAGE: &'static str = "xmtp.identity.associations";
32    fn full_name() -> ::prost::alloc::string::String {
33        "xmtp.identity.associations.RecoverableEd25519Signature".into()
34    }
35    fn type_url() -> ::prost::alloc::string::String {
36        "/xmtp.identity.associations.RecoverableEd25519Signature".into()
37    }
38}
39/// Smart Contract Wallet signature
40#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
41pub struct SmartContractWalletSignature {
42    /// CAIP-10 string
43    /// <https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md>
44    #[prost(string, tag = "1")]
45    pub account_id: ::prost::alloc::string::String,
46    /// Specify the block number to verify the signature against
47    #[prost(uint64, tag = "2")]
48    pub block_number: u64,
49    /// The actual signature bytes
50    #[prost(bytes = "vec", tag = "3")]
51    pub signature: ::prost::alloc::vec::Vec<u8>,
52}
53impl ::prost::Name for SmartContractWalletSignature {
54    const NAME: &'static str = "SmartContractWalletSignature";
55    const PACKAGE: &'static str = "xmtp.identity.associations";
56    fn full_name() -> ::prost::alloc::string::String {
57        "xmtp.identity.associations.SmartContractWalletSignature".into()
58    }
59    fn type_url() -> ::prost::alloc::string::String {
60        "/xmtp.identity.associations.SmartContractWalletSignature".into()
61    }
62}
63/// Passkey signature
64#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
65pub struct RecoverablePasskeySignature {
66    #[prost(bytes = "vec", tag = "1")]
67    pub public_key: ::prost::alloc::vec::Vec<u8>,
68    #[prost(bytes = "vec", tag = "2")]
69    pub signature: ::prost::alloc::vec::Vec<u8>,
70    #[prost(bytes = "vec", tag = "3")]
71    pub authenticator_data: ::prost::alloc::vec::Vec<u8>,
72    #[prost(bytes = "vec", tag = "4")]
73    pub client_data_json: ::prost::alloc::vec::Vec<u8>,
74}
75impl ::prost::Name for RecoverablePasskeySignature {
76    const NAME: &'static str = "RecoverablePasskeySignature";
77    const PACKAGE: &'static str = "xmtp.identity.associations";
78    fn full_name() -> ::prost::alloc::string::String {
79        "xmtp.identity.associations.RecoverablePasskeySignature".into()
80    }
81    fn type_url() -> ::prost::alloc::string::String {
82        "/xmtp.identity.associations.RecoverablePasskeySignature".into()
83    }
84}
85/// An existing address on xmtpv2 may have already signed a legacy identity key
86/// of type SignedPublicKey via the 'Create Identity' signature.
87/// For migration to xmtpv3, the legacy key is permitted to sign on behalf of the
88/// address to create a matching xmtpv3 installation key.
89/// This signature type can ONLY be used for CreateXid and AddAssociation
90/// payloads, and can only be used once in xmtpv3.
91#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
92pub struct LegacyDelegatedSignature {
93    #[prost(message, optional, tag = "1")]
94    pub delegated_key: ::core::option::Option<
95        super::super::message_contents::SignedPublicKey,
96    >,
97    #[prost(message, optional, tag = "2")]
98    pub signature: ::core::option::Option<RecoverableEcdsaSignature>,
99}
100impl ::prost::Name for LegacyDelegatedSignature {
101    const NAME: &'static str = "LegacyDelegatedSignature";
102    const PACKAGE: &'static str = "xmtp.identity.associations";
103    fn full_name() -> ::prost::alloc::string::String {
104        "xmtp.identity.associations.LegacyDelegatedSignature".into()
105    }
106    fn type_url() -> ::prost::alloc::string::String {
107        "/xmtp.identity.associations.LegacyDelegatedSignature".into()
108    }
109}
110/// A wrapper for all possible signature types
111#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
112pub struct Signature {
113    /// Must have two properties:
114    ///
115    /// 1. An identifier (address or public key) for the signer must either be
116    ///    recoverable, or specified as a field.
117    /// 1. The signer certifies that the signing payload is correct. The payload
118    ///    must be inferred from the context in which the signature is provided.
119    #[prost(oneof = "signature::Signature", tags = "1, 2, 3, 4, 5")]
120    pub signature: ::core::option::Option<signature::Signature>,
121}
122/// Nested message and enum types in `Signature`.
123pub mod signature {
124    /// Must have two properties:
125    ///
126    /// 1. An identifier (address or public key) for the signer must either be
127    ///    recoverable, or specified as a field.
128    /// 1. The signer certifies that the signing payload is correct. The payload
129    ///    must be inferred from the context in which the signature is provided.
130    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
131    pub enum Signature {
132        #[prost(message, tag = "1")]
133        Erc191(super::RecoverableEcdsaSignature),
134        #[prost(message, tag = "2")]
135        Erc6492(super::SmartContractWalletSignature),
136        #[prost(message, tag = "3")]
137        InstallationKey(super::RecoverableEd25519Signature),
138        #[prost(message, tag = "4")]
139        DelegatedErc191(super::LegacyDelegatedSignature),
140        #[prost(message, tag = "5")]
141        Passkey(super::RecoverablePasskeySignature),
142    }
143}
144impl ::prost::Name for Signature {
145    const NAME: &'static str = "Signature";
146    const PACKAGE: &'static str = "xmtp.identity.associations";
147    fn full_name() -> ::prost::alloc::string::String {
148        "xmtp.identity.associations.Signature".into()
149    }
150    fn type_url() -> ::prost::alloc::string::String {
151        "/xmtp.identity.associations.Signature".into()
152    }
153}
154/// The identifier for a member of an XID
155#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
156pub struct MemberIdentifier {
157    #[prost(oneof = "member_identifier::Kind", tags = "1, 2, 3")]
158    pub kind: ::core::option::Option<member_identifier::Kind>,
159}
160/// Nested message and enum types in `MemberIdentifier`.
161pub mod member_identifier {
162    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
163    pub enum Kind {
164        #[prost(string, tag = "1")]
165        EthereumAddress(::prost::alloc::string::String),
166        #[prost(bytes, tag = "2")]
167        InstallationPublicKey(::prost::alloc::vec::Vec<u8>),
168        #[prost(message, tag = "3")]
169        Passkey(super::Passkey),
170    }
171}
172impl ::prost::Name for MemberIdentifier {
173    const NAME: &'static str = "MemberIdentifier";
174    const PACKAGE: &'static str = "xmtp.identity.associations";
175    fn full_name() -> ::prost::alloc::string::String {
176        "xmtp.identity.associations.MemberIdentifier".into()
177    }
178    fn type_url() -> ::prost::alloc::string::String {
179        "/xmtp.identity.associations.MemberIdentifier".into()
180    }
181}
182/// Passkey identifier
183#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
184pub struct Passkey {
185    #[prost(bytes = "vec", tag = "1")]
186    pub key: ::prost::alloc::vec::Vec<u8>,
187    #[prost(string, optional, tag = "2")]
188    pub relying_party: ::core::option::Option<::prost::alloc::string::String>,
189}
190impl ::prost::Name for Passkey {
191    const NAME: &'static str = "Passkey";
192    const PACKAGE: &'static str = "xmtp.identity.associations";
193    fn full_name() -> ::prost::alloc::string::String {
194        "xmtp.identity.associations.Passkey".into()
195    }
196    fn type_url() -> ::prost::alloc::string::String {
197        "/xmtp.identity.associations.Passkey".into()
198    }
199}
200/// single member that optionally indicates the member that added them
201#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
202pub struct Member {
203    #[prost(message, optional, tag = "1")]
204    pub identifier: ::core::option::Option<MemberIdentifier>,
205    #[prost(message, optional, tag = "2")]
206    pub added_by_entity: ::core::option::Option<MemberIdentifier>,
207    #[prost(uint64, optional, tag = "3")]
208    pub client_timestamp_ns: ::core::option::Option<u64>,
209    #[prost(uint64, optional, tag = "4")]
210    pub added_on_chain_id: ::core::option::Option<u64>,
211}
212impl ::prost::Name for Member {
213    const NAME: &'static str = "Member";
214    const PACKAGE: &'static str = "xmtp.identity.associations";
215    fn full_name() -> ::prost::alloc::string::String {
216        "xmtp.identity.associations.Member".into()
217    }
218    fn type_url() -> ::prost::alloc::string::String {
219        "/xmtp.identity.associations.Member".into()
220    }
221}
222/// The first entry of any XID log. The XID must be deterministically derivable
223/// from the address and nonce.
224/// The recovery address defaults to the initial associated_address unless
225/// there is a subsequent ChangeRecoveryAddress in the log.
226#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
227pub struct CreateInbox {
228    #[prost(string, tag = "1")]
229    pub initial_identifier: ::prost::alloc::string::String,
230    #[prost(uint64, tag = "2")]
231    pub nonce: u64,
232    /// Must be an addressable member
233    #[prost(message, optional, tag = "3")]
234    pub initial_identifier_signature: ::core::option::Option<Signature>,
235    #[prost(enumeration = "IdentifierKind", tag = "4")]
236    pub initial_identifier_kind: i32,
237    /// Should be provided if identifier kind is passkey
238    #[prost(string, optional, tag = "5")]
239    pub relying_party: ::core::option::Option<::prost::alloc::string::String>,
240}
241impl ::prost::Name for CreateInbox {
242    const NAME: &'static str = "CreateInbox";
243    const PACKAGE: &'static str = "xmtp.identity.associations";
244    fn full_name() -> ::prost::alloc::string::String {
245        "xmtp.identity.associations.CreateInbox".into()
246    }
247    fn type_url() -> ::prost::alloc::string::String {
248        "/xmtp.identity.associations.CreateInbox".into()
249    }
250}
251/// Adds a new member for an XID - either an addressable member such as a
252/// wallet, or an installation acting on behalf of an address.
253/// A key-pair that has been associated with one role MUST not be permitted to be
254/// associated with a different role.
255#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
256pub struct AddAssociation {
257    #[prost(message, optional, tag = "1")]
258    pub new_member_identifier: ::core::option::Option<MemberIdentifier>,
259    #[prost(message, optional, tag = "2")]
260    pub existing_member_signature: ::core::option::Option<Signature>,
261    #[prost(message, optional, tag = "3")]
262    pub new_member_signature: ::core::option::Option<Signature>,
263    /// Should be provided if identifier kind is passkey
264    #[prost(string, optional, tag = "4")]
265    pub relying_party: ::core::option::Option<::prost::alloc::string::String>,
266}
267impl ::prost::Name for AddAssociation {
268    const NAME: &'static str = "AddAssociation";
269    const PACKAGE: &'static str = "xmtp.identity.associations";
270    fn full_name() -> ::prost::alloc::string::String {
271        "xmtp.identity.associations.AddAssociation".into()
272    }
273    fn type_url() -> ::prost::alloc::string::String {
274        "/xmtp.identity.associations.AddAssociation".into()
275    }
276}
277/// Revokes a member from an XID. The recovery address must sign the revocation.
278#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
279pub struct RevokeAssociation {
280    #[prost(message, optional, tag = "1")]
281    pub member_to_revoke: ::core::option::Option<MemberIdentifier>,
282    #[prost(message, optional, tag = "2")]
283    pub recovery_identifier_signature: ::core::option::Option<Signature>,
284}
285impl ::prost::Name for RevokeAssociation {
286    const NAME: &'static str = "RevokeAssociation";
287    const PACKAGE: &'static str = "xmtp.identity.associations";
288    fn full_name() -> ::prost::alloc::string::String {
289        "xmtp.identity.associations.RevokeAssociation".into()
290    }
291    fn type_url() -> ::prost::alloc::string::String {
292        "/xmtp.identity.associations.RevokeAssociation".into()
293    }
294}
295/// Changes the recovery identifier for an XID. The recovery identifier is not required
296/// to be a member of the XID. In addition to being able to add members, the
297/// recovery identifier can also revoke members.
298#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
299pub struct ChangeRecoveryAddress {
300    #[prost(string, tag = "1")]
301    pub new_recovery_identifier: ::prost::alloc::string::String,
302    #[prost(message, optional, tag = "2")]
303    pub existing_recovery_identifier_signature: ::core::option::Option<Signature>,
304    #[prost(enumeration = "IdentifierKind", tag = "3")]
305    pub new_recovery_identifier_kind: i32,
306    /// Should be provided if identifier kind is passkey
307    #[prost(string, optional, tag = "4")]
308    pub relying_party: ::core::option::Option<::prost::alloc::string::String>,
309}
310impl ::prost::Name for ChangeRecoveryAddress {
311    const NAME: &'static str = "ChangeRecoveryAddress";
312    const PACKAGE: &'static str = "xmtp.identity.associations";
313    fn full_name() -> ::prost::alloc::string::String {
314        "xmtp.identity.associations.ChangeRecoveryAddress".into()
315    }
316    fn type_url() -> ::prost::alloc::string::String {
317        "/xmtp.identity.associations.ChangeRecoveryAddress".into()
318    }
319}
320/// A single identity operation
321#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
322pub struct IdentityAction {
323    #[prost(oneof = "identity_action::Kind", tags = "1, 2, 3, 4")]
324    pub kind: ::core::option::Option<identity_action::Kind>,
325}
326/// Nested message and enum types in `IdentityAction`.
327pub mod identity_action {
328    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
329    pub enum Kind {
330        #[prost(message, tag = "1")]
331        CreateInbox(super::CreateInbox),
332        #[prost(message, tag = "2")]
333        Add(super::AddAssociation),
334        #[prost(message, tag = "3")]
335        Revoke(super::RevokeAssociation),
336        #[prost(message, tag = "4")]
337        ChangeRecoveryAddress(super::ChangeRecoveryAddress),
338    }
339}
340impl ::prost::Name for IdentityAction {
341    const NAME: &'static str = "IdentityAction";
342    const PACKAGE: &'static str = "xmtp.identity.associations";
343    fn full_name() -> ::prost::alloc::string::String {
344        "xmtp.identity.associations.IdentityAction".into()
345    }
346    fn type_url() -> ::prost::alloc::string::String {
347        "/xmtp.identity.associations.IdentityAction".into()
348    }
349}
350/// One or more identity actions that were signed together.
351/// Example: \[CreateXid, AddAssociation, ChangeRecoveryAddress\]
352///
353/// 1. The batched signature text is created by concatenating the signature text
354///    of each association together with a separator, '\n\n\n'.
355/// 1. The user signs this concatenated result.
356/// 1. The resulting signature is added to each association proto where relevant.
357///    The same signature may be used for multiple associations in the array.
358#[derive(Clone, PartialEq, ::prost::Message)]
359pub struct IdentityUpdate {
360    #[prost(message, repeated, tag = "1")]
361    pub actions: ::prost::alloc::vec::Vec<IdentityAction>,
362    #[prost(uint64, tag = "2")]
363    pub client_timestamp_ns: u64,
364    #[prost(string, tag = "3")]
365    pub inbox_id: ::prost::alloc::string::String,
366}
367impl ::prost::Name for IdentityUpdate {
368    const NAME: &'static str = "IdentityUpdate";
369    const PACKAGE: &'static str = "xmtp.identity.associations";
370    fn full_name() -> ::prost::alloc::string::String {
371        "xmtp.identity.associations.IdentityUpdate".into()
372    }
373    fn type_url() -> ::prost::alloc::string::String {
374        "/xmtp.identity.associations.IdentityUpdate".into()
375    }
376}
377/// Map of members belonging to an inbox_id
378#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
379pub struct MemberMap {
380    #[prost(message, optional, tag = "1")]
381    pub key: ::core::option::Option<MemberIdentifier>,
382    #[prost(message, optional, tag = "2")]
383    pub value: ::core::option::Option<Member>,
384}
385impl ::prost::Name for MemberMap {
386    const NAME: &'static str = "MemberMap";
387    const PACKAGE: &'static str = "xmtp.identity.associations";
388    fn full_name() -> ::prost::alloc::string::String {
389        "xmtp.identity.associations.MemberMap".into()
390    }
391    fn type_url() -> ::prost::alloc::string::String {
392        "/xmtp.identity.associations.MemberMap".into()
393    }
394}
395/// A final association state resulting from multiple `IdentityUpdates`
396#[derive(Clone, PartialEq, ::prost::Message)]
397pub struct AssociationState {
398    #[prost(string, tag = "1")]
399    pub inbox_id: ::prost::alloc::string::String,
400    #[prost(message, repeated, tag = "2")]
401    pub members: ::prost::alloc::vec::Vec<MemberMap>,
402    #[prost(string, tag = "3")]
403    pub recovery_identifier: ::prost::alloc::string::String,
404    #[prost(bytes = "vec", repeated, tag = "4")]
405    pub seen_signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
406    #[prost(enumeration = "IdentifierKind", tag = "5")]
407    pub recovery_identifier_kind: i32,
408    /// Should be provided if identifier kind is passkey
409    #[prost(string, optional, tag = "6")]
410    pub relying_party: ::core::option::Option<::prost::alloc::string::String>,
411}
412impl ::prost::Name for AssociationState {
413    const NAME: &'static str = "AssociationState";
414    const PACKAGE: &'static str = "xmtp.identity.associations";
415    fn full_name() -> ::prost::alloc::string::String {
416        "xmtp.identity.associations.AssociationState".into()
417    }
418    fn type_url() -> ::prost::alloc::string::String {
419        "/xmtp.identity.associations.AssociationState".into()
420    }
421}
422/// / state diff between two final AssociationStates
423#[derive(Clone, PartialEq, ::prost::Message)]
424pub struct AssociationStateDiff {
425    #[prost(message, repeated, tag = "1")]
426    pub new_members: ::prost::alloc::vec::Vec<MemberIdentifier>,
427    #[prost(message, repeated, tag = "2")]
428    pub removed_members: ::prost::alloc::vec::Vec<MemberIdentifier>,
429}
430impl ::prost::Name for AssociationStateDiff {
431    const NAME: &'static str = "AssociationStateDiff";
432    const PACKAGE: &'static str = "xmtp.identity.associations";
433    fn full_name() -> ::prost::alloc::string::String {
434        "xmtp.identity.associations.AssociationStateDiff".into()
435    }
436    fn type_url() -> ::prost::alloc::string::String {
437        "/xmtp.identity.associations.AssociationStateDiff".into()
438    }
439}
440/// List of identity kinds
441#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
442#[repr(i32)]
443pub enum IdentifierKind {
444    /// Ethereum on old clients
445    Unspecified = 0,
446    Ethereum = 1,
447    Passkey = 2,
448}
449impl IdentifierKind {
450    /// String value of the enum field names used in the ProtoBuf definition.
451    ///
452    /// The values are not transformed in any way and thus are considered stable
453    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
454    pub fn as_str_name(&self) -> &'static str {
455        match self {
456            Self::Unspecified => "IDENTIFIER_KIND_UNSPECIFIED",
457            Self::Ethereum => "IDENTIFIER_KIND_ETHEREUM",
458            Self::Passkey => "IDENTIFIER_KIND_PASSKEY",
459        }
460    }
461    /// Creates an enum from field names used in the ProtoBuf definition.
462    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
463        match value {
464            "IDENTIFIER_KIND_UNSPECIFIED" => Some(Self::Unspecified),
465            "IDENTIFIER_KIND_ETHEREUM" => Some(Self::Ethereum),
466            "IDENTIFIER_KIND_PASSKEY" => Some(Self::Passkey),
467            _ => None,
468        }
469    }
470}