Skip to content

Commit cc842c5

Browse files
committed
Add toy implementation of association rollup
1 parent 9f8184c commit cc842c5

File tree

7 files changed

+895
-11
lines changed

7 files changed

+895
-11
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xmtp_id/Cargo.toml

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
[package]
2+
edition = "2021"
23
name = "xmtp_id"
34
version = "0.1.0"
4-
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9+
async-trait.workspace = true
10+
chrono.workspace = true
11+
futures.workspace = true
912
log.workspace = true
10-
tracing.workspace = true
11-
thiserror.workspace = true
12-
xmtp_cryptography.workspace = true
13-
xmtp_mls.workspace = true
14-
xmtp_proto.workspace = true
15-
openmls_traits.workspace = true
1613
openmls.workspace = true
1714
openmls_basic_credential.workspace = true
1815
openmls_rust_crypto.workspace = true
16+
openmls_traits.workspace = true
1917
prost.workspace = true
20-
chrono.workspace = true
18+
rand.workspace = true
2119
serde.workspace = true
22-
async-trait.workspace = true
23-
futures.workspace = true
24-
20+
sha2 = "0.10.8"
21+
thiserror.workspace = true
22+
tracing.workspace = true
23+
xmtp_cryptography.workspace = true
24+
xmtp_mls.workspace = true
25+
xmtp_proto.workspace = true

xmtp_id/src/associations/entity.rs

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#[derive(Clone, Debug, PartialEq)]
2+
pub enum EntityRole {
3+
Installation,
4+
Address,
5+
LegacyKey,
6+
}
7+
8+
#[derive(Clone, Debug)]
9+
pub struct Entity {
10+
pub role: EntityRole,
11+
pub id: String,
12+
pub is_revoked: bool,
13+
}
14+
15+
impl Entity {
16+
pub fn new(role: EntityRole, id: String, is_revoked: bool) -> Self {
17+
Self {
18+
role,
19+
id,
20+
is_revoked,
21+
}
22+
}
23+
}
24+
25+
#[cfg(test)]
26+
mod tests {
27+
use crate::associations::test_utils;
28+
29+
use super::*;
30+
31+
use test_utils::rand_string;
32+
33+
impl Default for Entity {
34+
fn default() -> Self {
35+
Self {
36+
role: EntityRole::Address,
37+
id: rand_string(),
38+
is_revoked: false,
39+
}
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)