From 576645300a6215d884801941406c821c712af1b0 Mon Sep 17 00:00:00 2001 From: sergiupuhalschi-rdx <164897324+sergiupuhalschi-rdx@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:46:03 +0200 Subject: [PATCH] Update shield builder primary role validation (#353) * Allow multiple devices in primary role * Move threshold and override overlap validation to matrix builder * Revert unnecessary change * More tests * Release 1.1.115 account-for-display@1.1.115 addresses@1.1.115 assert-json@1.1.115 build-info@1.1.115 bytes@1.1.115 cap26-models@1.1.115 clients@1.1.115 core-collections@1.1.115 core-misc@1.1.115 core-utils@1.1.115 drivers@1.1.115 ecc@1.1.115 encryption@1.1.115 entity-by-address@1.1.115 entity-foundation@1.1.115 error@1.1.115 factor-instances-provider@1.1.115 factors@1.1.115 factors-supporting-types@1.1.115 gateway-client-and-api@1.1.115 gateway-models@1.1.115 has-sample-values@1.1.115 hash@1.1.115 hierarchical-deterministic@1.1.115 home-cards@1.1.115 host-info@1.1.115 http-client@1.1.115 identified-vec-of@1.1.115 interactors@1.1.115 key-derivation-traits@1.1.115 keys-collector@1.1.115 manifests@1.1.115 metadata@1.1.115 network@1.1.115 next-derivation-index-ephemeral@1.1.115 numeric@1.1.115 prelude@1.1.115 profile@1.1.115 profile-account@1.1.115 profile-account-or-persona@1.1.115 profile-app-preferences@1.1.115 profile-base-entity@1.1.115 profile-gateway@1.1.115 profile-logic@1.1.115 profile-persona@1.1.115 profile-persona-data@1.1.115 profile-security-structures@1.1.115 profile-state-holder@1.1.115 profile-supporting-types@1.1.115 radix-connect@1.1.115 radix-connect-models@1.1.115 sargon@1.1.115 sargon-os@1.1.115 sargon-os-accounts@1.1.115 sargon-os-factors@1.1.115 sargon-os-security-center@1.1.115 sargon-os-signing@1.1.115 sargon-os-transaction@1.1.115 sargon-uniffi@1.1.115 sargon-uniffi-conversion-macros@1.1.115 security-center@1.1.115 short-string@1.1.115 signing@1.1.115 signing-traits@1.1.115 sub-systems@1.1.115 time-utils@1.1.115 transaction-foundation@1.1.115 transaction-models@1.1.115 Generated by cargo-workspaces * Revert "Release 1.1.115" This reverts commit 2b8245499fb28543497c92dd47e4687d243c3b42. * Release 1.1.117 account-for-display@1.1.117 addresses@1.1.117 assert-json@1.1.117 build-info@1.1.117 bytes@1.1.117 cap26-models@1.1.117 clients@1.1.117 core-collections@1.1.117 core-misc@1.1.117 core-utils@1.1.117 drivers@1.1.117 ecc@1.1.117 encryption@1.1.117 entity-by-address@1.1.117 entity-foundation@1.1.117 error@1.1.117 factor-instances-provider@1.1.117 factors@1.1.117 factors-supporting-types@1.1.117 gateway-client-and-api@1.1.117 gateway-models@1.1.117 has-sample-values@1.1.117 hash@1.1.117 hierarchical-deterministic@1.1.117 home-cards@1.1.117 host-info@1.1.117 http-client@1.1.117 identified-vec-of@1.1.117 interactors@1.1.117 key-derivation-traits@1.1.117 keys-collector@1.1.117 manifests@1.1.117 metadata@1.1.117 network@1.1.117 next-derivation-index-ephemeral@1.1.117 numeric@1.1.117 prelude@1.1.117 profile@1.1.117 profile-account@1.1.117 profile-account-or-persona@1.1.117 profile-app-preferences@1.1.117 profile-base-entity@1.1.117 profile-gateway@1.1.117 profile-logic@1.1.117 profile-persona@1.1.117 profile-persona-data@1.1.117 profile-security-structures@1.1.117 profile-state-holder@1.1.117 profile-supporting-types@1.1.117 radix-connect@1.1.117 radix-connect-models@1.1.117 sargon@1.1.117 sargon-os@1.1.117 sargon-os-accounts@1.1.117 sargon-os-factors@1.1.117 sargon-os-security-center@1.1.117 sargon-os-signing@1.1.117 sargon-os-transaction@1.1.117 sargon-uniffi@1.1.117 sargon-uniffi-conversion-macros@1.1.117 security-center@1.1.117 short-string@1.1.117 signing@1.1.117 signing-traits@1.1.117 sub-systems@1.1.117 time-utils@1.1.117 transaction-foundation@1.1.117 transaction-models@1.1.117 Generated by cargo-workspaces --- Cargo.lock | 166 ++++++------- crates/app/home-cards/Cargo.toml | 2 +- crates/app/key-derivation-traits/Cargo.toml | 2 +- crates/app/radix-connect-models/Cargo.toml | 2 +- crates/app/radix-connect/Cargo.toml | 2 +- crates/app/security-center/Cargo.toml | 2 +- crates/app/signing-traits/Cargo.toml | 2 +- crates/app/signing/Cargo.toml | 2 +- crates/common/build-info/Cargo.toml | 2 +- crates/common/bytes/Cargo.toml | 2 +- crates/common/entity-foundation/Cargo.toml | 2 +- crates/common/host-info/Cargo.toml | 2 +- crates/common/identified-vec-of/Cargo.toml | 2 +- crates/common/metadata/Cargo.toml | 2 +- crates/common/network/Cargo.toml | 2 +- crates/common/numeric/Cargo.toml | 2 +- crates/common/short-string/Cargo.toml | 2 +- crates/core/assert-json/Cargo.toml | 2 +- crates/core/collections/Cargo.toml | 2 +- crates/core/error/Cargo.toml | 2 +- crates/core/has-sample-values/Cargo.toml | 2 +- crates/core/misc/Cargo.toml | 2 +- crates/core/prelude/Cargo.toml | 2 +- crates/core/time-utils/Cargo.toml | 2 +- crates/core/utils/Cargo.toml | 2 +- crates/crypto/addresses/Cargo.toml | 2 +- crates/crypto/cap26-models/Cargo.toml | 2 +- crates/crypto/ecc/Cargo.toml | 2 +- crates/crypto/encryption/Cargo.toml | 2 +- crates/crypto/hash/Cargo.toml | 2 +- crates/crypto/hd/Cargo.toml | 2 +- crates/factors/factors/Cargo.toml | 2 +- crates/factors/instances-provider/Cargo.toml | 2 +- crates/factors/keys-collector/Cargo.toml | 2 +- .../Cargo.toml | 2 +- crates/factors/supporting-types/Cargo.toml | 2 +- crates/gateway/client-and-api/Cargo.toml | 2 +- crates/gateway/models/Cargo.toml | 2 +- .../profile/logic/logic_SPLIT_ME/Cargo.toml | 2 +- .../models/account-for-display/Cargo.toml | 2 +- .../models/account-or-persona/Cargo.toml | 2 +- crates/profile/models/account/Cargo.toml | 2 +- .../profile/models/app-preferences/Cargo.toml | 2 +- crates/profile/models/base-entity/Cargo.toml | 2 +- crates/profile/models/gateway/Cargo.toml | 2 +- crates/profile/models/persona-data/Cargo.toml | 2 +- crates/profile/models/persona/Cargo.toml | 2 +- .../models/profile_SPLIT_ME/Cargo.toml | 2 +- .../models/security-structures/Cargo.toml | 2 +- .../matrices/builder/error.rs | 4 + .../matrices/builder/matrix_builder.rs | 58 ++++- .../builder/matrix_builder_unit_tests.rs | 138 ++--------- .../primary_roles_builder_unit_tests.rs | 9 +- .../roles/builder/roles_builder.rs | 82 ++----- .../security_shield_builder.rs | 220 +++++++++++++++--- .../security_shield_builder_rule_violation.rs | 11 +- .../models/supporting-types/Cargo.toml | 2 +- .../traits/entity-by-address/Cargo.toml | 2 +- crates/sargon/Cargo.toml | 2 +- crates/system/clients/clients/Cargo.toml | 2 +- crates/system/clients/http/Cargo.toml | 2 +- crates/system/drivers/Cargo.toml | 2 +- crates/system/interactors/Cargo.toml | 2 +- crates/system/os/accounts/Cargo.toml | 2 +- crates/system/os/factors/Cargo.toml | 2 +- crates/system/os/os/Cargo.toml | 2 +- crates/system/os/security-center/Cargo.toml | 2 +- crates/system/os/signing/Cargo.toml | 2 +- crates/system/os/transaction/Cargo.toml | 2 +- crates/system/profile-state-holder/Cargo.toml | 2 +- crates/system/sub-systems/Cargo.toml | 2 +- crates/transaction/foundation/Cargo.toml | 2 +- crates/transaction/manifests/Cargo.toml | 2 +- crates/transaction/models/Cargo.toml | 2 +- crates/uniffi/conversion-macros/Cargo.toml | 2 +- crates/uniffi/uniffi_SPLIT_ME/Cargo.toml | 2 +- .../security_shield_builder.rs | 25 +- 77 files changed, 459 insertions(+), 390 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7046bd31c..b79a8080a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "account-for-display" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "derive_more", @@ -49,10 +49,10 @@ dependencies = [ [[package]] name = "addresses" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", - "bytes 1.1.116", + "bytes 1.1.117", "cap26-models", "core-utils", "derive_more", @@ -246,7 +246,7 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "assert-json" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json-diff", "error", @@ -546,7 +546,7 @@ dependencies = [ [[package]] name = "build-info" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "cargo_toml", @@ -573,7 +573,7 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytes" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "delegate", @@ -607,7 +607,7 @@ dependencies = [ [[package]] name = "cap26-models" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "derive_more", @@ -748,7 +748,7 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "clients" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "async-trait", @@ -808,7 +808,7 @@ checksum = "0d8a42181e0652c2997ae4d217f25b63c5337a52fd2279736e97b832fa0a3cff" [[package]] name = "core-collections" -version = "1.1.116" +version = "1.1.117" dependencies = [ "has-sample-values", "indexmap 2.7.0", @@ -835,7 +835,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core-misc" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "core-utils", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "core-utils" -version = "1.1.116" +version = "1.1.117" dependencies = [ "error", "iso8601-timestamp", @@ -1084,7 +1084,7 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "drivers" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", @@ -1108,10 +1108,10 @@ dependencies = [ [[package]] name = "ecc" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", - "bytes 1.1.116", + "bytes 1.1.117", "derive_more", "enum-as-inner", "error", @@ -1210,11 +1210,11 @@ dependencies = [ [[package]] name = "encryption" -version = "1.1.116" +version = "1.1.117" dependencies = [ "aes-gcm", "assert-json", - "bytes 1.1.116", + "bytes 1.1.117", "derive_more", "error", "has-sample-values", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "entity-by-address" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "error", @@ -1243,7 +1243,7 @@ dependencies = [ [[package]] name = "entity-foundation" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "derive_more", @@ -1318,7 +1318,7 @@ dependencies = [ [[package]] name = "error" -version = "1.1.116" +version = "1.1.117" dependencies = [ "derive_more", "log", @@ -1377,7 +1377,7 @@ dependencies = [ [[package]] name = "factor-instances-provider" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", @@ -1403,9 +1403,9 @@ dependencies = [ [[package]] name = "factors" -version = "1.1.116" +version = "1.1.117" dependencies = [ - "bytes 1.1.116", + "bytes 1.1.117", "cap26-models", "core-collections", "core-misc", @@ -1440,7 +1440,7 @@ dependencies = [ [[package]] name = "factors-supporting-types" -version = "1.1.116" +version = "1.1.117" dependencies = [ "async-trait", "error", @@ -1593,7 +1593,7 @@ dependencies = [ [[package]] name = "gateway-client-and-api" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", @@ -1613,7 +1613,7 @@ dependencies = [ [[package]] name = "gateway-models" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "assert-json", @@ -1718,7 +1718,7 @@ dependencies = [ [[package]] name = "has-sample-values" -version = "1.1.116" +version = "1.1.117" dependencies = [ "error", "indexmap 2.7.0", @@ -1729,9 +1729,9 @@ dependencies = [ [[package]] name = "hash" -version = "1.1.116" +version = "1.1.117" dependencies = [ - "bytes 1.1.116", + "bytes 1.1.117", "derive_more", "prelude", "radix-common", @@ -1795,11 +1795,11 @@ dependencies = [ [[package]] name = "hierarchical-deterministic" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "bip39", - "bytes 1.1.116", + "bytes 1.1.117", "cap26-models", "derive_more", "ecc", @@ -1842,13 +1842,13 @@ dependencies = [ [[package]] name = "home-cards" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", "async-trait", "base64", - "bytes 1.1.116", + "bytes 1.1.117", "core-utils", "derive_more", "drivers", @@ -1868,7 +1868,7 @@ dependencies = [ [[package]] name = "host-info" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "derive_more", @@ -1915,10 +1915,10 @@ dependencies = [ [[package]] name = "http-client" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", - "bytes 1.1.116", + "bytes 1.1.117", "core-utils", "drivers", "error", @@ -2143,7 +2143,7 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "identified-vec-of" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "derive_more", @@ -2216,7 +2216,7 @@ dependencies = [ [[package]] name = "interactors" -version = "1.1.116" +version = "1.1.117" dependencies = [ "async-trait", "derive_more", @@ -2336,7 +2336,7 @@ dependencies = [ [[package]] name = "key-derivation-traits" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "async-trait", @@ -2354,7 +2354,7 @@ dependencies = [ [[package]] name = "keys-collector" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", @@ -2443,7 +2443,7 @@ dependencies = [ [[package]] name = "manifests" -version = "1.1.116" +version = "1.1.117" dependencies = [ "account-for-display", "addresses", @@ -2484,7 +2484,7 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "metadata" -version = "1.1.116" +version = "1.1.117" dependencies = [ "derive_more", "has-sample-values", @@ -2584,7 +2584,7 @@ dependencies = [ [[package]] name = "network" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", "enum-iterator", @@ -2600,7 +2600,7 @@ dependencies = [ [[package]] name = "next-derivation-index-ephemeral" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "assert-json", @@ -2676,9 +2676,9 @@ dependencies = [ [[package]] name = "numeric" -version = "1.1.116" +version = "1.1.117" dependencies = [ - "bytes 1.1.116", + "bytes 1.1.117", "delegate", "derive_more", "enum-iterator", @@ -2898,7 +2898,7 @@ dependencies = [ [[package]] name = "prelude" -version = "1.1.116" +version = "1.1.117" dependencies = [ "radix-engine", "radix-engine-toolkit", @@ -2935,7 +2935,7 @@ dependencies = [ [[package]] name = "profile" -version = "1.1.116" +version = "1.1.117" dependencies = [ "account-for-display", "addresses", @@ -2979,7 +2979,7 @@ dependencies = [ [[package]] name = "profile-account" -version = "1.1.116" +version = "1.1.117" dependencies = [ "account-for-display", "addresses", @@ -2999,7 +2999,7 @@ dependencies = [ [[package]] name = "profile-account-or-persona" -version = "1.1.116" +version = "1.1.117" dependencies = [ "cap26-models", "derive_more", @@ -3016,7 +3016,7 @@ dependencies = [ [[package]] name = "profile-app-preferences" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "core-misc", @@ -3039,7 +3039,7 @@ dependencies = [ [[package]] name = "profile-base-entity" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "derive_more", @@ -3062,7 +3062,7 @@ dependencies = [ [[package]] name = "profile-gateway" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "assert-json", @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "profile-logic" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "derive_more", @@ -3108,7 +3108,7 @@ dependencies = [ [[package]] name = "profile-persona" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "cap26-models", @@ -3129,7 +3129,7 @@ dependencies = [ [[package]] name = "profile-persona-data" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "assert-json", @@ -3148,7 +3148,7 @@ dependencies = [ [[package]] name = "profile-security-structures" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "cap26-models", @@ -3176,7 +3176,7 @@ dependencies = [ [[package]] name = "profile-state-holder" -version = "1.1.116" +version = "1.1.117" dependencies = [ "derive_more", "error", @@ -3191,7 +3191,7 @@ dependencies = [ [[package]] name = "profile-supporting-types" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "derive_more", @@ -3280,14 +3280,14 @@ dependencies = [ [[package]] name = "radix-connect" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", "assert-json", "async-trait", "base64", - "bytes 1.1.116", + "bytes 1.1.117", "core-misc", "core-utils", "derive_more", @@ -3315,10 +3315,10 @@ dependencies = [ [[package]] name = "radix-connect-models" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", - "bytes 1.1.116", + "bytes 1.1.117", "core-misc", "derive_more", "error", @@ -3760,7 +3760,7 @@ dependencies = [ [[package]] name = "sargon" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", @@ -3824,7 +3824,7 @@ dependencies = [ [[package]] name = "sargon-os" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "async-trait", @@ -3851,7 +3851,7 @@ dependencies = [ [[package]] name = "sargon-os-accounts" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", @@ -3874,7 +3874,7 @@ dependencies = [ [[package]] name = "sargon-os-factors" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "async-trait", @@ -3902,7 +3902,7 @@ dependencies = [ [[package]] name = "sargon-os-security-center" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "derive_more", @@ -3918,7 +3918,7 @@ dependencies = [ [[package]] name = "sargon-os-signing" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "async-trait", @@ -3944,7 +3944,7 @@ dependencies = [ [[package]] name = "sargon-os-transaction" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "async-std", @@ -3973,7 +3973,7 @@ dependencies = [ [[package]] name = "sargon-uniffi" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", @@ -4030,7 +4030,7 @@ dependencies = [ [[package]] name = "sargon-uniffi-conversion-macros" -version = "1.1.116" +version = "1.1.117" dependencies = [ "proc-macro2", "quote", @@ -4203,7 +4203,7 @@ dependencies = [ [[package]] name = "security-center" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", "assert-json", @@ -4371,7 +4371,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "short-string" -version = "1.1.116" +version = "1.1.117" dependencies = [ "arraystring", "assert-json", @@ -4406,13 +4406,13 @@ dependencies = [ [[package]] name = "signing" -version = "1.1.116" +version = "1.1.117" dependencies = [ "actix-rt", "addresses", "assert-json", "async-trait", - "bytes 1.1.116", + "bytes 1.1.117", "cap26-models", "core-collections", "core-misc", @@ -4444,10 +4444,10 @@ dependencies = [ [[package]] name = "signing-traits" -version = "1.1.116" +version = "1.1.117" dependencies = [ "async-trait", - "bytes 1.1.116", + "bytes 1.1.117", "core-collections", "derive_more", "ecc", @@ -4612,7 +4612,7 @@ dependencies = [ [[package]] name = "sub-systems" -version = "1.1.116" +version = "1.1.117" dependencies = [ "derive_more", "drivers", @@ -4771,7 +4771,7 @@ dependencies = [ [[package]] name = "time-utils" -version = "1.1.116" +version = "1.1.117" dependencies = [ "iso8601-timestamp", "prelude", @@ -4921,10 +4921,10 @@ dependencies = [ [[package]] name = "transaction-foundation" -version = "1.1.116" +version = "1.1.117" dependencies = [ "assert-json", - "bytes 1.1.116", + "bytes 1.1.117", "derive_more", "has-sample-values", "paste", @@ -4936,10 +4936,10 @@ dependencies = [ [[package]] name = "transaction-models" -version = "1.1.116" +version = "1.1.117" dependencies = [ "addresses", - "bytes 1.1.116", + "bytes 1.1.117", "cargo_toml", "core-collections", "core-misc", diff --git a/crates/app/home-cards/Cargo.toml b/crates/app/home-cards/Cargo.toml index afbc10efb..11e34d7a0 100644 --- a/crates/app/home-cards/Cargo.toml +++ b/crates/app/home-cards/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "home-cards" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/app/key-derivation-traits/Cargo.toml b/crates/app/key-derivation-traits/Cargo.toml index 115fab3f3..472165fce 100644 --- a/crates/app/key-derivation-traits/Cargo.toml +++ b/crates/app/key-derivation-traits/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "key-derivation-traits" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/app/radix-connect-models/Cargo.toml b/crates/app/radix-connect-models/Cargo.toml index 1dc5fa078..6af4c3d00 100644 --- a/crates/app/radix-connect-models/Cargo.toml +++ b/crates/app/radix-connect-models/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-connect-models" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/app/radix-connect/Cargo.toml b/crates/app/radix-connect/Cargo.toml index db1ad778a..8dd5c426f 100644 --- a/crates/app/radix-connect/Cargo.toml +++ b/crates/app/radix-connect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-connect" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/app/security-center/Cargo.toml b/crates/app/security-center/Cargo.toml index 0b9264976..c4187468c 100644 --- a/crates/app/security-center/Cargo.toml +++ b/crates/app/security-center/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "security-center" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/app/signing-traits/Cargo.toml b/crates/app/signing-traits/Cargo.toml index 0010c2985..e86260fdc 100644 --- a/crates/app/signing-traits/Cargo.toml +++ b/crates/app/signing-traits/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "signing-traits" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/app/signing/Cargo.toml b/crates/app/signing/Cargo.toml index 230b25d22..f4a78c38d 100644 --- a/crates/app/signing/Cargo.toml +++ b/crates/app/signing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "signing" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/common/build-info/Cargo.toml b/crates/common/build-info/Cargo.toml index ab5710456..8766e0c03 100644 --- a/crates/common/build-info/Cargo.toml +++ b/crates/common/build-info/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "build-info" -version = "1.1.116" +version = "1.1.117" edition = "2021" build = "build.rs" diff --git a/crates/common/bytes/Cargo.toml b/crates/common/bytes/Cargo.toml index e4ad92534..02eb7a2b7 100644 --- a/crates/common/bytes/Cargo.toml +++ b/crates/common/bytes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bytes" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/common/entity-foundation/Cargo.toml b/crates/common/entity-foundation/Cargo.toml index cc1e7f772..7e2e9fbdb 100644 --- a/crates/common/entity-foundation/Cargo.toml +++ b/crates/common/entity-foundation/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "entity-foundation" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/common/host-info/Cargo.toml b/crates/common/host-info/Cargo.toml index 846737c13..5d5529bcd 100644 --- a/crates/common/host-info/Cargo.toml +++ b/crates/common/host-info/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "host-info" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/common/identified-vec-of/Cargo.toml b/crates/common/identified-vec-of/Cargo.toml index 4c19834fe..652a0a828 100644 --- a/crates/common/identified-vec-of/Cargo.toml +++ b/crates/common/identified-vec-of/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "identified-vec-of" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/common/metadata/Cargo.toml b/crates/common/metadata/Cargo.toml index b39a230d4..41b5143f8 100644 --- a/crates/common/metadata/Cargo.toml +++ b/crates/common/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "metadata" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/common/network/Cargo.toml b/crates/common/network/Cargo.toml index e5efbe7e7..c24be22f3 100644 --- a/crates/common/network/Cargo.toml +++ b/crates/common/network/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "network" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/common/numeric/Cargo.toml b/crates/common/numeric/Cargo.toml index 5e2ee43f3..6eb6e3bd7 100644 --- a/crates/common/numeric/Cargo.toml +++ b/crates/common/numeric/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "numeric" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/common/short-string/Cargo.toml b/crates/common/short-string/Cargo.toml index 2dc64c7f6..de63e7380 100644 --- a/crates/common/short-string/Cargo.toml +++ b/crates/common/short-string/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "short-string" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/assert-json/Cargo.toml b/crates/core/assert-json/Cargo.toml index c749a3032..929dc31bd 100644 --- a/crates/core/assert-json/Cargo.toml +++ b/crates/core/assert-json/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "assert-json" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/collections/Cargo.toml b/crates/core/collections/Cargo.toml index 0048c668b..70540c3cb 100644 --- a/crates/core/collections/Cargo.toml +++ b/crates/core/collections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "core-collections" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/error/Cargo.toml b/crates/core/error/Cargo.toml index 5f7c6a0a1..c9c695df5 100644 --- a/crates/core/error/Cargo.toml +++ b/crates/core/error/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "error" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/has-sample-values/Cargo.toml b/crates/core/has-sample-values/Cargo.toml index 1dfaad7d3..fae53c3ee 100644 --- a/crates/core/has-sample-values/Cargo.toml +++ b/crates/core/has-sample-values/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "has-sample-values" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/misc/Cargo.toml b/crates/core/misc/Cargo.toml index 534090fed..3bef30c2a 100644 --- a/crates/core/misc/Cargo.toml +++ b/crates/core/misc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "core-misc" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/prelude/Cargo.toml b/crates/core/prelude/Cargo.toml index c2c155cf4..499ac0f44 100644 --- a/crates/core/prelude/Cargo.toml +++ b/crates/core/prelude/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prelude" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/time-utils/Cargo.toml b/crates/core/time-utils/Cargo.toml index 4437eb6ad..7137912f6 100644 --- a/crates/core/time-utils/Cargo.toml +++ b/crates/core/time-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "time-utils" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/core/utils/Cargo.toml b/crates/core/utils/Cargo.toml index 0ddca0ac0..251ba1ad1 100644 --- a/crates/core/utils/Cargo.toml +++ b/crates/core/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "core-utils" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/crypto/addresses/Cargo.toml b/crates/crypto/addresses/Cargo.toml index 686b17c20..d2cc67a57 100644 --- a/crates/crypto/addresses/Cargo.toml +++ b/crates/crypto/addresses/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "addresses" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/crypto/cap26-models/Cargo.toml b/crates/crypto/cap26-models/Cargo.toml index 24e0c5e9a..dc751d156 100644 --- a/crates/crypto/cap26-models/Cargo.toml +++ b/crates/crypto/cap26-models/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cap26-models" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/crypto/ecc/Cargo.toml b/crates/crypto/ecc/Cargo.toml index a46851e3c..394be43a3 100644 --- a/crates/crypto/ecc/Cargo.toml +++ b/crates/crypto/ecc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ecc" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/crypto/encryption/Cargo.toml b/crates/crypto/encryption/Cargo.toml index 3f44570ce..dd07ae596 100644 --- a/crates/crypto/encryption/Cargo.toml +++ b/crates/crypto/encryption/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "encryption" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/crypto/hash/Cargo.toml b/crates/crypto/hash/Cargo.toml index fdf486c86..955568122 100644 --- a/crates/crypto/hash/Cargo.toml +++ b/crates/crypto/hash/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hash" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/crypto/hd/Cargo.toml b/crates/crypto/hd/Cargo.toml index 2f388dcf6..6bfe9a793 100644 --- a/crates/crypto/hd/Cargo.toml +++ b/crates/crypto/hd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hierarchical-deterministic" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/factors/factors/Cargo.toml b/crates/factors/factors/Cargo.toml index 91d793bbd..6b382b396 100644 --- a/crates/factors/factors/Cargo.toml +++ b/crates/factors/factors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "factors" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/factors/instances-provider/Cargo.toml b/crates/factors/instances-provider/Cargo.toml index 5797600a6..de8c5be33 100644 --- a/crates/factors/instances-provider/Cargo.toml +++ b/crates/factors/instances-provider/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "factor-instances-provider" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/factors/keys-collector/Cargo.toml b/crates/factors/keys-collector/Cargo.toml index e25677e12..34e998100 100644 --- a/crates/factors/keys-collector/Cargo.toml +++ b/crates/factors/keys-collector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "keys-collector" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/factors/next-derivation-index-ephemeral/Cargo.toml b/crates/factors/next-derivation-index-ephemeral/Cargo.toml index 538fc66b7..3104a5dfb 100644 --- a/crates/factors/next-derivation-index-ephemeral/Cargo.toml +++ b/crates/factors/next-derivation-index-ephemeral/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "next-derivation-index-ephemeral" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/factors/supporting-types/Cargo.toml b/crates/factors/supporting-types/Cargo.toml index 1ede7f5c6..52f8081ae 100644 --- a/crates/factors/supporting-types/Cargo.toml +++ b/crates/factors/supporting-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "factors-supporting-types" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/gateway/client-and-api/Cargo.toml b/crates/gateway/client-and-api/Cargo.toml index 39c8c2557..ad29ca3d7 100644 --- a/crates/gateway/client-and-api/Cargo.toml +++ b/crates/gateway/client-and-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gateway-client-and-api" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/gateway/models/Cargo.toml b/crates/gateway/models/Cargo.toml index 34ce62bc2..87ed8bc9c 100644 --- a/crates/gateway/models/Cargo.toml +++ b/crates/gateway/models/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gateway-models" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/profile/logic/logic_SPLIT_ME/Cargo.toml b/crates/profile/logic/logic_SPLIT_ME/Cargo.toml index 4c3a2aa6a..3e3fd12af 100644 --- a/crates/profile/logic/logic_SPLIT_ME/Cargo.toml +++ b/crates/profile/logic/logic_SPLIT_ME/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-logic" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/account-for-display/Cargo.toml b/crates/profile/models/account-for-display/Cargo.toml index 7e7fa75bd..c77aecb0b 100644 --- a/crates/profile/models/account-for-display/Cargo.toml +++ b/crates/profile/models/account-for-display/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "account-for-display" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/account-or-persona/Cargo.toml b/crates/profile/models/account-or-persona/Cargo.toml index b934cf02d..0aac385d3 100644 --- a/crates/profile/models/account-or-persona/Cargo.toml +++ b/crates/profile/models/account-or-persona/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-account-or-persona" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/account/Cargo.toml b/crates/profile/models/account/Cargo.toml index 643509b40..e82887f23 100644 --- a/crates/profile/models/account/Cargo.toml +++ b/crates/profile/models/account/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-account" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/app-preferences/Cargo.toml b/crates/profile/models/app-preferences/Cargo.toml index 617936e0a..d27e0f939 100644 --- a/crates/profile/models/app-preferences/Cargo.toml +++ b/crates/profile/models/app-preferences/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-app-preferences" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/base-entity/Cargo.toml b/crates/profile/models/base-entity/Cargo.toml index 9f552038e..204a28f32 100644 --- a/crates/profile/models/base-entity/Cargo.toml +++ b/crates/profile/models/base-entity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-base-entity" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/gateway/Cargo.toml b/crates/profile/models/gateway/Cargo.toml index a8c487b22..40cd71e6f 100644 --- a/crates/profile/models/gateway/Cargo.toml +++ b/crates/profile/models/gateway/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-gateway" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/persona-data/Cargo.toml b/crates/profile/models/persona-data/Cargo.toml index ca5ea7430..a992e1e2d 100644 --- a/crates/profile/models/persona-data/Cargo.toml +++ b/crates/profile/models/persona-data/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-persona-data" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/persona/Cargo.toml b/crates/profile/models/persona/Cargo.toml index 74672bf4d..1cfa8b3c4 100644 --- a/crates/profile/models/persona/Cargo.toml +++ b/crates/profile/models/persona/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-persona" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/profile_SPLIT_ME/Cargo.toml b/crates/profile/models/profile_SPLIT_ME/Cargo.toml index 06dca8eac..8fc8c64f2 100644 --- a/crates/profile/models/profile_SPLIT_ME/Cargo.toml +++ b/crates/profile/models/profile_SPLIT_ME/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/profile/models/security-structures/Cargo.toml b/crates/profile/models/security-structures/Cargo.toml index fd24c03f5..8aef829c6 100644 --- a/crates/profile/models/security-structures/Cargo.toml +++ b/crates/profile/models/security-structures/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-security-structures" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/error.rs b/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/error.rs index e7a181792..9b39b7a16 100644 --- a/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/error.rs +++ b/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/error.rs @@ -25,6 +25,10 @@ pub enum MatrixRolesInCombinationBasicViolation { pub enum MatrixRolesInCombinationForeverInvalid { #[error("Recovery and confirmation factors overlap. No factor may be used in both the recovery and confirmation roles")] RecoveryAndConfirmationFactorsOverlap, + #[error("Primary role cannot have multiple devices")] + PrimaryCannotHaveMultipleDevices, + #[error("Threshold and override factors overlap. No factor may be used in both the threshold and override list kinds")] + ThresholdAndOverrideFactorsOverlap, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, thiserror::Error)] diff --git a/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder.rs b/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder.rs index 402a3a3c8..1e942feb9 100644 --- a/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder.rs +++ b/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder.rs @@ -218,7 +218,10 @@ impl MatrixBuilder { ) -> MatrixBuilderMutateResult { self.primary_role .validate_threshold_factors() - .into_matrix_err(RoleKind::Primary) + .into_matrix_err(RoleKind::Primary)?; + Self::validate_primary_list_cannot_have_multiple_devices( + self.primary_role.get_threshold_factors().iter().cloned(), + ) } pub fn validate_recovery_role_in_isolation( @@ -543,6 +546,52 @@ impl MatrixBuilder { Ok(()) } + fn validate_primary_cannot_have_multiple_devices( + &self, + ) -> MatrixBuilderMutateResult { + Self::validate_primary_list_cannot_have_multiple_devices( + self.primary_role.all_factors().into_iter().cloned(), + ) + } + + fn validate_no_factor_may_be_used_in_both_primary_threshold_and_override( + &self, + ) -> MatrixBuilderMutateResult { + if self + .primary_role + .has_same_factor_in_both_threshold_and_override() + { + Err(MatrixBuilderValidation::CombinationViolation( + MatrixRolesInCombinationViolation::ForeverInvalid( + MatrixRolesInCombinationForeverInvalid::ThresholdAndOverrideFactorsOverlap, + ), + )) + } else { + Ok(()) + } + } + + fn validate_primary_list_cannot_have_multiple_devices( + factors: impl IntoIterator, + ) -> MatrixBuilderMutateResult { + let device_count = factors + .into_iter() + .filter(|fsid| { + fsid.get_factor_source_kind() == FactorSourceKind::Device + }) + .count(); + + if device_count > 1 { + Err(MatrixBuilderValidation::CombinationViolation( + MatrixRolesInCombinationViolation::ForeverInvalid( + MatrixRolesInCombinationForeverInvalid::PrimaryCannotHaveMultipleDevices, + ), + )) + } else { + Ok(()) + } + } + /// Security Shield Rules /// In addition to the factor/role rules above, the wallet must enforce certain rules for combinations of /// factors across the three roles. The construction method described in the next section will automatically @@ -557,13 +606,10 @@ impl MatrixBuilder { /// 4. Number of days until auto confirm is greater than zero fn validate_combination(&self) -> MatrixBuilderMutateResult { self.validate_if_primary_has_single_it_must_not_be_used_by_any_other_role()?; + self.validate_primary_cannot_have_multiple_devices()?; + self.validate_no_factor_may_be_used_in_both_primary_threshold_and_override()?; self.validate_no_factor_may_be_used_in_both_recovery_and_confirmation( )?; - - // N.B. the third 3: - // "3. No factor may be used in both the `Primary` threshold and `Primary` override" - // is already enforced by the RoleBuilder - self.validate_number_of_days_until_auto_confirm()?; Ok(()) } diff --git a/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder_unit_tests.rs b/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder_unit_tests.rs index 978716396..c3515b99a 100644 --- a/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder_unit_tests.rs +++ b/crates/profile/models/security-structures/src/roles_matrices_structures/matrices/builder/matrix_builder_unit_tests.rs @@ -527,62 +527,9 @@ mod validation_for_addition_of_factor_source_for_each { FactorSourceID::sample_device(), ForeverInvalidReason::FactorSourceAlreadyPresent ), - FactorSourceInRoleBuilderValidationStatus::forever_invalid( - RoleKind::Primary, - FactorSourceID::sample_device_other(), - ForeverInvalidReason::PrimaryCannotHaveMultipleDevices - ), - ] - ); - } - - #[test] - fn device_2x_threshold_override_first_ok_second_not() { - let mut sut = make(); - let xs = sut.validation_for_addition_of_factor_source_to_primary_threshold_for_each( - &IndexSet::from_iter([ - FactorSourceID::sample_device(), - FactorSourceID::sample_device_other(), - ]), - ); - assert_eq!( - xs.into_iter().collect::>(), - vec![ - FactorSourceInRoleBuilderValidationStatus::ok( - RoleKind::Primary, - FactorSourceID::sample_device() - ), FactorSourceInRoleBuilderValidationStatus::ok( RoleKind::Primary, FactorSourceID::sample_device_other(), - ) - ] - ); - - sut.add_factor_source_to_primary_threshold( - FactorSourceID::sample_device(), - ) - .unwrap(); - - let xs = sut.validation_for_addition_of_factor_source_to_primary_override_for_each( - &IndexSet::from_iter([ - FactorSourceID::sample_device(), - FactorSourceID::sample_device_other(), - ]), - ); - - pretty_assertions::assert_eq!( - xs.into_iter().collect::>(), - vec![ - FactorSourceInRoleBuilderValidationStatus::forever_invalid( - RoleKind::Primary, - FactorSourceID::sample_device(), - ForeverInvalidReason::FactorSourceAlreadyPresent - ), - FactorSourceInRoleBuilderValidationStatus::forever_invalid( - RoleKind::Primary, - FactorSourceID::sample_device_other(), - ForeverInvalidReason::PrimaryCannotHaveMultipleDevices ), ] ); @@ -631,62 +578,9 @@ mod validation_for_addition_of_factor_source_for_each { FactorSourceID::sample_device(), ForeverInvalidReason::FactorSourceAlreadyPresent ), - FactorSourceInRoleBuilderValidationStatus::forever_invalid( - RoleKind::Primary, - FactorSourceID::sample_device_other(), - ForeverInvalidReason::PrimaryCannotHaveMultipleDevices - ), - ] - ); - } - - #[test] - fn device_2x_override_threshold_first_ok_second_not() { - let mut sut = make(); - let xs = sut.validation_for_addition_of_factor_source_to_primary_override_for_each( - &IndexSet::from_iter([ - FactorSourceID::sample_device(), - FactorSourceID::sample_device_other(), - ]), - ); - assert_eq!( - xs.into_iter().collect::>(), - vec![ - FactorSourceInRoleBuilderValidationStatus::ok( - RoleKind::Primary, - FactorSourceID::sample_device() - ), FactorSourceInRoleBuilderValidationStatus::ok( RoleKind::Primary, FactorSourceID::sample_device_other(), - ) - ] - ); - - sut.add_factor_source_to_primary_override( - FactorSourceID::sample_device(), - ) - .unwrap(); - - let xs = sut.validation_for_addition_of_factor_source_to_primary_threshold_for_each( - &IndexSet::from_iter([ - FactorSourceID::sample_device(), - FactorSourceID::sample_device_other(), - ]), - ); - - pretty_assertions::assert_eq!( - xs.into_iter().collect::>(), - vec![ - FactorSourceInRoleBuilderValidationStatus::forever_invalid( - RoleKind::Primary, - FactorSourceID::sample_device(), - ForeverInvalidReason::FactorSourceAlreadyPresent - ), - FactorSourceInRoleBuilderValidationStatus::forever_invalid( - RoleKind::Primary, - FactorSourceID::sample_device_other(), - ForeverInvalidReason::PrimaryCannotHaveMultipleDevices ), ] ); @@ -1223,7 +1117,7 @@ mod validation_of_addition_of_kind { } #[test] - fn device_is_err_for_second_3x_threshold() { + fn device_is_ok_for_second_3x_threshold() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, @@ -1236,11 +1130,11 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } #[test] - fn device_is_err_for_second_2x_threshold_override() { + fn device_is_ok_for_second_2x_threshold_override() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, @@ -1253,11 +1147,11 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } #[test] - fn device_is_err_for_second_threshold_override_threshold() { + fn device_is_ok_for_second_threshold_override_threshold() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, @@ -1270,11 +1164,11 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } #[test] - fn device_is_err_for_second_threshold_override_2x() { + fn device_is_ok_for_second_threshold_override_2x() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, @@ -1287,11 +1181,11 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } #[test] - fn device_is_err_for_second_3x_override() { + fn device_is_ok_for_second_3x_override() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, @@ -1304,11 +1198,11 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } #[test] - fn device_is_err_for_second_2x_override_threshold() { + fn device_is_ok_for_second_2x_override_threshold() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, @@ -1321,11 +1215,11 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } #[test] - fn device_is_err_for_second_override_threshold_2x() { + fn device_is_ok_for_second_override_threshold_2x() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, @@ -1338,11 +1232,11 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } #[test] - fn device_is_err_for_second_override_threshold_override() { + fn device_is_ok_for_second_override_threshold_override() { let mut sut = make(); let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, @@ -1355,7 +1249,7 @@ mod validation_of_addition_of_kind { let res = sut.validation_for_addition_of_factor_source_of_kind_to_primary_override( FactorSourceKind::Device, ); - assert!(res.is_err()); + assert!(res.is_ok()); } } } diff --git a/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/primary_roles_builder_unit_tests.rs b/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/primary_roles_builder_unit_tests.rs index 07255620f..708c334cc 100644 --- a/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/primary_roles_builder_unit_tests.rs +++ b/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/primary_roles_builder_unit_tests.rs @@ -970,7 +970,7 @@ mod device_factor_source { } #[test] - fn two_different_is_err() { + fn two_different_is_ok() { // Arrange let mut sut = make(); @@ -980,12 +980,7 @@ mod device_factor_source { let res = sut.add_factor_source_to_threshold(sample_other()); // Assert - assert!(matches!( - res, - MutRes::Err(Validation::ForeverInvalid( - ForeverInvalidReason::PrimaryCannotHaveMultipleDevices - )) - )); + assert!(matches!(res, Ok(()))); } } diff --git a/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/roles_builder.rs b/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/roles_builder.rs index 1502d03da..6c6ae4c1e 100644 --- a/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/roles_builder.rs +++ b/crates/profile/models/security-structures/src/roles_matrices_structures/roles/builder/roles_builder.rs @@ -60,9 +60,6 @@ pub enum ForeverInvalidReason { #[error("Factor source already present")] FactorSourceAlreadyPresent, - #[error("Primary role cannot have multiple devices")] - PrimaryCannotHaveMultipleDevices, - #[error("Primary role cannot have password in override list")] PrimaryCannotHavePasswordInOverrideList, @@ -426,15 +423,6 @@ impl RoleBuilder { self.get_threshold_factors().contains(factor_source_id) } - fn override_contains_factor_source_of_kind( - &self, - factor_source_kind: FactorSourceKind, - ) -> bool { - self.get_override_factors() - .iter() - .any(|f| f.get_factor_source_kind() == factor_source_kind) - } - fn threshold_contains_factor_source_of_kind( &self, factor_source_kind: FactorSourceKind, @@ -571,6 +559,18 @@ impl RoleBuilder { self.validate_addition_of_password_and_minimum_factor_count() } + pub(crate) fn has_same_factor_in_both_threshold_and_override( + &self, + ) -> bool { + let threshold_set = + HashSet::<_>::from_iter(self.get_threshold_factors()); + let override_set = HashSet::<_>::from_iter(self.get_override_factors()); + let intersection = threshold_set + .intersection(&override_set) + .collect::>(); + !intersection.is_empty() + } + fn validation_for_addition_of_factor_source_of_kind_to_override_for_non_primary_role( &self, factor_source_kind: FactorSourceKind, @@ -643,52 +643,23 @@ impl RoleBuilder { FactorSourceAlreadyPresent, ); - match mode { - SecurityShieldBuilderMode::Strict => { - if self.contains_factor_source(factor_source_id) { + match factor_list_kind { + Override => { + if self.override_contains_factor_source(factor_source_id) { return duplicates_err; } } - SecurityShieldBuilderMode::Lenient => { - match factor_list_kind { - Override => { - if self - .override_contains_factor_source(factor_source_id) - { - return duplicates_err; - } - // but if threshold contains it, we're good (since mode is lenient) - } - Threshold => { - if self - .threshold_contains_factor_source(factor_source_id) - { - return duplicates_err; - } - } // but if override contains it, we're good (since mode is lenient) + Threshold => { + if self.threshold_contains_factor_source(factor_source_id) { + return duplicates_err; } } } + let factor_source_kind = factor_source_id.get_factor_source_kind(); self._validation_add(factor_source_kind, factor_list_kind, mode) } - fn contains_factor_source( - &self, - factor_source_id: &FactorSourceID, - ) -> bool { - self.override_contains_factor_source(factor_source_id) - || self.threshold_contains_factor_source(factor_source_id) - } - - fn contains_factor_source_of_kind( - &self, - factor_source_kind: FactorSourceKind, - ) -> bool { - self.override_contains_factor_source_of_kind(factor_source_kind) - || self.threshold_contains_factor_source_of_kind(factor_source_kind) - } - /// Removes a factor source from the list of `factor_list_kind`. /// /// Lowers the threshold if the deleted factor source is in the `factor_list_kind` list @@ -770,19 +741,8 @@ impl RoleBuilder { PrimaryCannotContainTrustedContact, ); } - FactorSourceKind::Device => match mode { - SecurityShieldBuilderMode::Strict => { - if self.contains_factor_source_of_kind( - FactorSourceKind::Device, - ) { - return RoleBuilderMutateResult::forever_invalid( - PrimaryCannotHaveMultipleDevices, - ); - } - } - SecurityShieldBuilderMode::Lenient => {} - }, - FactorSourceKind::LedgerHQHardwareWallet + FactorSourceKind::Device + | FactorSourceKind::LedgerHQHardwareWallet | FactorSourceKind::ArculusCard | FactorSourceKind::OffDeviceMnemonic => {} } diff --git a/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder.rs b/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder.rs index 04ca46738..42b5bc54c 100644 --- a/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder.rs +++ b/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder.rs @@ -1118,7 +1118,7 @@ mod tests { assert!(!is_fully_valid(sut, FactorSourceKind::Password)); // never alone assert!(can_be(sut, FactorSourceKind::Password)); // lenient - // now lets adding a Device => subsequent calls to `is_fully_valid` will return false + // now lets adding a Device => subsequent calls to `is_fully_valid` will return true add(sut, FactorSourceID::sample_device()); add(sut, FactorSourceID::sample_ledger()); @@ -1126,22 +1126,15 @@ mod tests { assert!(is_fully_valid(sut, FactorSourceKind::Password)); // not alone any more! assert!(can_be(sut, FactorSourceKind::Password)); } else { - // now lets adding a Device => subsequent calls to `is_fully_valid` will return false + // now lets adding a Device => subsequent calls to `is_fully_valid` will return true add(sut, FactorSourceID::sample_device()); } - assert!(!is_fully_valid(sut, FactorSourceKind::Device)); - - // TODO: Unsure about this, we do not count current state and query "can I add (another) Device?" as something - // which can become valid. It would require deletion of current Device factor. Maybe we should change this? - // Not sure... lets keep it as is for now! And lets see how UI integration "feels". - assert!(!can_be(sut, FactorSourceKind::Device)); - - // make it valid again - sut.remove_factor_from_all_roles(FactorSourceID::sample_device()); - assert!(is_fully_valid(sut, FactorSourceKind::Device)); + + // Another device can be added assert!(can_be(sut, FactorSourceKind::Device)); + assert!(is_fully_valid(sut, FactorSourceKind::Device)); } #[test] @@ -1222,10 +1215,9 @@ mod tests { FactorSourceID::sample_device(), ForeverInvalidReason::FactorSourceAlreadyPresent ), - FactorSourceInRoleBuilderValidationStatus::forever_invalid( + FactorSourceInRoleBuilderValidationStatus::ok( RoleKind::Primary, FactorSourceID::sample_device_other(), - ForeverInvalidReason::PrimaryCannotHaveMultipleDevices ), ] ); @@ -1379,13 +1371,6 @@ mod tests { ) .add_factor_source_to_primary_override(FactorSourceID::sample_device()); - // making the primary role invalid DOESN'T affect the primary threshold factors status - pretty_assertions::assert_eq!( - sut.validate(), - Some( - SecurityShieldBuilderRuleViolation::FactorSourceAlreadyPresent - ) - ); pretty_assertions::assert_eq!( sut.selected_primary_threshold_factors_status(), SelectedPrimaryThresholdFactorsStatus::Optimal @@ -1627,6 +1612,72 @@ mod test_invalid { ); } + #[test] + fn factor_source_already_present() { + let sut = SUT::sample_strict_with_auth_signing(); + sut.add_factor_source_to_primary_threshold( + FactorSourceID::sample_device(), + ) + .add_factor_source_to_recovery_override(FactorSourceID::sample_ledger()) + .add_factor_source_to_confirmation_override( + FactorSourceID::sample_ledger_other(), + ); + + let res = sut.validation_for_addition_of_factor_source_to_primary_threshold_for_each( + vec![FactorSourceID::sample_device(),] + ); + + sut.add_factor_source_to_primary_threshold( + FactorSourceID::sample_device(), + ); // did not get added + + assert_eq!( + res, + vec![FactorSourceInRoleBuilderValidationStatus::forever_invalid( + RoleKind::Primary, + FactorSourceID::sample_device(), + ForeverInvalidReason::FactorSourceAlreadyPresent + )] + ); + + assert!(sut.validate().is_none(),); + assert_eq!(sut.status(), SecurityShieldBuilderStatus::Strong); + } + + #[test] + fn primary_cannot_have_password_in_override_list() { + let sut = SUT::sample_strict_with_auth_signing(); + sut.add_factor_source_to_primary_threshold( + FactorSourceID::sample_device(), + ) + .add_factor_source_to_recovery_override(FactorSourceID::sample_ledger()) + .add_factor_source_to_confirmation_override( + FactorSourceID::sample_ledger_other(), + ); + + let is_valid_or_can_be = sut.addition_of_factor_source_of_kind_to_primary_override_is_valid_or_can_be(FactorSourceKind::Password); + let validation_res = sut.validation_for_addition_of_factor_source_to_primary_override_for_each( + vec![FactorSourceID::sample_password(),] + ); + + sut.add_factor_source_to_primary_override( + FactorSourceID::sample_password(), + ); // did not get added + + assert!(!is_valid_or_can_be); + assert_eq!( + validation_res, + vec![FactorSourceInRoleBuilderValidationStatus::forever_invalid( + RoleKind::Primary, + FactorSourceID::sample_password(), + ForeverInvalidReason::PrimaryCannotHavePasswordInOverrideList + )] + ); + + assert!(sut.validate().is_none(),); + assert_eq!(sut.status(), SecurityShieldBuilderStatus::Strong); + } + #[test] fn single_factor_used_in_primary_must_not_be_used_in_any_other_role_in_recovery( ) { @@ -1996,6 +2047,98 @@ mod test_invalid { ); assert!(sut.build().is_err()) } + + #[test] + fn shield_status_weak_when_multiple_devices_in_primary() { + let sut = SUT::default(); + + let _ = sut + .set_authentication_signing_factor(Some( + FactorSourceID::sample_device(), + )) + .add_factor_source_to_primary_threshold( + FactorSourceID::sample_device(), + ) + .add_factor_source_to_recovery_override( + FactorSourceID::sample_device(), + ) + .add_factor_source_to_confirmation_override( + FactorSourceID::sample_arculus(), + ); + + assert!( + sut.addition_of_factor_source_of_kind_to_primary_threshold_is_valid_or_can_be( + FactorSourceKind::Device + ) + ); + + let _ = sut + .add_factor_source_to_primary_threshold( + FactorSourceID::sample_device_other(), + ) // did not get added + .add_factor_source_to_primary_override( + FactorSourceID::sample_device(), + ); + + pretty_assertions::assert_eq!( + sut.validate(), + Some(SecurityShieldBuilderRuleViolation::PrimaryCannotHaveMultipleDevices) + ); + pretty_assertions::assert_eq!( + sut.status(), + SecurityShieldBuilderStatus::Weak { + reason: SecurityShieldBuilderRuleViolation::PrimaryCannotHaveMultipleDevices + } + ); + assert!(sut.build().is_ok()) + } + + #[test] + fn shield_status_weak_when_same_factor_in_primary() { + let sut = SUT::default(); + + let _ = sut + .set_authentication_signing_factor(Some( + FactorSourceID::sample_device(), + )) + .add_factor_source_to_primary_threshold( + FactorSourceID::sample_ledger(), + ) + .add_factor_source_to_recovery_override( + FactorSourceID::sample_device(), + ) + .add_factor_source_to_confirmation_override( + FactorSourceID::sample_arculus(), + ); + + assert!( + sut.addition_of_factor_source_of_kind_to_primary_threshold_is_valid_or_can_be( + FactorSourceKind::LedgerHQHardwareWallet + ) + ); + + let _ = sut + .add_factor_source_to_primary_threshold( + FactorSourceID::sample_ledger(), + ) // did not get added + .add_factor_source_to_primary_override( + FactorSourceID::sample_ledger(), + ); + + pretty_assertions::assert_eq!( + sut.validate(), + Some( + SecurityShieldBuilderRuleViolation::FactorSourceAlreadyPresent + ) + ); + pretty_assertions::assert_eq!( + sut.status(), + SecurityShieldBuilderStatus::Weak { + reason: SecurityShieldBuilderRuleViolation::FactorSourceAlreadyPresent + } + ); + assert!(sut.build().is_ok()) + } } #[cfg(test)] @@ -2019,7 +2162,7 @@ mod lenient { let strict = SUT::strict(); let lenient = SUT::lenient(); - test(&strict, 0); + test(&strict, 1); test(&lenient, 1); } @@ -2041,7 +2184,7 @@ mod lenient { let strict = SUT::strict(); let lenient = SUT::lenient(); - test(&strict, 1); + test(&strict, 2); test(&lenient, 2); } @@ -2120,29 +2263,27 @@ mod lenient { FactorSourceID::sample_device(), ); // did not get added, duplicates are not allowed - assert_eq!( + pretty_assertions::assert_eq!( sut.get_primary_threshold_factors(), vec![FactorSourceID::sample_device()] ); - assert_eq!( - // Takes into consideration all the rules because it disregards the mode - // the builder was initialized with and always uses SecurityShieldBuilderMode::Strict + pretty_assertions::assert_eq!( sut._validation_for_addition_of_factor_source_of_kind_to_primary_threshold( FactorSourceKind::Device, ), - Err( - RoleBuilderValidation::ForeverInvalid( - ForeverInvalidReason::PrimaryCannotHaveMultipleDevices - ) - ) + Ok(()) ); - let _ = sut.add_factor_source_to_primary_threshold( - FactorSourceID::sample_device_other(), - ); // actually this is added because of the lenient mode + let _ = sut + .add_factor_source_to_primary_threshold( + FactorSourceID::sample_device_other(), + ) + .add_factor_source_to_primary_override( + FactorSourceID::sample_device_other(), + ); // actually this is added because of the lenient mode - assert_eq!( + pretty_assertions::assert_eq!( sut.get_primary_threshold_factors(), vec![ FactorSourceID::sample_device(), @@ -2150,6 +2291,11 @@ mod lenient { ] ); + pretty_assertions::assert_eq!( + sut.get_primary_override_factors(), + vec![FactorSourceID::sample_device_other()] + ); + let _ = sut .add_factor_source_to_recovery_override( FactorSourceID::sample_ledger(), @@ -2158,7 +2304,7 @@ mod lenient { FactorSourceID::sample_arculus(), ); - assert_eq!( + pretty_assertions::assert_eq!( sut.status(), SecurityShieldBuilderStatus::Weak { reason: SecurityShieldBuilderRuleViolation::PrimaryCannotHaveMultipleDevices diff --git a/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder_rule_violation.rs b/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder_rule_violation.rs index fceab3cc0..863455d7a 100644 --- a/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder_rule_violation.rs +++ b/crates/profile/models/security-structures/src/roles_matrices_structures/security_shield_builder_rule_violation.rs @@ -68,6 +68,12 @@ impl AsShieldBuilderViolation for MatrixRolesInCombinationForeverInvalid { RecoveryAndConfirmationFactorsOverlap => { Some(SecurityShieldBuilderRuleViolation::RecoveryAndConfirmationFactorsOverlap) } + PrimaryCannotHaveMultipleDevices => { + Some(SecurityShieldBuilderRuleViolation::PrimaryCannotHaveMultipleDevices) + } + ThresholdAndOverrideFactorsOverlap => { + Some(SecurityShieldBuilderRuleViolation::FactorSourceAlreadyPresent) + } } } } @@ -108,9 +114,8 @@ impl AsShieldBuilderViolation for ForeverInvalidReason { ) -> Option { use ForeverInvalidReason::*; let reason = match self { - FactorSourceAlreadyPresent => SecurityShieldBuilderRuleViolation::FactorSourceAlreadyPresent, - PrimaryCannotHaveMultipleDevices => { - SecurityShieldBuilderRuleViolation::PrimaryCannotHaveMultipleDevices + FactorSourceAlreadyPresent => { + SecurityShieldBuilderRuleViolation::FactorSourceAlreadyPresent } PrimaryCannotHavePasswordInOverrideList => { SecurityShieldBuilderRuleViolation::PrimaryCannotHavePasswordInOverrideList diff --git a/crates/profile/models/supporting-types/Cargo.toml b/crates/profile/models/supporting-types/Cargo.toml index 1f27f36ad..0777c1aa9 100644 --- a/crates/profile/models/supporting-types/Cargo.toml +++ b/crates/profile/models/supporting-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-supporting-types" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/profile/traits/entity-by-address/Cargo.toml b/crates/profile/traits/entity-by-address/Cargo.toml index ffa16ed5d..a427cd8b7 100644 --- a/crates/profile/traits/entity-by-address/Cargo.toml +++ b/crates/profile/traits/entity-by-address/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "entity-by-address" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/sargon/Cargo.toml b/crates/sargon/Cargo.toml index e592d9866..b18a93e6f 100644 --- a/crates/sargon/Cargo.toml +++ b/crates/sargon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon" -version = "1.1.116" +version = "1.1.117" edition = "2021" resolver = "2" # features enabled in integration test diff --git a/crates/system/clients/clients/Cargo.toml b/crates/system/clients/clients/Cargo.toml index c1af5ed37..c62c938e1 100644 --- a/crates/system/clients/clients/Cargo.toml +++ b/crates/system/clients/clients/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clients" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/system/clients/http/Cargo.toml b/crates/system/clients/http/Cargo.toml index fc3c192b0..7de70a43c 100644 --- a/crates/system/clients/http/Cargo.toml +++ b/crates/system/clients/http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-client" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/drivers/Cargo.toml b/crates/system/drivers/Cargo.toml index 25419de47..471261fbb 100644 --- a/crates/system/drivers/Cargo.toml +++ b/crates/system/drivers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drivers" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/system/interactors/Cargo.toml b/crates/system/interactors/Cargo.toml index d26a9a205..616d88150 100644 --- a/crates/system/interactors/Cargo.toml +++ b/crates/system/interactors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "interactors" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/os/accounts/Cargo.toml b/crates/system/os/accounts/Cargo.toml index 7c2aad850..65babdbbe 100644 --- a/crates/system/os/accounts/Cargo.toml +++ b/crates/system/os/accounts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon-os-accounts" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/os/factors/Cargo.toml b/crates/system/os/factors/Cargo.toml index 2a215a32a..51f7c2120 100644 --- a/crates/system/os/factors/Cargo.toml +++ b/crates/system/os/factors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon-os-factors" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/os/os/Cargo.toml b/crates/system/os/os/Cargo.toml index 4132fd954..9799bc265 100644 --- a/crates/system/os/os/Cargo.toml +++ b/crates/system/os/os/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon-os" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/os/security-center/Cargo.toml b/crates/system/os/security-center/Cargo.toml index 17c5b852d..060dd1d5f 100644 --- a/crates/system/os/security-center/Cargo.toml +++ b/crates/system/os/security-center/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon-os-security-center" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/os/signing/Cargo.toml b/crates/system/os/signing/Cargo.toml index 6234f57d9..eb8fdd06b 100644 --- a/crates/system/os/signing/Cargo.toml +++ b/crates/system/os/signing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon-os-signing" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/os/transaction/Cargo.toml b/crates/system/os/transaction/Cargo.toml index c51709ab5..25c93057d 100644 --- a/crates/system/os/transaction/Cargo.toml +++ b/crates/system/os/transaction/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon-os-transaction" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/profile-state-holder/Cargo.toml b/crates/system/profile-state-holder/Cargo.toml index 0cbf800ca..e9518654c 100644 --- a/crates/system/profile-state-holder/Cargo.toml +++ b/crates/system/profile-state-holder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "profile-state-holder" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/system/sub-systems/Cargo.toml b/crates/system/sub-systems/Cargo.toml index 1b47e8356..5860a1289 100644 --- a/crates/system/sub-systems/Cargo.toml +++ b/crates/system/sub-systems/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sub-systems" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/transaction/foundation/Cargo.toml b/crates/transaction/foundation/Cargo.toml index 744c758c5..7ad1e369a 100644 --- a/crates/transaction/foundation/Cargo.toml +++ b/crates/transaction/foundation/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "transaction-foundation" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/transaction/manifests/Cargo.toml b/crates/transaction/manifests/Cargo.toml index c0f7122c3..2ee2a404b 100644 --- a/crates/transaction/manifests/Cargo.toml +++ b/crates/transaction/manifests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "manifests" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/transaction/models/Cargo.toml b/crates/transaction/models/Cargo.toml index 2cfc721f0..f6d933664 100644 --- a/crates/transaction/models/Cargo.toml +++ b/crates/transaction/models/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "transaction-models" -version = "1.1.116" +version = "1.1.117" edition = "2021" diff --git a/crates/uniffi/conversion-macros/Cargo.toml b/crates/uniffi/conversion-macros/Cargo.toml index 62529b728..8d87f5222 100644 --- a/crates/uniffi/conversion-macros/Cargo.toml +++ b/crates/uniffi/conversion-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sargon-uniffi-conversion-macros" -version = "1.1.116" +version = "1.1.117" edition = "2021" [dependencies] diff --git a/crates/uniffi/uniffi_SPLIT_ME/Cargo.toml b/crates/uniffi/uniffi_SPLIT_ME/Cargo.toml index e360be891..831ecd577 100644 --- a/crates/uniffi/uniffi_SPLIT_ME/Cargo.toml +++ b/crates/uniffi/uniffi_SPLIT_ME/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon-uniffi" -version = "1.1.116" +version = "1.1.117" edition = "2021" build = "build.rs" diff --git a/crates/uniffi/uniffi_SPLIT_ME/src/profile/mfa/security_structures/security_shield_builder.rs b/crates/uniffi/uniffi_SPLIT_ME/src/profile/mfa/security_structures/security_shield_builder.rs index 21bc898a7..8a1e0cc7b 100644 --- a/crates/uniffi/uniffi_SPLIT_ME/src/profile/mfa/security_structures/security_shield_builder.rs +++ b/crates/uniffi/uniffi_SPLIT_ME/src/profile/mfa/security_structures/security_shield_builder.rs @@ -594,7 +594,6 @@ impl FactorSource { #[cfg(test)] mod tests { - use super::*; #[allow(clippy::upper_case_acronyms)] @@ -849,14 +848,14 @@ mod tests { ]) ); - assert_ne!( + assert_eq!( sim_kind_prim, sut.clone().addition_of_factor_source_of_kind_to_primary_override_is_fully_valid( FactorSourceKind::Device, ) ); - assert_ne!( + assert_eq!( sim_kind_prim_threshold, sut.clone().addition_of_factor_source_of_kind_to_primary_threshold_is_fully_valid( FactorSourceKind::Device, @@ -1031,4 +1030,24 @@ mod tests { } ); } + + #[test] + fn primary_override_validation_status_trusted_contact() { + let sut = SUT::new(); + let res = sut.validation_for_addition_of_factor_source_to_primary_override_for_each( + vec![FactorSourceID::sample_trusted_contact()], + ); + pretty_assertions::assert_eq!( + res, + vec![ + FactorSourceValidationStatus { + role: RoleKind::Primary, + factor_source_id: FactorSourceID::sample_trusted_contact(), + reason_if_invalid: Some(FactorSourceValidationStatusReasonIfInvalid::NonBasic( + SecurityShieldBuilderRuleViolation::PrimaryCannotContainTrustedContact + )) + } + ] + ) + } }