diff --git a/Cargo.lock b/Cargo.lock index 6353e8cdb..f9371774a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2761,7 +2761,7 @@ dependencies = [ [[package]] name = "sargon" -version = "1.1.89" +version = "1.1.90" dependencies = [ "actix-rt", "aes-gcm", @@ -2816,7 +2816,7 @@ dependencies = [ [[package]] name = "sargon-uniffi" -version = "1.1.89" +version = "1.1.90" dependencies = [ "actix-rt", "assert-json-diff", diff --git a/crates/sargon-uniffi/Cargo.toml b/crates/sargon-uniffi/Cargo.toml index 2d6add444..49b730d94 100644 --- a/crates/sargon-uniffi/Cargo.toml +++ b/crates/sargon-uniffi/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sargon-uniffi" # Don't forget to update version in crates/sargon/Cargo.toml -version = "1.1.89" +version = "1.1.90" edition = "2021" build = "build.rs" diff --git a/crates/sargon-uniffi/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs b/crates/sargon-uniffi/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs index 4883614ab..23e739f41 100644 --- a/crates/sargon-uniffi/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs +++ b/crates/sargon-uniffi/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs @@ -7,4 +7,10 @@ pub enum FactorSourceIntegrity { Device(DeviceFactorSourceIntegrity), Ledger(LedgerHardwareWalletFactorSource), + + OffDeviceMnemonic(OffDeviceMnemonicFactorSource), + + ArculusCard(ArculusCardFactorSource), + + Password(PasswordFactorSource), } diff --git a/crates/sargon/Cargo.toml b/crates/sargon/Cargo.toml index ec5abe96a..e6aa0939e 100644 --- a/crates/sargon/Cargo.toml +++ b/crates/sargon/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sargon" # Don't forget to update version in crates/sargon-uniffi/Cargo.toml -version = "1.1.89" +version = "1.1.90" edition = "2021" build = "build.rs" diff --git a/crates/sargon/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs b/crates/sargon/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs index 1802d0725..05f9f40f9 100644 --- a/crates/sargon/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs +++ b/crates/sargon/src/profile/v100/entities_linked_to_factor_source/integrity/integrity.rs @@ -6,15 +6,43 @@ pub enum FactorSourceIntegrity { Device(DeviceFactorSourceIntegrity), Ledger(LedgerHardwareWalletFactorSource), + + OffDeviceMnemonic(OffDeviceMnemonicFactorSource), + + ArculusCard(ArculusCardFactorSource), + + Password(PasswordFactorSource), } impl HasSampleValues for FactorSourceIntegrity { fn sample() -> Self { - Self::Device(DeviceFactorSourceIntegrity::sample()) + Self::sample_device() } fn sample_other() -> Self { - Self::Ledger(LedgerHardwareWalletFactorSource::sample()) + Self::sample_ledger() + } +} + +impl FactorSourceIntegrity { + pub fn sample_device() -> Self { + DeviceFactorSourceIntegrity::sample().into() + } + + pub fn sample_ledger() -> Self { + LedgerHardwareWalletFactorSource::sample().into() + } + + pub fn sample_off_device_mnemonic() -> Self { + OffDeviceMnemonicFactorSource::sample().into() + } + + pub fn sample_arculus_card() -> Self { + ArculusCardFactorSource::sample().into() + } + + pub fn sample_password() -> Self { + PasswordFactorSource::sample().into() } } @@ -30,6 +58,24 @@ impl From for FactorSourceIntegrity { } } +impl From for FactorSourceIntegrity { + fn from(value: OffDeviceMnemonicFactorSource) -> Self { + Self::OffDeviceMnemonic(value) + } +} + +impl From for FactorSourceIntegrity { + fn from(value: ArculusCardFactorSource) -> Self { + Self::ArculusCard(value) + } +} + +impl From for FactorSourceIntegrity { + fn from(value: PasswordFactorSource) -> Self { + Self::Password(value) + } +} + #[cfg(test)] mod tests { use super::*; @@ -60,4 +106,28 @@ mod tests { LedgerHardwareWalletFactorSource::sample().into() ) } + + #[test] + fn from_off_device_mnemonic() { + assert_eq!( + SUT::sample_off_device_mnemonic(), + OffDeviceMnemonicFactorSource::sample().into() + ) + } + + #[test] + fn from_arculus_card() { + assert_eq!( + SUT::sample_arculus_card(), + ArculusCardFactorSource::sample().into() + ) + } + + #[test] + fn from_password() { + assert_eq!( + SUT::sample_password(), + PasswordFactorSource::sample().into() + ) + } }