Hide protobuf types behind Rust facade in ratman client-lib
Currently the ratman-client library fails to build its documentation because the exported types (such as Message
or ApiMessage
) are generated by protobuf, which is not installed in the docs.rs environment. An alternative solution to this exact problem might be to use the pure-rust protobuf generation module in future.
A second issue with this approach is that it exposes a lot of protobuf specific types to the user and makes interacting with the API more complicated. Thus the client-lib API should wrap all protobuf datatype in a new set of Rust types with appropriate From<ApiType> for ProtobufType
implementations for every "ProtobufType".
Following is a list of types we will need to get started:
-
Message
(containing the fieldsid
,sender
,recipients
,time
,payload
, andsignature
)- This type is only used for receiving messages. The API for sending messages should not expose this type
- Potentially the
signature
field could just be an indicator whether the Ratman daemon was able to verify the signature
-
Recipient
which can either beStandard(Identity)
to indicate a message was sent to a specific address, orFlood(Identity
) to indicate a message was flooded on a particular namespace- The flood namespace can be omitted as long as !55 (merged) hasn't been merged yet
- The term "standard" in this context is vague and we haven't found good language for this yet. Maybe other terms might be more appropriate such as "direct" or "address"
-
Address
which only contains a fieldidentity
for now- Creating an abstraction here will allow us to expose more metadata in the future though