-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SigningManagerDependencies and SaverOfIntentsToConfirmAfterDelay
- Loading branch information
Showing
19 changed files
with
187 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
crates/system/os/os/src/saver_of_intents_to_confirm_after_delay.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use manifests::IntentVariantToConfirmAfterDelay; | ||
|
||
use crate::prelude::*; | ||
|
||
/// A trait used to save intents to confirm after a delay. | ||
/// We save these intents to confirm after a delay so that we can confirm them after a delay. | ||
#[async_trait::async_trait] | ||
pub trait SaverOfIntentsToConfirmAfterDelay: Send + Sync { | ||
async fn save_intents_to_confirm_after_delay( | ||
&self, | ||
intents: IndexSet<IntentVariantToConfirmAfterDelay>, | ||
) -> Result<()>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
crates/system/os/transaction/src/signing_manager/manager/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
crates/system/os/transaction/src/signing_manager/manager/signing_manager_dependencies.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::prelude::*; | ||
|
||
pub(crate) struct SigningManagerDependencies { | ||
/// FactorSources in Profile | ||
pub(super) factor_sources_in_profile: IndexSet<FactorSource>, | ||
pub(super) interactor: Arc<dyn SignInteractor<TransactionIntent>>, | ||
pub(super) saver_of_intents_to_confirm_after_delay: | ||
Arc<dyn SaverOfIntentsToConfirmAfterDelay>, | ||
} | ||
|
||
impl SigningManagerDependencies { | ||
pub(crate) fn new( | ||
factor_sources_in_profile: IndexSet<FactorSource>, | ||
interactor: Arc<dyn SignInteractor<TransactionIntent>>, | ||
saver_of_intents_to_confirm_after_delay: Arc< | ||
dyn SaverOfIntentsToConfirmAfterDelay, | ||
>, | ||
) -> Self { | ||
Self { | ||
factor_sources_in_profile, | ||
interactor, | ||
saver_of_intents_to_confirm_after_delay, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
crates/system/os/transaction/src/signing_manager/models/intent_variant.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...nsaction/manifests/src/manifests_security_shield/intent_variant_to_confirm_after_delay.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::prelude::*; | ||
|
||
#[derive(Clone, PartialEq, Eq, StdHash, Debug)] | ||
pub struct IntentVariantToConfirmAfterDelay { | ||
pub role_which_initiated_recovery: RoleInitiatingRecovery, | ||
pub intent: TransactionIntent, | ||
pub entity_applying_shield: AddressOfAccountOrPersona, | ||
/// The time user has to wait after this intent has been broadcasted to | ||
/// the network before recovery can be confirmed. | ||
pub number_of_minutes_until_confirm_is_callable: u32, | ||
} | ||
|
||
impl IntentVariantToConfirmAfterDelay { | ||
pub fn new( | ||
role_which_initiated_recovery: impl Into<RoleInitiatingRecovery>, | ||
intent: TransactionIntent, | ||
entity_applying_shield: AddressOfAccountOrPersona, | ||
number_of_minutes_until_confirm_is_callable: u32, | ||
) -> Self { | ||
let role_which_initiated_recovery = | ||
role_which_initiated_recovery.into(); | ||
Self { | ||
role_which_initiated_recovery, | ||
intent, | ||
entity_applying_shield, | ||
number_of_minutes_until_confirm_is_callable, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters