1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-07-16 02:48:47 +00:00

Finished implementation of old crypto system as much until course change.

This commit is contained in:
Koen 2023-12-21 14:18:47 +01:00
parent 137a6f3178
commit b8bd78d90d
20 changed files with 4143 additions and 118 deletions

View file

@ -69,4 +69,42 @@ pub struct PlaybackErrorMessage {
#[derive(Deserialize, Debug)]
pub struct VersionMessage {
pub version: u64,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct KeyExchangeMessage {
pub version: u64,
#[serde(rename = "publicKey")]
pub public_key: String,
}
impl KeyExchangeMessage {
pub fn new(version: u64, public_key: String) -> Self {
Self { version, public_key }
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct DecryptedMessage {
pub opcode: u64,
pub message: Option<String>,
}
impl DecryptedMessage {
pub fn new(opcode: u64, message: Option<String>) -> Self {
Self { opcode, message }
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct EncryptedMessage {
pub version: u64,
pub iv: Option<String>,
pub blob: String,
}
impl EncryptedMessage {
pub fn new(version: u64, iv: Option<String>, blob: String) -> Self {
Self { version, iv, blob }
}
}