Skip to content

Commit

Permalink
Authorization Interactor (#356)
Browse files Browse the repository at this point in the history
* Expose authorization interactor

* Rename SigningRejecting to HostInteractionAborted

* Fix host tests

* Add test that verifies derivation index is correct

* Release 1.1.120

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Generated by cargo-workspaces

* Fix test

* Invoke correct sut method in test
  • Loading branch information
micbakos-rdx authored Jan 27, 2025
1 parent 22a4d57 commit 9ca1867
Show file tree
Hide file tree
Showing 91 changed files with 924 additions and 199 deletions.
168 changes: 84 additions & 84 deletions Cargo.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ public class ThrowingHostInteractor: HostInteractor {
public nonisolated(unsafe) static var shared: HostInteractor = ThrowingHostInteractor()

public func signAuth(request: SargonUniFFI.SignRequestOfAuthIntent) async throws -> SargonUniFFI.SignResponseOfAuthIntentHash {
throw CommonError.SigningRejected
throw CommonError.HostInteractionAborted
}

public func signTransactions(request: SargonUniFFI.SignRequestOfTransactionIntent) async throws -> SargonUniFFI.SignResponseOfTransactionIntentHash {
throw CommonError.SigningRejected
throw CommonError.HostInteractionAborted
}

public func signSubintents(request: SargonUniFFI.SignRequestOfSubintent) async throws -> SargonUniFFI.SignResponseOfSubintentHash {
throw CommonError.SigningRejected
throw CommonError.HostInteractionAborted
}

public func deriveKeys(request: SargonUniFFI.KeyDerivationRequest) async throws -> SargonUniFFI.KeyDerivationResponse {
throw CommonError.SigningRejected
throw CommonError.HostInteractionAborted
}

public func requestAuthorization(purpose: SargonUniFFI.AuthorizationPurpose) async -> SargonUniFFI.AuthorizationResponse {
.rejected
}
}
13 changes: 9 additions & 4 deletions apple/Tests/TestCases/System/ThrowingHostInteractorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ThrowingHostInteractorTests: TestCase {
request: SargonUniFFI.KeyDerivationRequest(derivationPurpose: .creatingNewAccount, perFactorSource: [])
)
} catch {
XCTAssertEqual(error as? CommonError, CommonError.SigningRejected)
XCTAssertEqual(error as? CommonError, CommonError.HostInteractionAborted)
}
}

Expand All @@ -22,7 +22,7 @@ final class ThrowingHostInteractorTests: TestCase {
request: SargonUniFFI.SignRequestOfAuthIntent(factorSourceKind: .device, perFactorSource: [])
)
} catch {
XCTAssertEqual(error as? CommonError, CommonError.SigningRejected)
XCTAssertEqual(error as? CommonError, CommonError.HostInteractionAborted)
}
}

Expand All @@ -32,7 +32,7 @@ final class ThrowingHostInteractorTests: TestCase {
request: SargonUniFFI.SignRequestOfTransactionIntent(factorSourceKind: .device, perFactorSource: [])
)
} catch {
XCTAssertEqual(error as? CommonError, CommonError.SigningRejected)
XCTAssertEqual(error as? CommonError, CommonError.HostInteractionAborted)
}
}

Expand All @@ -42,7 +42,12 @@ final class ThrowingHostInteractorTests: TestCase {
request: SargonUniFFI.SignRequestOfSubintent(factorSourceKind: .device, perFactorSource: [])
)
} catch {
XCTAssertEqual(error as? CommonError, CommonError.SigningRejected)
XCTAssertEqual(error as? CommonError, CommonError.HostInteractionAborted)
}
}

func testAuthoriseGetsRejected() async {
let outcome = await SUT.shared.requestAuthorization(purpose: .creatingAccount)
XCTAssertEqual(outcome, .rejected)
}
}
2 changes: 1 addition & 1 deletion crates/app/home-cards/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "home-cards"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/key-derivation-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "key-derivation-traits"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/radix-connect-models/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "radix-connect-models"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/radix-connect/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "radix-connect"
version = "1.1.119"
version = "1.1.120"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion crates/app/security-center/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "security-center"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/signing-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "signing-traits"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ impl<S: Signable> SignInteractor<S> for TestSignInteractor<S> {
Ok(SignResponse::user_skipped_factors(ids))
}

SigningUserInput::Reject => Err(CommonError::SigningRejected),
SigningUserInput::Reject => {
Err(CommonError::HostInteractionAborted)
}
}
}
}
2 changes: 1 addition & 1 deletion crates/app/signing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "signing"
version = "1.1.119"
version = "1.1.120"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion crates/common/build-info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "build-info"
version = "1.1.119"
version = "1.1.120"
edition = "2021"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion crates/common/bytes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytes"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/entity-foundation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "entity-foundation"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/host-info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "host-info"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/identified-vec-of/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "identified-vec-of"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "metadata"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "network"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/numeric/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "numeric"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/short-string/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "short-string"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/assert-json/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "assert-json"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/collections/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "core-collections"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/error/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "error"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/core/error/src/common_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,8 @@ pub enum CommonError {
#[error("Could not validate signature for the given rola challenge.")]
InvalidSignatureForRolaChallenge = 10231,

#[error("Signing was rejected by the user")]
SigningRejected = 10232,
#[error("User aborted the interaction with sargon on host.")]
HostInteractionAborted = 10232,

#[error("Failed to automatically build shield, reason: '{underlying}'")]
AutomaticShieldBuildingFailure { underlying: String } = 10233,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/has-sample-values/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "has-sample-values"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/misc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "core-misc"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/prelude/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prelude"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/time-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "time-utils"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "core-utils"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/addresses/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "addresses"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/cap26-models/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cap26-models"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/ecc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ecc"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/encryption/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "encryption"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/hash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hash"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/hd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hierarchical-deterministic"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/factors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "factors"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/instances-provider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "factor-instances-provider"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/keys-collector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keys-collector"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/next-derivation-index-ephemeral/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "next-derivation-index-ephemeral"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/supporting-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "factors-supporting-types"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/gateway/client-and-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gateway-client-and-api"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/gateway/models/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gateway-models"
version = "1.1.119"
version = "1.1.120"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion crates/profile/logic/logic_SPLIT_ME/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "profile-logic"
version = "1.1.119"
version = "1.1.120"
edition = "2021"

[dependencies]
Expand Down
Loading

0 comments on commit 9ca1867

Please sign in to comment.