diff --git a/RadixWallet.xcodeproj/project.pbxproj b/RadixWallet.xcodeproj/project.pbxproj index 584dbc4f3c..7d25f0e76a 100644 --- a/RadixWallet.xcodeproj/project.pbxproj +++ b/RadixWallet.xcodeproj/project.pbxproj @@ -9178,14 +9178,6 @@ version = 6.13.2; }; }; - 5B3047A72CD26EB1009FAF90 /* XCRemoteSwiftPackageReference "sargon" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/radixdlt/sargon/"; - requirement = { - kind = exactVersion; - version = 1.1.44; - }; - }; 5B634A922C91D2A0004B2FBC /* XCRemoteSwiftPackageReference "ScreenshotPreventing-iOS" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/Sajjon/ScreenshotPreventing-iOS"; @@ -9207,7 +9199,7 @@ repositoryURL = "https://github.com/radixdlt/sargon"; requirement = { kind = exactVersion; - version = 1.1.47; + version = 1.1.48; }; }; A415574E2B757C5E0040AD4E /* XCRemoteSwiftPackageReference "swift-composable-architecture" */ = { @@ -9431,7 +9423,6 @@ }; 5B4E1D1E2CB7FE8E002FAC2E /* Sargon */ = { isa = XCSwiftPackageProductDependency; - package = 5B4E1D1D2CB7FE8E002FAC2E /* XCRemoteSwiftPackageReference "sargon" */; productName = Sargon; }; 5B634A932C91D2A0004B2FBC /* ScreenshotPreventing */ = { diff --git a/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 993661fd9a..6ccbced6a8 100644 --- a/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -114,8 +114,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/radixdlt/sargon", "state" : { - "revision" : "95c81df01619eac9923ad0211de74428764659da", - "version" : "1.1.47" + "revision" : "a8f7bba9d7ae58ab0cf21ef47e0d87e59d7f3198", + "version" : "1.1.48" } }, { diff --git a/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Interfce.swift b/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Interfce.swift index a6e6fb1945..e17c5bdf49 100644 --- a/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Interfce.swift +++ b/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Interfce.swift @@ -85,10 +85,16 @@ extension DappInteractionClient { case dAppValidationError(String) case badContent(BadContent) case invalidPersonaOrAccounts + case invalidPreAuthorization(InvalidPreAuthorization) enum BadContent: Sendable, Hashable { case numberOfAccountsInvalid } + + enum InvalidPreAuthorization: Sendable, Hashable { + case expirationTooClose + case expired + } } } } diff --git a/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Live.swift b/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Live.swift index 4370f77c25..d71b3d220e 100644 --- a/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Live.swift +++ b/RadixWallet/Clients/DappInteractionClient/DappInteractionClient+Live.swift @@ -123,6 +123,16 @@ extension DappInteractionClient { return invalidRequest(.invalidPersonaOrAccounts) } + case let .preAuthorization(preAuthorization): + switch preAuthorization.request.expiration.getStatus() { + case .valid: + break + case .expirationTooClose: + return invalidRequest(.invalidPreAuthorization(.expirationTooClose)) + case .expired: + return invalidRequest(.invalidPreAuthorization(.expired)) + } + default: break } diff --git a/RadixWallet/Features/DappInteractionFeature/Interactor/DappInteractor.swift b/RadixWallet/Features/DappInteractionFeature/Interactor/DappInteractor.swift index a423e41924..0eca1d11f7 100644 --- a/RadixWallet/Features/DappInteractionFeature/Interactor/DappInteractor.swift +++ b/RadixWallet/Features/DappInteractionFeature/Interactor/DappInteractor.swift @@ -382,6 +382,10 @@ extension DappInteractionClient.ValidatedDappRequest.InvalidRequestReason { .invalidRequest case .invalidPersonaOrAccounts: .invalidPersonaOrAccounts + case .invalidPreAuthorization(.expirationTooClose): + .subintentExpirationTooClose + case .invalidPreAuthorization(.expired): + .expiredSubintent } } @@ -406,10 +410,8 @@ extension DappInteractionClient.ValidatedDappRequest.InvalidRequestReason { L10n.DAppRequest.ValidationOutcome.subtitleIncompatibleVersion case .wrongNetworkID: L10n.DAppRequest.ValidationOutcome.subtitleWrongNetworkID - case .invalidOrigin, .invalidDappDefinitionAddress, .dAppValidationError: + case .invalidOrigin, .invalidDappDefinitionAddress, .dAppValidationError, .invalidPersonaOrAccounts, .invalidPreAuthorization: shortExplanation - case .invalidPersonaOrAccounts: - L10n.DAppRequest.ValidationOutcome.invalidPersonaOrAccoubts } } @@ -436,7 +438,7 @@ extension DappInteractionClient.ValidatedDappRequest.InvalidRequestReason { L10n.DAppRequest.ValidationOutcome.devExplanationInvalidDappDefinitionAddress(invalidAddress) case let .dAppValidationError(underlyingError): "\(L10n.DAppRequest.ValidationOutcome.invalidRequestMessage): \(underlyingError)" - case .wrongNetworkID, .invalidPersonaOrAccounts: + case .wrongNetworkID, .invalidPersonaOrAccounts, .invalidPreAuthorization: shortExplanation } } @@ -461,6 +463,10 @@ extension DappInteractionClient.ValidatedDappRequest.InvalidRequestReason { L10n.DAppRequest.RequestWrongNetworkAlert.message(networkName(for: ce), networkName(for: wallet)) case .invalidPersonaOrAccounts: L10n.DAppRequest.ValidationOutcome.invalidPersonaOrAccoubts + case .invalidPreAuthorization(.expirationTooClose): + L10n.DAppRequest.ValidationOutcome.preAuthorizationExpirationTooClose + case .invalidPreAuthorization(.expired): + L10n.DAppRequest.ValidationOutcome.preAuthorizationExpired } } diff --git a/RadixWallet/Features/PreAuthorizationReview/PreAuthorizationReview.swift b/RadixWallet/Features/PreAuthorizationReview/PreAuthorizationReview.swift index 84b714ddee..07b9e5ebfb 100644 --- a/RadixWallet/Features/PreAuthorizationReview/PreAuthorizationReview.swift +++ b/RadixWallet/Features/PreAuthorizationReview/PreAuthorizationReview.swift @@ -139,7 +139,7 @@ struct PreAuthorizationReview: Sendable, FeatureReducer { switch state.expiration { case let .atTime(value): // Trigger expiration countdown effect - let expirationDate = value.unixTimestampSeconds + let expirationDate = value.date state.secondsToExpiration = Int(expirationDate.timeIntervalSinceNow) effects.append(startTimer(expirationDate: expirationDate)) case .afterDelay: @@ -269,7 +269,7 @@ extension PreAuthorizationReview.State { var isExpired: Bool { switch expiration { case let .atTime(value): - value.unixTimestampSeconds <= Date.now + value.date <= Date.now case .afterDelay: false }