-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scaffold for Envelope and EnvelopeEntity
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pub struct Envelope { | ||
inner: crate::proto::Envelope, | ||
} | ||
|
||
#[derive(serde::Serialize, serde::Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub(crate) struct EnvelopeEntity { | ||
pub r#type: i32, | ||
pub relay: String, | ||
pub timestamp: i64, | ||
pub source: String, | ||
pub source_uuid: String, | ||
pub source_device: i32, | ||
pub message: Vec<u8>, | ||
pub content: Vec<u8>, | ||
pub server_timestamp: i64, | ||
pub guid: String, | ||
} | ||
|
||
const SUPPORTED_VERSION: usize = 1; | ||
const CIPHER_KEY_SIZE: usize = 32; | ||
const MAC_KEY_SIZE: usize = 20; | ||
const MAC_SIZE: usize = 10; | ||
|
||
const VERSION_OFFSET: usize = 0; | ||
const VERSION_LENGTH: usize = 1; | ||
const IV_OFFSET: usize = VERSION_OFFSET + VERSION_LENGTH; | ||
const IV_LENGTH: usize = 16; | ||
const CIPHERTEXT_OFFSET: usize = IV_OFFSET + IV_LENGTH; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod account_manager; | ||
pub mod configuration; | ||
pub mod envelope; | ||
pub mod push_service; | ||
pub mod receiver; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters