-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Sajjon/infra
Showing
17 changed files
with
169 additions
and
228 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[all] | ||
exclude-files = ["src/existing_types_in_sargon.rs"] | ||
verbose = false | ||
force-clean = true | ||
timeout = "2m" | ||
locked = true | ||
all-features = true | ||
jobs = 1 | ||
out = ["html"] |
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 |
---|---|---|
@@ -1 +1 @@ | ||
[![Average](https://codecov.io/gh/sajjon/one-does-not-simply-sign/graph/badge.svg?token=8QPKIUSAQD)](https://codecov.io/github/sajjon/one-does-not-simply-sign) | ||
[![codecov](https://codecov.io/github/Sajjon/one-does-not-simply-sign/branch/main/graph/badge.svg?token=PTFupnAjyZ)](https://codecov.io/github/Sajjon/one-does-not-simply-sign) |
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,19 @@ | ||
codecov: | ||
notify: | ||
wait_for_ci: true | ||
max_report_age: off | ||
require_ci_to_pass: true | ||
comment: | ||
behavior: default | ||
layout: "reach, diff, flags, files" | ||
show_carryforward_flags: false | ||
coverage: | ||
precision: 1 | ||
range: 80...98 # red -> yellow (the inside range) -> green | ||
status: | ||
patch: | ||
default: | ||
target: auto | ||
threshold: 80% | ||
base: auto | ||
only_pulls: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use crate::prelude::*; | ||
|
||
/// A signature of `intent_hash` by `entity` using `factor_source_id` and `derivation_path`, with `public_key` used for verification. | ||
#[derive(Clone, PartialEq, Eq, Hash, derive_more::Debug)] | ||
#[debug("HDSignature {{ instance: {:?} }}", owned_factor_instance)] | ||
pub struct HDSignature { | ||
/// Hash which was signed. | ||
pub intent_hash: IntentHash, | ||
|
||
/// The ECDSA/EdDSA signature produced by the private key of the | ||
/// `owned_hd_factor_instance.public_key`, | ||
/// derived by the FactorSource identified by | ||
/// `owned_hd_factor_instance.factor_source_id` and which | ||
/// was derived at `owned_hd_factor_instance.derivation_path`. | ||
pub signature: Signature, | ||
|
||
/// The account or identity address of the entity which signed the hash, | ||
/// with expected public key and with derivation path to derive PrivateKey | ||
/// with. | ||
pub owned_factor_instance: OwnedFactorInstance, | ||
} |
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,18 @@ | ||
use crate::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, std::hash::Hash)] | ||
pub struct InvalidTransactionIfSkipped { | ||
pub intent_hash: IntentHash, | ||
pub entities_which_would_fail_auth: Vec<AccountAddressOrIdentityAddress>, | ||
} | ||
impl InvalidTransactionIfSkipped { | ||
pub fn new( | ||
intent_hash: IntentHash, | ||
entities_which_would_fail_auth: Vec<AccountAddressOrIdentityAddress>, | ||
) -> Self { | ||
Self { | ||
intent_hash, | ||
entities_which_would_fail_auth, | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::prelude::*; | ||
|
||
#[derive(Clone, PartialEq, Eq, std::hash::Hash, derive_more::Debug)] | ||
#[debug("{:?}: {:?}", owner, value)] | ||
pub struct Owned<T> { | ||
pub owner: AccountAddressOrIdentityAddress, | ||
pub value: T, | ||
} | ||
|
||
impl<T> Owned<T> { | ||
pub fn new(owner: AccountAddressOrIdentityAddress, value: T) -> Self { | ||
Self { owner, value } | ||
} | ||
} |
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,21 @@ | ||
use std::borrow::Borrow; | ||
|
||
use crate::prelude::*; | ||
|
||
pub type OwnedFactorInstance = Owned<FactorInstance>; | ||
|
||
impl OwnedFactorInstance { | ||
pub fn owned_factor_instance( | ||
owner: AccountAddressOrIdentityAddress, | ||
factor_instance: FactorInstance, | ||
) -> Self { | ||
Self::new(owner, factor_instance) | ||
} | ||
pub fn factor_instance(&self) -> &FactorInstance { | ||
&self.value | ||
} | ||
pub fn by_factor_source(&self, factor_source_id: impl Borrow<FactorSourceID>) -> bool { | ||
let factor_source_id = factor_source_id.borrow(); | ||
self.factor_instance().factor_source_id() == *factor_source_id | ||
} | ||
} |
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,22 @@ | ||
use crate::prelude::*; | ||
|
||
pub type OwnedMatrixOfFactorInstances = Owned<MatrixOfFactorInstances>; | ||
|
||
impl OwnedMatrixOfFactorInstances { | ||
pub fn owned_matrix( | ||
owner: AccountAddressOrIdentityAddress, | ||
matrix: MatrixOfFactorInstances, | ||
) -> Self { | ||
Self::new(owner, matrix) | ||
} | ||
} | ||
|
||
impl From<&Entity> for OwnedMatrixOfFactorInstances { | ||
fn from(value: &Entity) -> Self { | ||
let matrix = match value.security_state.clone() { | ||
EntitySecurityState::Securified(matrix) => matrix.clone(), | ||
EntitySecurityState::Unsecured(instance) => MatrixOfFactorInstances::from(instance), | ||
}; | ||
OwnedMatrixOfFactorInstances::owned_matrix(value.address.clone(), matrix) | ||
} | ||
} |
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