Skip to content

Commit

Permalink
Add toy implementation of association rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Mar 29, 2024
1 parent d9b67d8 commit dfe9edf
Show file tree
Hide file tree
Showing 8 changed files with 886 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

4 changes: 1 addition & 3 deletions bindings_ffi/Cargo.lock

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

2 changes: 2 additions & 0 deletions xmtp_id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ prost.workspace = true
tls_codec.workspace = true
chrono.workspace = true
serde.workspace = true
sha2 = "0.10.8"
rand.workspace = true
42 changes: 42 additions & 0 deletions xmtp_id/src/associations/entity.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#[derive(Clone, Debug, PartialEq)]
pub enum EntityRole {
Installation,
Address,
LegacyKey,
}

#[derive(Clone, Debug)]
pub struct Entity {
pub role: EntityRole,
pub id: String,
pub is_revoked: bool,
}

impl Entity {
pub fn new(role: EntityRole, id: String, is_revoked: bool) -> Self {
Self {
role,
id,
is_revoked,
}
}
}

#[cfg(test)]
mod tests {
use crate::associations::test_utils;

use super::*;

use test_utils::rand_string;

impl Default for Entity {
fn default() -> Self {
Self {
role: EntityRole::Address,
id: rand_string(),
is_revoked: false,
}
}
}
}
Loading

0 comments on commit dfe9edf

Please sign in to comment.