Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consent Sync #1152

Merged
merged 80 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
860834a
wip
codabrink Oct 17, 2024
e8c1bb3
reorganize
codabrink Oct 18, 2024
be61178
reuse group
codabrink Oct 18, 2024
b7ccc60
wip
codabrink Oct 18, 2024
fe563a6
type fixes
codabrink Oct 18, 2024
e9940c6
wip
codabrink Oct 18, 2024
89796c8
cleanup wip
codabrink Oct 21, 2024
a399b66
get and set
codabrink Oct 21, 2024
e03a6d3
fix diesel issue
codabrink Oct 21, 2024
8e5f0da
cleanup
codabrink Oct 21, 2024
f6785eb
sync reply
codabrink Oct 21, 2024
0564b3e
wip
codabrink Oct 21, 2024
4ad8d74
more generalization
codabrink Oct 21, 2024
c0513f3
processing reply
codabrink Oct 22, 2024
98fccd3
skip the fs
codabrink Oct 22, 2024
4937eb7
syncables
codabrink Oct 22, 2024
ed8ada5
cleanup
codabrink Oct 22, 2024
00deeef
wip
codabrink Oct 23, 2024
0376f61
rearrange a bit more
codabrink Oct 23, 2024
f9ec3cb
no more fs in history sync
codabrink Oct 23, 2024
54a311d
all fs stuff gone for real
codabrink Oct 23, 2024
3549add
fix verify pin
codabrink Oct 23, 2024
246af1e
update encrypt/decrypt test
codabrink Oct 23, 2024
35aaa58
cleanup tests
codabrink Oct 23, 2024
569b5f1
Merge remote-tracking branch 'origin/main' into coda/sync-consent
codabrink Oct 23, 2024
e1aea60
fix
codabrink Oct 23, 2024
3aab77c
more cleanup
codabrink Oct 23, 2024
db1b05d
kv query optional
codabrink Oct 23, 2024
c25ece7
this test was bad
codabrink Oct 23, 2024
49a9054
explain
codabrink Oct 23, 2024
abe1b33
check the pin
codabrink Oct 23, 2024
4406bfc
update cli client
codabrink Oct 23, 2024
2e3794b
fix a test
codabrink Oct 23, 2024
56f7010
fix another test
codabrink Oct 23, 2024
a2d67f4
fix kvstore get
codabrink Oct 23, 2024
4837d69
remove feature flag
codabrink Oct 23, 2024
e3c9851
lint
codabrink Oct 23, 2024
12d172d
lint
codabrink Oct 23, 2024
f14177e
Merge remote-tracking branch 'origin/main' into coda/sync-consent
codabrink Oct 24, 2024
c30d946
query update
codabrink Oct 24, 2024
c52aa7b
wip
codabrink Oct 24, 2024
a79b67a
consent sync test
codabrink Oct 24, 2024
c3a21f3
test cleanup
codabrink Oct 24, 2024
b4613db
borrow consent records
codabrink Oct 24, 2024
cc9d8f4
borrow, borrow, borrow
codabrink Oct 24, 2024
b4f71e2
finish message sync test
codabrink Oct 24, 2024
3fbf567
lint and naming
codabrink Oct 24, 2024
33db6cf
add to cli
codabrink Oct 24, 2024
c3c1e06
bench
codabrink Oct 24, 2024
8fd4616
lint
codabrink Oct 24, 2024
c687a26
lint
codabrink Oct 24, 2024
8292893
revert
codabrink Oct 24, 2024
9ea4813
update protos
codabrink Oct 24, 2024
69aa601
remove kv store
codabrink Oct 28, 2024
fc52e43
revert
codabrink Oct 28, 2024
72d007e
add time slip limit
codabrink Oct 28, 2024
30ea84d
dedup
codabrink Oct 28, 2024
4fe3c39
Merge remote-tracking branch 'origin/main' into coda/sync-consent
codabrink Oct 28, 2024
8a4c3c6
better serialization and parsing
codabrink Oct 28, 2024
a5fbc97
update enc
codabrink Oct 28, 2024
0654eaf
maybe insert consent record
codabrink Oct 28, 2024
cef173c
add a test
codabrink Oct 28, 2024
ea33bd2
test a bit more
codabrink Oct 28, 2024
03de5e3
do not ignore tests
codabrink Oct 28, 2024
4872981
revert
codabrink Oct 28, 2024
9f410e5
revert
codabrink Oct 29, 2024
4cc8d6d
Simplify logic
codabrink Oct 29, 2024
8ad73aa
function name update
codabrink Oct 29, 2024
55cf96e
tweak reply flow
codabrink Oct 29, 2024
a59284a
make diesel happy
codabrink Oct 29, 2024
4b234d2
conn as a param
codabrink Oct 30, 2024
81bcf48
cleanup
codabrink Oct 30, 2024
7224f6c
Merge remote-tracking branch 'origin/main' into coda/sync-consent
codabrink Oct 30, 2024
bb232f7
lint
codabrink Oct 30, 2024
76b11bb
more store refs
codabrink Oct 30, 2024
a34a634
nits
codabrink Oct 30, 2024
7f86f0a
cleanup
codabrink Oct 30, 2024
932e95c
fix test
codabrink Oct 30, 2024
68c1d4e
cleanup
codabrink Oct 30, 2024
355e960
lint
codabrink Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

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

