-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
7a9e0e2
to
40acef4
Compare
… of roles and matrices - with UniFFI implementation.
crates/rules-uniffi/src/builder.rs
Outdated
#[uniffi::export(Debug, Eq, Hash)] | ||
pub struct SecurityStructureOfFactorSourceIds { | ||
wrapped_matrix: MatrixWithFactorSourceIds, | ||
name: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will have an ID as well... the models here in this crate is not 100% accurate yet. What I want reviewed is probably just the implementation of the wrapping? And the API
self.with(|builder| builder.add_factor_source_to_primary_threshold(factor_source_id.inner)) | ||
} | ||
|
||
pub fn add_factor_source_to_primary_override( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO doc all methods ofc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im about to write unit tests for this file/cratel Currently I just have one ensuring it works...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO Document API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont miss, many tests here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Add unit tests for JSON !
crates/rules/src/move_to_sargon.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
irrelevant file, can skip review
use crate::prelude::*; | ||
|
||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] | ||
pub struct AbstractRoleBuilderOrBuilt<F, T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO Document!
} | ||
} | ||
|
||
impl RoleBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neither method on the RoleBuilder
is meant to be pub
the idea is that hosts always use a single MatrixBuilder
(ShieldBuilder)` and which expose the needed APIs.
} | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, thiserror::Error)] | ||
pub enum NotYetValidReason { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In earlier implementations I had one error
enum type for each Role, maybe that makes sense, not sure. It results in many more types and more complex translation into RoleBuilderValidation
so I deemed it not worth it.
Furtermore, all these violations are "ephemeral" in the sense that they ALL will be translated into CommonError
at some point in time...
} | ||
|
||
#[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
pub struct FactorSourceInRoleBuilderValidationStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Split out and document
use NotYetValidReason::*; | ||
use RoleKind::*; | ||
|
||
impl RoleBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont miss, many tests :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall as a structure this looks very good 😍!
I didn't review the very thoroughly in regards to how the rules logic is applied, let me know if you want that.
So I have only one comment to clarify.
… for validate/build.
Const role
Important
Implementation of rules laid out in doc
I have NOT yet implemented "Automatic Security Shield Construction"
That will come in a coming PR.
Note
LOC delta is misleading, of the actual 5k code, 3k is unit tests, so "only" cirka 2k lines of PROD code.