-
Notifications
You must be signed in to change notification settings - Fork 1
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
FIP: Support mix of Accounts & Personas #306
FIP: Support mix of Accounts & Personas #306
Conversation
…to ac/mix_persona_and_accounts_in_factor_instances_provider
...src/factor_instances_provider/provider/outcome/internal_factor_instances_provider_outcome.rs
Show resolved
Hide resolved
crates/sargon/src/factor_instances_provider/agnostic_paths/quantified_derivation_preset.rs
Outdated
Show resolved
Hide resolved
...s/sargon/src/factor_instances_provider/provider/outcome/factor_instances_provider_outcome.rs
Show resolved
Hide resolved
...src/factor_instances_provider/provider/outcome/internal_factor_instances_provider_outcome.rs
Outdated
Show resolved
Hide resolved
...src/factor_instances_provider/provider/outcome/internal_factor_instances_provider_outcome.rs
Outdated
Show resolved
Hide resolved
...src/factor_instances_provider/provider/outcome/internal_factor_instances_provider_outcome.rs
Outdated
Show resolved
Hide resolved
...r_instances_provider/provider/provider_adopters/securify_entity_factor_instances_provider.rs
Outdated
Show resolved
Hide resolved
...r_instances_provider/provider/provider_adopters/securify_entity_factor_instances_provider.rs
Outdated
Show resolved
Hide resolved
...r_instances_provider/provider/provider_adopters/securify_entity_factor_instances_provider.rs
Outdated
Show resolved
Hide resolved
/// unsecurified entities. For already securified entities we might not | ||
/// need to change the ROLA key. | ||
fn mfa_for_entities( | ||
addresses_of_entities: &IndexSet<AddressOfAccountOrPersona>, |
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 future when we support updating of Securified Entities we probably wanna change:
fn mfa_for_entities(
addresses_of_entities: &IndexSet<AddressOfAccountOrPersona>,
include_rola_key_for_each_entity: bool
) -> IdentifiedVecOf<Self>
into:
struct DeriveInstancesForEntityRequest {
entity_address: AddressOfAccountOrPersona,
need_new_rola: bool
}
fn mfa_for_entities(
requests: &IndexSet<DeriveInstancesForEntityRequest>,
) -> IdentifiedVecOf<Self>
/// When applying a security shield to an account, initiates keys collection | ||
/// When applying a security shield to accounts and personas mixed, initiates keys collection | ||
/// for account MFA | ||
SecurifyingAccountsAndPersonas, |
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.
@micbakos-rdx we will automatically select this as DerivationPurpose
if we are securifying both account and personas mixed - but as we have talked about in the past, host probably maps all keys to the same copy.
@@ -137,136 +154,220 @@ impl FactorInstancesProvider { | |||
|
|||
async fn derive_more_and_cache( |
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.
upgraded to be PER DerivationPreset and then PER FactorSource
@@ -5,15 +5,19 @@ use RoleKind::*; | |||
/// A tiny holder of factors for each Role. | |||
/// Used by the AutomaticShieldBuilder to keep track of which factors are assigned to which role. | |||
#[derive(Clone, Debug, PartialEq, Eq)] | |||
pub(super) struct ProtoMatrix { | |||
pub(super) struct ProtoShield { |
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 could act as a "state snapshot" of a SecurityShieldBuilder if we want. I.e. a UniFFI version of this. But needs name
added though. and maybe ID/metadata fields?
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.
LGTM! Nice work!
Left some minor comments.
@@ -23,6 +23,10 @@ pub enum DerivationPurpose { | |||
/// for identity MFA | |||
SecurifyingPersona, | |||
|
|||
/// When applying a security shield to accounts and personas mixed, initiates keys collection | |||
/// for account MFA | |||
SecurifyingAccountsAndPersonas, |
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.
Do we need the other two purposes above? Does SecurifyingAccountsAndPersonas
mean necessarily and
, or it can happen to have only accounts or personas?
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.
Yes if you only security account or only security personas those other are used.
But host will most likely map all variants to same Crowdin key anyway...
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 the host API, it will send a list of AccountOrPersona right? and then in Sargon you map to specific purpose based on the input, I think I've seen this logic in this PR.
@@ -135,6 +140,17 @@ impl SecurityShieldBuilder { | |||
self.set(|builder| builder.set_name(&name)); | |||
} | |||
|
|||
pub fn set_authentication_signing_factor( |
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.
For other factors we seem to follow add/remove
, any reason to not do the same 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.
Add / remove makes sense when we support multiple factors. This is always one single
FactorInstancesProvider
- FIP - does not support providing instances for a mix of DerivationPresets - meaning we cannot ask it for instance for accounts and personas mixed.Today one would need to do "two passes" to the FIP => bad UX since if the cache could not fully satisfied any requests => two passes to the KeysCollector (once per pass to the FIP).
What we want is a single pass to the KeysCollector in case of not enough instances in cache.
Thus what we need is to support multiple derivation presets queried.
Changes
NextDerivationEntityIndexProfileAnalysingAssigner
to analyse profile and return next derivation index forROLA factors.
authentication_signing_factor
fieldDevice
FactorSource asauthentication_signing
factor.CACHE_FILLING_QUANTITY
into one const per preset (they still have the same value: 30)Important
This PR does NOT validate the FactorSourceKind used for Authentication Signing Factor. So the SecurityShieldBuilder need to validate that. A tiny PR by anyone fixing this post getting this merged is welcome! See
owner
row in table https://radixdlt.atlassian.net/wiki/spaces/AT/pages/3758063620/MFA+Rules+for+Factors+and+Security+Shields#Factor-Type-Usage-Rules