6 changes: 2 additions & 4 deletions bindings_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ uniffi = { version = "0.28.0", default-features = false, features = ["tokio"] }
xmtp_api_grpc = { path = "../xmtp_api_grpc" }
xmtp_cryptography = { path = "../xmtp_cryptography" }
xmtp_id = { path = "../xmtp_id" }
xmtp_mls = { path = "../xmtp_mls", features = ["message-history"] }
xmtp_mls = { path = "../xmtp_mls" }
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] }
xmtp_user_preferences = { path = "../xmtp_user_preferences" }
xmtp_v2 = { path = "../xmtp_v2" }
tonic.workspace = true

[build-dependencies]
uniffi = { version = "0.28.0", features = ["build"] }
Expand All @@ -37,7 +36,6 @@ rand.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread"] }
uniffi = { version = "0.28.0", features = ["bindgen-tests"] }
uuid = { workspace = true, features = ["v4", "fast-rng"] }
xmtp_api_grpc = { path = "../xmtp_api_grpc", features = ["test-utils"] }
xmtp_mls = { path = "../xmtp_mls", features = ["test-utils"] }
xmtp_proto = { path = "../xmtp_proto", features = ["test-utils"] }
xmtp_api_grpc = { path = "../xmtp_api_grpc", features = ["test-utils"] }

18 changes: 10 additions & 8 deletions bindings_ffi/src/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl FfiXmtpClient {
) -> Result<HashMap<String, bool>, GenericError> {
let inner = self.inner_client.as_ref();

let results: HashMap<String, bool> = inner.can_message(account_addresses).await?;
let results: HashMap<String, bool> = inner.can_message(&account_addresses).await?;

Ok(results)
}
Expand Down Expand Up @@ -353,7 +353,7 @@ impl FfiXmtpClient {
let stored_records: Vec<StoredConsentRecord> =
records.into_iter().map(StoredConsentRecord::from).collect();

inner.set_consent_states(stored_records).await?;
inner.set_consent_states(&stored_records).await?;
Ok(())
}

