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

Add toy implementation of association entry processing #605

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading