Skip to content

Commit

Permalink
Merge branch 'main' of github.com:xmtp/libxmtp into transactional-ope…
Browse files Browse the repository at this point in the history
…nmlsprovider
  • Loading branch information
insipx committed Nov 15, 2023
2 parents e3938d7 + 09a2442 commit 5be73f8
Show file tree
Hide file tree
Showing 14 changed files with 449 additions and 177 deletions.
40 changes: 23 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
}
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [],
"customizations": {
"vscode": {
"extensions": ["tamasfe.even-better-toml", "rust-lang.rust-analyzer"]
}
},
"runArgs": ["--network=host"]

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Configure tool-specific properties.
// "customizations": {},
// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions mls_validation_service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ path = "src/main.rs"
prost = { version = "0.11", features = ["prost-derive"] }
tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread", "full"] }
tonic = "^0.9"
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full", "grpc", "tonic"] }
openmls = { git= "https://github.com/openmls/openmls", features = ["test-utils"] }
openmls_traits = { git= "https://github.com/openmls/openmls" }
openmls_basic_credential = { git= "https://github.com/openmls/openmls" }
openmls_rust_crypto = { git= "https://github.com/openmls/openmls" }
xmtp_proto = { path = "../xmtp_proto", features = [
"proto_full",
"grpc",
"tonic",
] }
openmls = { git = "https://github.com/xmtp/openmls", features = ["test-utils"] }
openmls_traits = { git = "https://github.com/xmtp/openmls" }
openmls_basic_credential = { git = "https://github.com/xmtp/openmls" }
openmls_rust_crypto = { git = "https://github.com/xmtp/openmls" }
xmtp_mls = { path = "../xmtp_mls" }
serde = "1.0.189"
hex = "0.4.3"
Expand All @@ -25,4 +29,4 @@ env_logger = "0.10.0"

[dev-dependencies]
ethers = "2.0.10"
rand = "0.8.5"
rand = "0.8.5"
7 changes: 3 additions & 4 deletions mls_validation_service/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ use openmls::{
use openmls_rust_crypto::OpenMlsRustCrypto;
use openmls_traits::OpenMlsProvider;
use tonic::{Request, Response, Status};
use xmtp_mls::utils::id::serialize_group_id;
use xmtp_proto::xmtp::mls_validation::v1::{
validate_group_messages_response::ValidationResponse as ValidateGroupMessageValidationResponse,
validate_key_packages_response::ValidationResponse as ValidateKeyPackageValidationResponse,
validation_api_server::ValidationApi, ValidateGroupMessagesRequest,
ValidateGroupMessagesResponse, ValidateKeyPackagesRequest, ValidateKeyPackagesResponse,
};

use crate::validation_helpers::{hex_encode, identity_to_wallet_address};
use crate::validation_helpers::identity_to_wallet_address;

#[derive(Debug, Default)]
pub struct ValidationService {}
Expand Down Expand Up @@ -93,9 +94,7 @@ fn validate_group_message(message: Vec<u8>) -> Result<ValidateGroupMessageResult
let private_message: ProtocolMessage = msg_result.into();

Ok(ValidateGroupMessageResult {
// TODO: I wonder if we really want to be base64 encoding this or if we can treat it as a
// slice
group_id: hex_encode(private_message.group_id().as_slice()),
group_id: serialize_group_id(private_message.group_id().as_slice()),
})
}

Expand Down
4 changes: 0 additions & 4 deletions mls_validation_service/src/validation_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ use prost::Message;
use xmtp_mls::association::Eip191Association;
use xmtp_proto::xmtp::v3::message_contents::Eip191Association as Eip191AssociationProto;

pub fn hex_encode(key: &[u8]) -> String {
hex::encode(key)
}

pub fn identity_to_wallet_address(identity: &[u8], pub_key: &[u8]) -> Result<String, String> {
let proto_value = Eip191AssociationProto::decode(identity).map_err(|e| format!("{:?}", e))?;
let association = Eip191Association::from_proto_with_expected_address(
Expand Down
24 changes: 15 additions & 9 deletions xmtp_mls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,33 @@ native = ["libsqlite3-sys/bundled-sqlcipher-vendored-openssl"]
[dependencies]
anyhow = "1.0.71"
async-trait = "0.1.68"
diesel = { version = "2.1.3", features = ["sqlite", "r2d2", "returning_clauses_for_sqlite_3_35"] }
diesel = { version = "2.1.3", features = [
"sqlite",
"r2d2",
"returning_clauses_for_sqlite_3_35",
] }
diesel_migrations = { version = "2.1.0", features = ["sqlite"] }
ethers = "2.0.4"
ethers-core = "2.0.4"
futures = "0.3.28"
hex = "0.4.3"
libsqlite3-sys = { version = "0.26.0", optional = true}
openmls = { git= "https://github.com/xmtp/openmls", features = ["test-utils"] }
openmls_traits = { git= "https://github.com/xmtp/openmls" }
openmls_basic_credential = { git= "https://github.com/xmtp/openmls" }
openmls_rust_crypto = { git= "https://github.com/xmtp/openmls" }
libsqlite3-sys = { version = "0.26.0", optional = true }
openmls = { git = "https://github.com/xmtp/openmls", branch = "main", features = [
"test-utils",
] }
openmls_traits = { git = "https://github.com/xmtp/openmls", branch = "main" }
openmls_basic_credential = { git = "https://github.com/xmtp/openmls", branch = "main" }
openmls_rust_crypto = { git = "https://github.com/xmtp/openmls", branch = "main" }
prost = { version = "0.11", features = ["prost-derive"] }
rand = "0.8.5"
serde = "1.0.160"
serde_json = "1.0.96"
thiserror = "1.0.40"
tokio = { version = "1.28.1", features = ["macros"] }
tokio = { version = "1.28.1", features = ["macros"] }
log = "0.4.17"
tracing = "0.1.37"
tracing = "0.1.37"
toml = "0.7.4"
xmtp_cryptography = { path = "../xmtp_cryptography"}
xmtp_cryptography = { path = "../xmtp_cryptography" }
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] }
tls_codec = "0.3.0"

Expand Down
Loading

0 comments on commit 5be73f8

Please sign in to comment.