Expand Down Expand Up @@ -398,7 +398,7 @@ impl FfiXmtpClient {

pub async fn request_history_sync(&self) -> Result<(), GenericError> {
self.inner_client
.send_history_request()
.send_history_sync_request()
.await
.map_err(GenericError::from_error)?;
Ok(())
Expand Down Expand Up @@ -790,7 +790,7 @@ impl FfiConversations {
.create_group(group_permissions, metadata_options)?
} else {
self.inner_client
.create_group_with_members(account_addresses, group_permissions, metadata_options)
.create_group_with_members(&account_addresses, group_permissions, metadata_options)
.await?
};

Expand Down Expand Up @@ -1206,7 +1206,8 @@ impl FfiConversation {

pub async fn add_members(&self, account_addresses: Vec<String>) -> Result<(), GenericError> {
log::info!("adding members: {}", account_addresses.join(","));
self.inner.add_members(account_addresses).await?;

self.inner.add_members(&account_addresses).await?;

Ok(())
}
Expand All @@ -1216,15 +1217,16 @@ impl FfiConversation {
inbox_ids: Vec<String>,
) -> Result<(), GenericError> {
log::info!("adding members by inbox id: {}", inbox_ids.join(","));

self.inner
.add_members_by_inbox_id(inbox_ids)
.add_members_by_inbox_id(&inbox_ids)
.await
.map_err(Into::into)
}

pub async fn remove_members(&self, account_addresses: Vec<String>) -> Result<(), GenericError> {
self.inner
.remove_members(account_addresses)
.remove_members(&account_addresses)
.await
.map_err(Into::into)
}
Expand All @@ -1233,7 +1235,7 @@ impl FfiConversation {
&self,
inbox_ids: Vec<String>,
) -> Result<(), GenericError> {
self.inner.remove_members_by_inbox_id(inbox_ids).await?;
self.inner.remove_members_by_inbox_id(&inbox_ids).await?;
Ok(())
}

Expand Down
13 changes: 8 additions & 5 deletions bindings_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ crate-type = ["cdylib"]
[dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
hex.workspace = true
napi = { version = "2.12.2", default-features = false, features = ["napi6", "async"] }
napi = { version = "2.12.2", default-features = false, features = [
"napi6",
"async",
] }
napi-derive = "2.12.2"
tracing.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
prost.workspace = true
tokio = { workspace = true, features = ["sync"]}
tokio = { workspace = true, features = ["sync"] }
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
tracing.workspace = true
xmtp_api_grpc = { path = "../xmtp_api_grpc" }
xmtp_cryptography = { path = "../xmtp_cryptography" }
xmtp_id = { path = "../xmtp_id" }
xmtp_mls = { path = "../xmtp_mls", features = ["message-history"]}
xmtp_mls = { path = "../xmtp_mls" }
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] }

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion bindings_node/src/conversations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl NapiConversations {
} else {
self
.inner_client
.create_group_with_members(account_addresses, group_permissions, metadata_options)
.create_group_with_members(&account_addresses, group_permissions, metadata_options)
.await
.map_err(|e| Error::from_reason(format!("ClientError: {}", e)))?
};
Expand Down
8 changes: 4 additions & 4 deletions bindings_node/src/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl NapiGroup {
);

group
.add_members(account_addresses)
.add_members(&account_addresses)
.await
.map_err(ErrorWrapper::from)?;

Expand Down Expand Up @@ -386,7 +386,7 @@ impl NapiGroup {
);

group
.add_members_by_inbox_id(inbox_ids)
.add_members_by_inbox_id(&inbox_ids)
.await
.map_err(ErrorWrapper::from)?;

Expand All @@ -402,7 +402,7 @@ impl NapiGroup {
);

group
.remove_members(account_addresses)
.remove_members(&account_addresses)
.await
.map_err(ErrorWrapper::from)?;

Expand All @@ -418,7 +418,7 @@ impl NapiGroup {
);

group
.remove_members_by_inbox_id(inbox_ids)
.remove_members_by_inbox_id(&inbox_ids)
.await
.map_err(ErrorWrapper::from)?;

Expand Down
6 changes: 3 additions & 3 deletions bindings_node/src/mls_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl NapiClient {
pub async fn can_message(&self, account_addresses: Vec<String>) -> Result<HashMap<String, bool>> {
let results: HashMap<String, bool> = self
.inner_client
.can_message(account_addresses)
.can_message(&account_addresses)
insipx marked this conversation as resolved.
Show resolved Hide resolved
.await
.map_err(ErrorWrapper::from)?;

Expand Down Expand Up @@ -228,7 +228,7 @@ impl NapiClient {
pub async fn request_history_sync(&self) -> Result<()> {
let _ = self
.inner_client
.send_history_request()
.send_history_sync_request()
.await
.map_err(ErrorWrapper::from);

Expand Down Expand Up @@ -411,7 +411,7 @@ impl NapiClient {
records.into_iter().map(StoredConsentRecord::from).collect();

inner
.set_consent_states(stored_records)
.set_consent_states(&stored_records)
codabrink marked this conversation as resolved.
Show resolved Hide resolved
.await
.map_err(ErrorWrapper::from)?;
Ok(())
Expand Down
13 changes: 2 additions & 11 deletions bindings_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ wasm-bindgen.workspace = true
xmtp_api_http = { path = "../xmtp_api_http" }
xmtp_cryptography = { path = "../xmtp_cryptography" }
xmtp_id = { path = "../xmtp_id" }
xmtp_mls = { path = "../xmtp_mls", features = [
"message-history",
"test-utils",
"http-api"
] }
xmtp_mls = { path = "../xmtp_mls", features = ["test-utils", "http-api"] }
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] }

[dev-dependencies]
wasm-bindgen-test.workspace = true
xmtp_mls = { path = "../xmtp_mls", features = [
"message-history",
"test-utils",
"http-api"
] }

xmtp_mls = { path = "../xmtp_mls", features = ["test-utils", "http-api"] }
2 changes: 1 addition & 1 deletion bindings_wasm/src/conversations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl WasmConversations {
} else {
self
.inner_client
.create_group_with_members(account_addresses, group_permissions, metadata_options)
.create_group_with_members(&account_addresses, group_permissions, metadata_options)
codabrink marked this conversation as resolved.
Show resolved Hide resolved
.await
.map_err(|e| JsError::new(format!("{}", e).as_str()))?
};
Expand Down
8 changes: 4 additions & 4 deletions bindings_wasm/src/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl WasmGroup {
);

group
.add_members(account_addresses)
.add_members(&account_addresses)
.await
.map_err(|e| JsError::new(&format!("{e}")))?;

Expand Down Expand Up @@ -387,7 +387,7 @@ impl WasmGroup {
);

group
.add_members_by_inbox_id(inbox_ids)
.add_members_by_inbox_id(&inbox_ids)
.await
.map_err(|e| JsError::new(&format!("{e}")))?;

Expand All @@ -403,7 +403,7 @@ impl WasmGroup {
);

group
.remove_members(account_addresses)
.remove_members(&account_addresses)
.await
.map_err(|e| JsError::new(&format!("{e}")))?;

Expand All @@ -419,7 +419,7 @@ impl WasmGroup {
);

group
.remove_members_by_inbox_id(inbox_ids)
.remove_members_by_inbox_id(&inbox_ids)
.await
.map_err(|e| JsError::new(&format!("{e}")))?;

Expand Down
6 changes: 3 additions & 3 deletions bindings_wasm/src/mls_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl WasmClient {
pub async fn can_message(&self, account_addresses: Vec<String>) -> Result<JsValue, JsError> {
let results: HashMap<String, bool> = self
.inner_client
.can_message(account_addresses)
.can_message(&account_addresses)
.await
.map_err(|e| JsError::new(format!("{}", e).as_str()))?;

Expand Down Expand Up @@ -289,7 +289,7 @@ impl WasmClient {
pub async fn request_history_sync(&self) -> Result<(), JsError> {
let _ = self
.inner_client
.send_history_request()
.send_history_sync_request()
.await
.map_err(|e| JsError::new(format!("{}", e).as_str()))?;

Expand Down Expand Up @@ -345,7 +345,7 @@ impl WasmClient {
records.into_iter().map(StoredConsentRecord::from).collect();

inner
.set_consent_states(stored_records)
.set_consent_states(&stored_records)
.await
.map_err(|e| JsError::new(format!("{}", e).as_str()))?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ tokio = "1.28.1"
xmtp_api_grpc = { path = "../../xmtp_api_grpc" }
xmtp_cryptography = { path = "../../xmtp_cryptography" }
xmtp_id = { path = "../../xmtp_id" }
xmtp_mls = { path = "../../xmtp_mls", features = ["message-history"]}
xmtp_mls = { path = "../../xmtp_mls" }
xmtp_proto = { path = "../../xmtp_proto", features = ["proto_full"] }
Loading