diff --git a/Example/Gemfile b/Example/Gemfile new file mode 100644 index 000000000..207036529 --- /dev/null +++ b/Example/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "cocoapods", "~> 1.14.0" diff --git a/Example/Gemfile.lock b/Example/Gemfile.lock new file mode 100644 index 000000000..66a4411ab --- /dev/null +++ b/Example/Gemfile.lock @@ -0,0 +1,107 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.6) + rexml + activesupport (7.1.2) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + base64 (0.2.0) + bigdecimal (3.1.5) + claide (1.1.0) + cocoapods (1.14.3) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.14.3) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.14.3) + activesupport (>= 5.0, < 8) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (2.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) + drb (2.2.0) + ruby2_keywords + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + ffi (1.16.3) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + json (2.7.1) + minitest (5.20.0) + molinillo (0.8.0) + mutex_m (0.2.0) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + public_suffix (4.0.7) + rexml (3.2.6) + ruby-macho (2.5.1) + ruby2_keywords (0.0.5) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + xcodeproj (1.23.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + +PLATFORMS + arm64-darwin-21 + +DEPENDENCIES + cocoapods (~> 1.14.0) + +BUNDLED WITH + 2.4.22 diff --git a/Example/Podfile.lock b/Example/Podfile.lock index cf8a783bd..81f290ee9 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - TangemSdk: f3adf8d0c18bf7a76406462fa31c0efa9f2efa93 + TangemSdk: 61e07ff112d4095cfa688fa7d4694e59fa29f76d PODFILE CHECKSUM: fb4745483d8583db4c8ae8aa3ccbde86ca112a6b -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.3 diff --git a/Example/TangemSdkExample.xcodeproj/project.pbxproj b/Example/TangemSdkExample.xcodeproj/project.pbxproj index ea9163f59..c4d8b9016 100644 --- a/Example/TangemSdkExample.xcodeproj/project.pbxproj +++ b/Example/TangemSdkExample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -41,6 +41,8 @@ 5DDCEC7A25C958220002090D /* UI+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DDCEC7425C957930002090D /* UI+.swift */; }; B00A67B3253D8CAC002D7D53 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B00A67B2253D8CAC002D7D53 /* Utils.swift */; }; B00A67B6253D8DA2002D7D53 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B00A67B2253D8CAC002D7D53 /* Utils.swift */; }; + B6B9589C2B2FCA9900E7B74E /* Gemfile in Resources */ = {isa = PBXBuildFile; fileRef = B6B9589A2B2FCA9900E7B74E /* Gemfile */; }; + B6B9589D2B2FCA9900E7B74E /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = B6B9589B2B2FCA9900E7B74E /* Podfile */; }; DC23ED9F2912DD0D0023E626 /* ResetToFactorySettingsTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC23ED9E2912DD0D0023E626 /* ResetToFactorySettingsTask.swift */; }; DC23EDA02912DD520023E626 /* ResetToFactorySettingsTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC23ED9E2912DD0D0023E626 /* ResetToFactorySettingsTask.swift */; }; DC28E0F22877F84B00AE7A84 /* DebugLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC28E0F12877F84B00AE7A84 /* DebugLogger.swift */; }; @@ -93,6 +95,8 @@ 5E2717BD1D7CB2EFFB59D0F4 /* Pods-TangemSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TangemSdkExample.release.xcconfig"; path = "Target Support Files/Pods-TangemSdkExample/Pods-TangemSdkExample.release.xcconfig"; sourceTree = ""; }; ABA3866CD02DAF9913B7E6BD /* Pods-TangemSdkExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TangemSdkExample.debug.xcconfig"; path = "Target Support Files/Pods-TangemSdkExample/Pods-TangemSdkExample.debug.xcconfig"; sourceTree = ""; }; B00A67B2253D8CAC002D7D53 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = ""; }; + B6B9589A2B2FCA9900E7B74E /* Gemfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Gemfile; sourceTree = ""; }; + B6B9589B2B2FCA9900E7B74E /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; DC23ED9E2912DD0D0023E626 /* ResetToFactorySettingsTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResetToFactorySettingsTask.swift; sourceTree = ""; }; DC28E0F12877F84B00AE7A84 /* DebugLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugLogger.swift; sourceTree = ""; }; E53EB3E423F2C7C90079CC11 /* TangemSdkExampleDevelopmentUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TangemSdkExampleDevelopmentUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -135,10 +139,10 @@ 5D032008266A8523008472EC /* ExampleButton.swift */, 5DDCEC7425C957930002090D /* UI+.swift */, B00A67B2253D8CAC002D7D53 /* Utils.swift */, - 5D78C1C4234F435C008D7478 /* LaunchScreen.storyboard */, - 5D78C1C2234F435C008D7478 /* Assets.xcassets */, 5D78C1B9234F435B008D7478 /* AppDelegate.swift */, 5D03200D266A85CB008472EC /* ActivityIndicatorView.swift */, + 5D78C1C4234F435C008D7478 /* LaunchScreen.storyboard */, + 5D78C1C2234F435C008D7478 /* Assets.xcassets */, ); path = Common; sourceTree = ""; @@ -158,6 +162,8 @@ 5D78C1AD234F435B008D7478 = { isa = PBXGroup; children = ( + B6B9589A2B2FCA9900E7B74E /* Gemfile */, + B6B9589B2B2FCA9900E7B74E /* Podfile */, 5D78C1B8234F435B008D7478 /* TangemSdkExample */, E53EB3E523F2C7C90079CC11 /* TangemSdkExampleDevelopmentUITests */, 5D78C1B7234F435B008D7478 /* Products */, @@ -179,12 +185,12 @@ 5D78C1B8234F435B008D7478 /* TangemSdkExample */ = { isa = PBXGroup; children = ( + 5D03200C266A8548008472EC /* Common */, 5D2BDF7E26DCE000002F7E19 /* Developer */, 5D032000266A6A15008472EC /* AppModel.swift */, 5D031FFC266A6960008472EC /* ContentView.swift */, - 5D03200C266A8548008472EC /* Common */, - 5D7FE136234F7D6700A1F440 /* TangemSdkExample.entitlements */, 5D1C6C7127214EA900E04A8B /* SettingsView.swift */, + 5D7FE136234F7D6700A1F440 /* TangemSdkExample.entitlements */, ); path = TangemSdkExample; sourceTree = ""; @@ -281,8 +287,9 @@ 5D78C1AE234F435B008D7478 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1250; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = "Tangem AG"; TargetAttributes = { 5D78C1B5234F435B008D7478 = { @@ -294,7 +301,7 @@ }; }; }; - buildConfigurationList = 5D78C1B1234F435B008D7478 /* Build configuration list for PBXProject "TangemSDKExample" */; + buildConfigurationList = 5D78C1B1234F435B008D7478 /* Build configuration list for PBXProject "TangemSdkExample" */; compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; @@ -319,7 +326,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + B6B9589C2B2FCA9900E7B74E /* Gemfile in Resources */, 5D78C1C6234F435C008D7478 /* LaunchScreen.storyboard in Resources */, + B6B9589D2B2FCA9900E7B74E /* Podfile in Resources */, 5D78C1C3234F435C008D7478 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -492,6 +501,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -553,6 +563,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -587,7 +598,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.tangem.TangemSDKExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_INCLUDE_PATHS = "$(inherited) /Users/alexander.osokin/repos/tangem/tangem-ios/TangemSdk/TangemSdk/TangemSdk/Crypto/Ed25519/CEd25519"; + SWIFT_INCLUDE_PATHS = "$(inherited)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; @@ -609,7 +620,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.tangem.TangemSDKExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_INCLUDE_PATHS = "$(inherited) /Users/alexander.osokin/repos/tangem/tangem-ios/TangemSdk/TangemSdk/TangemSdk/Crypto/Ed25519/CEd25519"; + SWIFT_INCLUDE_PATHS = "$(inherited)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; @@ -623,7 +634,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = 4897UJ6D8C; - INFOPLIST_FILE = "TangemSdkExample copy-Info.plist"; + INFOPLIST_FILE = "TangemSdkExample/Info-Development.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -643,7 +654,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = 4897UJ6D8C; - INFOPLIST_FILE = "TangemSdkExample copy-Info.plist"; + INFOPLIST_FILE = "TangemSdkExample/Info-Development.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -698,7 +709,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 5D78C1B1234F435B008D7478 /* Build configuration list for PBXProject "TangemSDKExample" */ = { + 5D78C1B1234F435B008D7478 /* Build configuration list for PBXProject "TangemSdkExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 5D78C1C8234F435C008D7478 /* Debug */, diff --git a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme index f017a6d27..6018bf456 100644 --- a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme +++ b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme @@ -1,6 +1,6 @@ + ReferencedContainer = "container:TangemSdkExample.xcodeproj"> @@ -47,7 +47,7 @@ BlueprintIdentifier = "5D78C1B5234F435B008D7478" BuildableName = "TangemSdkExample.app" BlueprintName = "TangemSdkExample" - ReferencedContainer = "container:TangemSDKExample.xcodeproj"> + ReferencedContainer = "container:TangemSdkExample.xcodeproj"> @@ -64,7 +64,7 @@ BlueprintIdentifier = "5D78C1B5234F435B008D7478" BuildableName = "TangemSdkExample.app" BlueprintName = "TangemSdkExample" - ReferencedContainer = "container:TangemSDKExample.xcodeproj"> + ReferencedContainer = "container:TangemSdkExample.xcodeproj"> diff --git a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme index 80afb268c..46c924e7e 100644 --- a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme +++ b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme @@ -1,6 +1,6 @@ 2.217.0" +gem "cocoapods", "~> 1.14.0" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..32ccd4039 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,289 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.6) + rexml + activesupport (7.1.2) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.3.0) + aws-partitions (1.868.0) + aws-sdk-core (3.190.0) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.8) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.75.0) + aws-sdk-core (~> 3, >= 3.188.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.141.0) + aws-sdk-core (~> 3, >= 3.189.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.8) + aws-sigv4 (1.8.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + base64 (0.2.0) + bigdecimal (3.1.5) + claide (1.1.0) + cocoapods (1.14.3) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.14.3) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.14.3) + activesupport (>= 5.0, < 8) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (2.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) + declarative (0.0.20) + digest-crc (0.6.5) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.6.20231109) + dotenv (2.8.1) + drb (2.2.0) + ruby2_keywords + emoji_regex (3.2.3) + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + excon (0.108.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.7) + fastlane (2.217.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + http-cookie (~> 1.0.5) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (>= 2.0.0, < 3.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (~> 3) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + ffi (1.16.3) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.2) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.29.0) + google-apis-core (>= 0.11.0, < 2.a) + google-cloud-core (1.6.1) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (2.1.0) + faraday (>= 1.0, < 3.a) + google-cloud-errors (1.3.1) + google-cloud-storage (1.45.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.29.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.9.1) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.1) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.3) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + jmespath (1.6.2) + json (2.7.1) + jwt (2.7.1) + mini_magick (4.12.0) + mini_mime (1.1.5) + minitest (5.20.0) + molinillo (0.8.0) + multi_json (1.15.0) + multipart-post (2.3.0) + mutex_m (0.2.0) + nanaimo (0.3.0) + nap (1.1.0) + naturally (2.2.1) + netrc (0.11.0) + optparse (0.1.1) + os (1.1.4) + plist (3.7.0) + public_suffix (4.0.7) + rake (13.1.0) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.6) + rouge (2.0.7) + ruby-macho (2.5.1) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + signet (0.18.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.10) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.2) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uber (0.1.0) + unicode-display_width (2.5.0) + webrick (1.8.1) + word_wrap (1.0.0) + xcodeproj (1.23.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-21 + +DEPENDENCIES + cocoapods (~> 1.14.0) + fastlane (~> 2.217.0) + +BUNDLED WITH + 2.4.22 diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..759e45d14 --- /dev/null +++ b/Package.swift @@ -0,0 +1,62 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "TangemSdk", + defaultLocalization: "en", + platforms: [ + .iOS(.v11) + ], + products: [ + // Products define the executables and libraries a package produces, making them visible to other packages. + .library( + name: "TangemSdk", + targets: [ + "TangemSdk", + ] + ), + ], + targets: [ + // Targets are the basic building blocks of a package, defining a module or a test suite. + // Targets can depend on other targets in this package and products from dependencies. + .target( + name: "TangemSdk", + dependencies: [ + "TangemSdk_secp256k1", + "Bls_Signature", + ], + path: "TangemSdk/TangemSdk", + exclude: [ + "Crypto/secp256k1", + "Frameworks", + "module.modulemap", + "TangemSdk.h", + ], + resources: [ + .process("Common/Localization/Resources"), + .copy("Haptics"), + .copy("Crypto/BIP39/Wordlists/english.txt"), + ] + ), + .target( + name: "TangemSdk_secp256k1", + path: "TangemSdk/TangemSdk/Crypto/secp256k1" + ), + .binaryTarget( + name: "Bls_Signature", + path: "TangemSdk/TangemSdk/Frameworks/Bls_Signature.xcframework" + ), + .testTarget( + name: "TangemSdkTests", + dependencies: [ + "TangemSdk", + ], + path: "TangemSdk/TangemSdkTests", + resources: [ + .copy("Jsons"), + ] + ), + ] +) diff --git a/TangemSdk.podspec b/TangemSdk.podspec index 7809c5aa8..77c8741da 100644 --- a/TangemSdk.podspec +++ b/TangemSdk.podspec @@ -7,48 +7,48 @@ # Pod::Spec.new do |s| - s.name = 'TangemSdk' - s.version = '3.8.0' - s.summary = 'Use TangemSdk for Tangem cards integration' - -# This description is used to generate tags and improve search results. -# * Think: What does it do? Why did you write it? What is the focus? -# * Try to keep it short, snappy and to the point. -# * Write the description between the DESC delimiters below. -# * Finally, don't worry about the indent, CocoaPods strips it! - - s.description = <<-DESC + s.name = 'TangemSdk' + s.version = '3.8.0' + s.summary = 'Use TangemSdk for Tangem cards integration' + s.description = <<-DESC Tangem is a Swiss-based secure hardware wallet manufacturer that enables blockchain-based assets to be kept in custody within smart physical banknotes and accessed via NFC technology. Tangem’s mission is to make digital assets accessible, affordable and convenient for consumers. - DESC + DESC - s.homepage = 'https://github.com/Tangem/tangem-sdk-ios' - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { 'Tangem' => 'hello@tangem.com' } - s.source = { :git => 'https://github.com/Tangem/tangem-sdk-ios.git', :tag => s.version.to_s } + s.homepage = 'https://github.com/Tangem/tangem-sdk-ios' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { 'Tangem' => 'hello@tangem.com' } + s.source = { :git => 'https://github.com/Tangem/tangem-sdk-ios.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/Tangem' s.platform = :ios s.ios.deployment_target = '11.0' s.swift_version = '5.0' s.source_files = 'TangemSdk/TangemSdk/**/*.{swift}', - 'TangemSdk/TangemSdk/TangemSdk.h', - 'TangemSdk/TangemSdk/Crypto/secp256k1/*/*.{h,c}' - + 'TangemSdk/TangemSdk/TangemSdk.h', + 'TangemSdk/TangemSdk/Crypto/secp256k1/*/*.{h,c}' s.preserve_paths = 'TangemSdk/TangemSdk/module.modulemap', - 'TangemSdk/TangemSdk/Crypto/*' + 'TangemSdk/TangemSdk/Crypto/*' s.public_header_files = 'TangemSdk/TangemSdk/TangemSdk.h' + s.pod_target_xcconfig = { 'SWIFT_INCLUDE_PATHS' => '$(PODS_TARGET_SRCROOT)/TangemSdk/**', - 'OTHER_CFLAGS' => '-pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-shorten-64-to-32 -Wno-conditional-uninitialized -Wno-unused-function -Wno-long-long -Wno-overlength-strings -O3 -Wundef -Wreserved-identifier -fvisibility=hidden', + 'OTHER_CFLAGS' => '-Wpedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-shorten-64-to-32 -Wno-conditional-uninitialized -Wno-unused-function -Wno-long-long -Wno-overlength-strings -Wundef -Wreserved-identifier -O3 -fvisibility=hidden', } - s.weak_frameworks = 'CoreNFC', 'CryptoKit', 'Combine', 'SwiftUI' - - s.resource_bundles = { 'TangemSdk' => ['TangemSdk/TangemSdk/**/*.lproj/*.strings', - 'TangemSdk/TangemSdk/Haptics/*.ahap', - 'TangemSdk/TangemSdk/**/Wordlists/*.txt']} + s.weak_frameworks = 'CoreNFC', + 'CryptoKit', + 'Combine', + 'SwiftUI' + + s.resource_bundles = { + 'TangemSdk' => [ + 'TangemSdk/TangemSdk/**/*.lproj/*.strings', + 'TangemSdk/TangemSdk/Haptics/*.ahap', + 'TangemSdk/TangemSdk/**/Wordlists/*.txt', + ] + } s.vendored_frameworks = 'TangemSdk/TangemSdk/Frameworks/Bls_Signature.xcframework' end diff --git a/TangemSdk/TangemSdk.xcodeproj/project.pbxproj b/TangemSdk/TangemSdk.xcodeproj/project.pbxproj index b56616d22..f53427187 100644 --- a/TangemSdk/TangemSdk.xcodeproj/project.pbxproj +++ b/TangemSdk/TangemSdk.xcodeproj/project.pbxproj @@ -245,6 +245,8 @@ B0EC6500260110530088F03D /* WalletDeserializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EC64FF260110530088F03D /* WalletDeserializer.swift */; }; B0EC6508260110CC0088F03D /* ReadWalletCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EC6507260110CC0088F03D /* ReadWalletCommand.swift */; }; B0EC650E260131220088F03D /* ReadWalletsListCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EC650D260131220088F03D /* ReadWalletsListCommand.swift */; }; + B6936A672B387B040024826A /* secp256k1_tangem.h in Headers */ = {isa = PBXBuildFile; fileRef = B6936A662B387B040024826A /* secp256k1_tangem.h */; }; + B6CA42232B38B5AE00C9A5C9 /* Bundle+.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6CA42222B38B5AE00C9A5C9 /* Bundle+.swift */; }; DA216CC0282E4D86003585B9 /* AccessCodeRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA216CBF282E4D86003585B9 /* AccessCodeRepository.swift */; }; DA6C752A292682650070EEFD /* LAContext+.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA6C7529292682650070EEFD /* LAContext+.swift */; }; DC0665572A7AC8F500CFFCC6 /* Ed25519Slip0010Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC0665562A7AC8F500CFFCC6 /* Ed25519Slip0010Tests.swift */; }; @@ -305,7 +307,6 @@ DCD2D7F42A1CE66000AB00B6 /* secp256k1_recovery.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D7832A1CE66000AB00B6 /* secp256k1_recovery.h */; }; DCD2D7F52A1CE66000AB00B6 /* secp256k1_extrakeys.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D7842A1CE66000AB00B6 /* secp256k1_extrakeys.h */; }; DCD2D7F62A1CE66000AB00B6 /* secp256k1_preallocated.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D7852A1CE66000AB00B6 /* secp256k1_preallocated.h */; }; - DCD2D7F72A1CE66000AB00B6 /* secp256k1.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D7862A1CE66000AB00B6 /* secp256k1.h */; }; DCD2D8BA2A1CF64A00AB00B6 /* scalar_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D84E2A1CF64900AB00B6 /* scalar_impl.h */; }; DCD2D8BD2A1CF64A00AB00B6 /* field_10x26_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D8512A1CF64900AB00B6 /* field_10x26_impl.h */; }; DCD2D8BE2A1CF64A00AB00B6 /* testrand_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D8522A1CF64900AB00B6 /* testrand_impl.h */; }; @@ -366,7 +367,6 @@ DCD2D91C2A1CF64A00AB00B6 /* scalar_low.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D8B72A1CF64A00AB00B6 /* scalar_low.h */; }; DCD2D91D2A1CF64A00AB00B6 /* eckey.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D8B82A1CF64A00AB00B6 /* eckey.h */; }; DCD2D91F2A1CF87200AB00B6 /* libsecp256k1-config.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D91E2A1CF87200AB00B6 /* libsecp256k1-config.h */; }; - DCD2D9222A1CFA8400AB00B6 /* precompute_ecmult.c in Sources */ = {isa = PBXBuildFile; fileRef = DCD2D9202A1CFA8400AB00B6 /* precompute_ecmult.c */; }; DCD2D9232A1CFA8400AB00B6 /* precomputed_ecmult_gen.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD2D9212A1CFA8400AB00B6 /* precomputed_ecmult_gen.h */; }; DCD2D9252A1D15A300AB00B6 /* SchnorrSignature.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCD2D9242A1D15A300AB00B6 /* SchnorrSignature.swift */; }; DCEA3ABC2875AEBA00B0B0DA /* BiometricsStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCEA3ABB2875AEBA00B0B0DA /* BiometricsStorage.swift */; }; @@ -631,6 +631,10 @@ B0EC64FF260110530088F03D /* WalletDeserializer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletDeserializer.swift; sourceTree = ""; }; B0EC6507260110CC0088F03D /* ReadWalletCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadWalletCommand.swift; sourceTree = ""; }; B0EC650D260131220088F03D /* ReadWalletsListCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadWalletsListCommand.swift; sourceTree = ""; }; + B6936A662B387B040024826A /* secp256k1_tangem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = secp256k1_tangem.h; sourceTree = ""; }; + B6B958982B2FCA8600E7B74E /* Gemfile */ = {isa = PBXFileReference; lastKnownFileType = text; name = Gemfile; path = ../Gemfile; sourceTree = ""; }; + B6B958992B2FCA8600E7B74E /* TangemSdk.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = TangemSdk.podspec; path = ../TangemSdk.podspec; sourceTree = ""; }; + B6CA42222B38B5AE00C9A5C9 /* Bundle+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+.swift"; sourceTree = ""; }; DA216CBF282E4D86003585B9 /* AccessCodeRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessCodeRepository.swift; sourceTree = ""; }; DA6C7529292682650070EEFD /* LAContext+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LAContext+.swift"; sourceTree = ""; }; DADB544F298BAFBC00491102 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; @@ -692,7 +696,6 @@ DCD2D7832A1CE66000AB00B6 /* secp256k1_recovery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = secp256k1_recovery.h; sourceTree = ""; }; DCD2D7842A1CE66000AB00B6 /* secp256k1_extrakeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = secp256k1_extrakeys.h; sourceTree = ""; }; DCD2D7852A1CE66000AB00B6 /* secp256k1_preallocated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = secp256k1_preallocated.h; sourceTree = ""; }; - DCD2D7862A1CE66000AB00B6 /* secp256k1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = secp256k1.h; sourceTree = ""; }; DCD2D84E2A1CF64900AB00B6 /* scalar_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scalar_impl.h; sourceTree = ""; }; DCD2D8512A1CF64900AB00B6 /* field_10x26_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = field_10x26_impl.h; sourceTree = ""; }; DCD2D8522A1CF64900AB00B6 /* testrand_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testrand_impl.h; sourceTree = ""; }; @@ -753,7 +756,6 @@ DCD2D8B72A1CF64A00AB00B6 /* scalar_low.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scalar_low.h; sourceTree = ""; }; DCD2D8B82A1CF64A00AB00B6 /* eckey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eckey.h; sourceTree = ""; }; DCD2D91E2A1CF87200AB00B6 /* libsecp256k1-config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "libsecp256k1-config.h"; sourceTree = ""; }; - DCD2D9202A1CFA8400AB00B6 /* precompute_ecmult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = precompute_ecmult.c; sourceTree = ""; }; DCD2D9212A1CFA8400AB00B6 /* precomputed_ecmult_gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = precomputed_ecmult_gen.h; sourceTree = ""; }; DCD2D9242A1D15A300AB00B6 /* SchnorrSignature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchnorrSignature.swift; sourceTree = ""; }; DCEA3ABB2875AEBA00B0B0DA /* BiometricsStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BiometricsStorage.swift; sourceTree = ""; }; @@ -790,13 +792,6 @@ path = Frameworks; sourceTree = ""; }; - 5D06F6AE2756676C006A15B9 /* Entities */ = { - isa = PBXGroup; - children = ( - ); - path = Entities; - sourceTree = ""; - }; 5D0BAAEA25CD87DF00E6A2B6 /* Log */ = { isa = PBXGroup; children = ( @@ -1028,7 +1023,6 @@ 5D4B128126D40C67006E173C /* Backup */ = { isa = PBXGroup; children = ( - 5D06F6AE2756676C006A15B9 /* Entities */, 5D4B128226D40C77006E173C /* StartPrimaryCardLinkingCommand.swift */, 5DE43A5B26D4DC6400ECA36A /* StartBackupCardLinkingCommand.swift */, 5DE43A5F26D511CE00ECA36A /* LinkBackupCardsCommand.swift */, @@ -1093,7 +1087,7 @@ 5D6A92D52344E2B400158457 /* Localization */ = { isa = PBXGroup; children = ( - 5D6A92DA2344E2D700158457 /* Localizable.strings */, + B67A9C132B38D79500EE9ED8 /* Resources */, 5D6A92DB2344E3A500158457 /* Localization.swift */, ); path = Localization; @@ -1236,6 +1230,8 @@ 5DA80C90231D247A00A50A10 = { isa = PBXGroup; children = ( + B6B958982B2FCA8600E7B74E /* Gemfile */, + B6B958992B2FCA8600E7B74E /* TangemSdk.podspec */, 5DDF4F89235F06F600E46EAB /* Info.plist */, 5DA80C9C231D247A00A50A10 /* TangemSdk */, 5DA80CA7231D247A00A50A10 /* TangemSdkTests */, @@ -1272,6 +1268,7 @@ 5DA80CA7231D247A00A50A10 /* TangemSdkTests */ = { isa = PBXGroup; children = ( + B6CA42212B38B5A700C9A5C9 /* Extensions */, 5D38D0672679040C0052F67C /* Jsons */, 5DA80CA8231D247A00A50A10 /* CryptoUtilsTests.swift */, 5DA80CAA231D247A00A50A10 /* Info.plist */, @@ -1491,6 +1488,22 @@ path = Deserialization; sourceTree = ""; }; + B67A9C132B38D79500EE9ED8 /* Resources */ = { + isa = PBXGroup; + children = ( + 5D6A92DA2344E2D700158457 /* Localizable.strings */, + ); + path = Resources; + sourceTree = ""; + }; + B6CA42212B38B5A700C9A5C9 /* Extensions */ = { + isa = PBXGroup; + children = ( + B6CA42222B38B5AE00C9A5C9 /* Bundle+.swift */, + ); + path = Extensions; + sourceTree = ""; + }; DC1244BB29B61DAC0037BC05 /* BIP39 */ = { isa = PBXGroup; children = ( @@ -1575,12 +1588,12 @@ DCD2D7802A1CE66000AB00B6 /* include */ = { isa = PBXGroup; children = ( + B6936A662B387B040024826A /* secp256k1_tangem.h */, DCD2D7812A1CE66000AB00B6 /* secp256k1_ecdh.h */, DCD2D7822A1CE66000AB00B6 /* secp256k1_schnorrsig.h */, DCD2D7832A1CE66000AB00B6 /* secp256k1_recovery.h */, DCD2D7842A1CE66000AB00B6 /* secp256k1_extrakeys.h */, DCD2D7852A1CE66000AB00B6 /* secp256k1_preallocated.h */, - DCD2D7862A1CE66000AB00B6 /* secp256k1.h */, ); path = include; sourceTree = ""; @@ -1588,7 +1601,6 @@ DCD2D84C2A1CF64900AB00B6 /* src */ = { isa = PBXGroup; children = ( - DCD2D9202A1CFA8400AB00B6 /* precompute_ecmult.c */, DCD2D9212A1CFA8400AB00B6 /* precomputed_ecmult_gen.h */, DCD2D84E2A1CF64900AB00B6 /* scalar_impl.h */, DCD2D8512A1CF64900AB00B6 /* field_10x26_impl.h */, @@ -1757,12 +1769,12 @@ DCD2D8F62A1CF64A00AB00B6 /* assumptions.h in Headers */, DCD2D9232A1CFA8400AB00B6 /* precomputed_ecmult_gen.h in Headers */, DCD2D91F2A1CF87200AB00B6 /* libsecp256k1-config.h in Headers */, - DCD2D7F72A1CE66000AB00B6 /* secp256k1.h in Headers */, DCD2D8CD2A1CF64A00AB00B6 /* field_5x52.h in Headers */, DCD2D9012A1CF64A00AB00B6 /* int128_struct_impl.h in Headers */, DCD2D8D72A1CF64A00AB00B6 /* ecmult_gen_compute_table_impl.h in Headers */, DCD2D8FF2A1CF64A00AB00B6 /* ecmult_const.h in Headers */, DCD2D8D22A1CF64A00AB00B6 /* scalar_4x64.h in Headers */, + B6936A672B387B040024826A /* secp256k1_tangem.h in Headers */, DCD2D8C82A1CF64A00AB00B6 /* selftest.h in Headers */, DCD2D8EE2A1CF64A00AB00B6 /* int128_struct.h in Headers */, ); @@ -1816,8 +1828,9 @@ 5DA80C91231D247A00A50A10 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1310; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = "Tangem AG"; TargetAttributes = { 5DA80C99231D247A00A50A10 = { @@ -2041,7 +2054,6 @@ DC1244E829BB9E0C0037BC05 /* ExtendedKeySerializer.swift in Sources */, 5DA5B61C233E12B30058C720 /* Tlv.swift in Sources */, 5D0E56032757C11F00D46F54 /* CardDataResponse.swift in Sources */, - DCD2D9222A1CFA8400AB00B6 /* precompute_ecmult.c in Sources */, 5D06F6AD27565441006A15B9 /* StartPrimaryCardLinkingTask.swift in Sources */, 5D2F3EE526CBDAA100779CAC /* KeyboardAdaptive.swift in Sources */, 5D7D5FB223449D4000058D69 /* SessionEnvironment.swift in Sources */, @@ -2185,6 +2197,7 @@ 5DA7942A236C64D100B33DB5 /* IntUtilsTests.swift in Sources */, 5DA80CA9231D247A00A50A10 /* CryptoUtilsTests.swift in Sources */, 5D713B2D236C3F6400E4F6FC /* StringUtilsTest.swift in Sources */, + B6CA42232B38B5AE00C9A5C9 /* Bundle+.swift in Sources */, DC3D97FB2A77E079001EEE7A /* SLIP23Tests.swift in Sources */, DCB5A4E52A1FAC190021E12D /* BLSTests.swift in Sources */, DC1244C929B778750037BC05 /* BIP32Tests.swift in Sources */, @@ -2274,6 +2287,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -2288,7 +2302,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MODULEMAP_FILE = "$(SRCROOT)/TangemSdk/module.modulemap"; MODULEMAP_PRIVATE_FILE = ""; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; @@ -2353,6 +2367,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2361,7 +2376,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MODULEMAP_FILE = "$(SRCROOT)/TangemSdk/module.modulemap"; MODULEMAP_PRIVATE_FILE = ""; MTL_ENABLE_DEBUG_INFO = NO; @@ -2391,16 +2406,18 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 4897UJ6D8C; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2412,6 +2429,8 @@ ); MODULEMAP_FILE = ""; MODULEMAP_PRIVATE_FILE = ""; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; OTHER_LDFLAGS = ( "-weak_framework", Combine, @@ -2436,16 +2455,18 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 4897UJ6D8C; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2457,6 +2478,8 @@ ); MODULEMAP_FILE = ""; MODULEMAP_PRIVATE_FILE = ""; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; OTHER_LDFLAGS = ( "-weak_framework", Combine, diff --git a/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme b/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme index 2afc4f4a9..5ba81f39d 100644 --- a/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme +++ b/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme @@ -1,6 +1,6 @@ Int? { guard let shortLengthBytes = dataStream.readByte() else { - Log.error("Failed to read tag lenght") + Log.error("Failed to read tag length") return nil } if (shortLengthBytes == 0xFF) { guard let longLengthBytes = dataStream.readBytes(count: 2) else { - Log.error("Failed to read tag long lenght") + Log.error("Failed to read tag long length") return nil } diff --git a/TangemSdk/TangemSdk/Crypto/secp256k1/src/precompute_ecmult.c b/TangemSdk/TangemSdk/Crypto/secp256k1/src/precompute_ecmult.c deleted file mode 100644 index 2ff6560cb..000000000 --- a/TangemSdk/TangemSdk/Crypto/secp256k1/src/precompute_ecmult.c +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************************************** - * Copyright (c) 2013, 2014, 2017, 2021 Pieter Wuille, Andrew Poelstra, Jonas Nick, Russell O'Connor * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or https://www.opensource.org/licenses/mit-license.php. * - *****************************************************************************************************/ - -#include -#include - -#include "../include/secp256k1_tangem.h" - -#include "assumptions.h" -#include "util.h" - -#include "field_impl.h" -#include "group_impl.h" -#include "int128_impl.h" -#include "ecmult.h" -#include "ecmult_compute_table_impl.h" - -static void print_table(FILE *fp, const char *name, int window_g, const secp256k1_ge_storage* table) { - int j; - int i; - - fprintf(fp, "const secp256k1_ge_storage %s[ECMULT_TABLE_SIZE(WINDOW_G)] = {\n", name); - fprintf(fp, " S(%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32 - ",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32")\n", - SECP256K1_GE_STORAGE_CONST_GET(table[0])); - - j = 1; - for(i = 3; i <= window_g; ++i) { - fprintf(fp, "#if WINDOW_G > %d\n", i-1); - for(;j < ECMULT_TABLE_SIZE(i); ++j) { - fprintf(fp, ",S(%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32 - ",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32")\n", - SECP256K1_GE_STORAGE_CONST_GET(table[j])); - } - fprintf(fp, "#endif\n"); - } - fprintf(fp, "};\n"); -} - -static void print_two_tables(FILE *fp, int window_g) { - secp256k1_ge_storage* table = malloc(ECMULT_TABLE_SIZE(window_g) * sizeof(secp256k1_ge_storage)); - secp256k1_ge_storage* table_128 = malloc(ECMULT_TABLE_SIZE(window_g) * sizeof(secp256k1_ge_storage)); - - secp256k1_ecmult_compute_two_tables(table, table_128, window_g, &secp256k1_ge_const_g); - - print_table(fp, "secp256k1_pre_g", window_g, table); - print_table(fp, "secp256k1_pre_g_128", window_g, table_128); - - free(table); - free(table_128); -} - -int main(void) { - /* Always compute all tables for window sizes up to 15. */ - int window_g = (ECMULT_WINDOW_SIZE < 15) ? 15 : ECMULT_WINDOW_SIZE; - FILE* fp; - - fp = fopen("src/precomputed_ecmult.c","w"); - if (fp == NULL) { - fprintf(stderr, "Could not open src/precomputed_ecmult.h for writing!\n"); - return -1; - } - - fprintf(fp, "/* This file was automatically generated by precompute_ecmult. */\n"); - fprintf(fp, "/* This file contains an array secp256k1_pre_g with odd multiples of the base point G and\n"); - fprintf(fp, " * an array secp256k1_pre_g_128 with odd multiples of 2^128*G for accelerating the computation of a*P + b*G.\n"); - fprintf(fp, " */\n"); - fprintf(fp, "#include \"../include/secp256k1.h\"\n"); - fprintf(fp, "#include \"group.h\"\n"); - fprintf(fp, "#include \"ecmult.h\"\n"); - fprintf(fp, "#include \"precomputed_ecmult.h\"\n"); - fprintf(fp, "#define S(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SECP256K1_GE_STORAGE_CONST(0x##a##u,0x##b##u,0x##c##u,0x##d##u,0x##e##u,0x##f##u,0x##g##u,0x##h##u,0x##i##u,0x##j##u,0x##k##u,0x##l##u,0x##m##u,0x##n##u,0x##o##u,0x##p##u)\n"); - fprintf(fp, "#if ECMULT_WINDOW_SIZE > %d\n", window_g); - fprintf(fp, " #error configuration mismatch, invalid ECMULT_WINDOW_SIZE. Try deleting precomputed_ecmult.c before the build.\n"); - fprintf(fp, "#endif\n"); - fprintf(fp, "#ifdef EXHAUSTIVE_TEST_ORDER\n"); - fprintf(fp, "# error Cannot compile precomputed_ecmult.c in exhaustive test mode\n"); - fprintf(fp, "#endif /* EXHAUSTIVE_TEST_ORDER */\n"); - fprintf(fp, "#define WINDOW_G ECMULT_WINDOW_SIZE\n"); - - print_two_tables(fp, window_g); - - fprintf(fp, "#undef S\n"); - fclose(fp); - - return 0; -} diff --git a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift index 1fda1a416..f5a2b2e2d 100644 --- a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift @@ -1,11 +1,13 @@ -//// -//// ReadIssuerExtraDataCommand.swift -//// TangemSdk -//// -//// Created by Alexander Osokin on 26.02.2020. -//// Copyright © 2020 Tangem AG. All rights reserved. -//// // +// ReadIssuerExtraDataCommand.swift +// TangemSdk +// +// Created by Alexander Osokin on 26.02.2020. +// Copyright © 2020 Tangem AG. All rights reserved. +// + +import Foundation + /// This enum specifies modes for `ReadIssuerExtraDataCommand` and `WriteIssuerExtraDataCommand`. public enum IssuerExtraDataMode: Byte, InteractionMode { ///This mode is required to read issuer extra data from the card. This mode is required to initiate writing issuer extra data to the card. diff --git a/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift b/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift index f47a1c2f8..ea7b6b2d8 100644 --- a/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift +++ b/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift @@ -23,8 +23,9 @@ class HapticsEngine { func playSuccess() { if supportsHaptics { do { - - guard let path = Bundle.sdkBundle.path(forResource: "Success", ofType: "ahap") else { + let filePath = filePath(forResource: "Success") + + guard let path = Bundle.sdkBundle.path(forResource: filePath, ofType: "ahap") else { return } @@ -40,7 +41,9 @@ class HapticsEngine { func playError() { if supportsHaptics { do { - guard let path = Bundle.sdkBundle.path(forResource: "Error", ofType: "ahap") else { + let filePath = filePath(forResource: "Error") + + guard let path = Bundle.sdkBundle.path(forResource: filePath, ofType: "ahap") else { return } @@ -139,4 +142,17 @@ class HapticsEngine { Log.error("CHHapticEngine error: \(error)") } } + + /// SPM preserves folder structure for resources, unlike Cocoapods. + /// Therefore, a full file path with all intermediate directories must be constructed. + private func filePath(forResource resource: String) -> String { +#if SWIFT_PACKAGE + return [ + "Haptics", + resource, + ].joined(separator: "/") +#else + return resource +#endif // SWIFT_PACKAGE + } } diff --git a/TangemSdk/TangemSdkTests/BIP39Tests.swift b/TangemSdk/TangemSdkTests/BIP39Tests.swift index d7aead555..d8fdb033a 100644 --- a/TangemSdk/TangemSdkTests/BIP39Tests.swift +++ b/TangemSdk/TangemSdkTests/BIP39Tests.swift @@ -111,11 +111,7 @@ class BIP39Tests: XCTestCase { } private func getTestVectors(from filename: String) throws -> [String: Any]? { - guard let url = Bundle(for: type(of: self)).url(forResource: filename, withExtension: "json") else { - return nil - } - - let data = try Data(contentsOf: url) + let data = try Bundle.readFileAsData(name: filename, in: .bip39) guard let dictionary = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { return nil diff --git a/TangemSdk/TangemSdkTests/Extensions/Bundle+.swift b/TangemSdk/TangemSdkTests/Extensions/Bundle+.swift new file mode 100644 index 000000000..b201286e1 --- /dev/null +++ b/TangemSdk/TangemSdkTests/Extensions/Bundle+.swift @@ -0,0 +1,52 @@ +// +// Bundle+.swift +// TangemSdkTests +// +// Created by m3g0byt3 on 24.12.2023. +// Copyright © 2023 Tangem AG. All rights reserved. +// + +import Foundation + +extension Bundle { + enum Folder: String { + case bip39 = "BIP39" + case files = "Files" + case personalize = "Personalize" + case root = "" + } + + static func readFileAsString(name: String, in folder: Folder) throws -> String { + let filePath = filePath(name: name, in: folder) + + return try String(contentsOfFile: filePath) + } + + static func readFileAsData(name: String, in folder: Folder) throws -> Data { + let filePath = filePath(name: name, in: folder) + + return try Data(contentsOf: URL(fileURLWithPath: filePath)) + } + + /// SPM preserves folder structure for resources, unlike Cocoapods. + /// Therefore, a full file path with all intermediate directories must be constructed. + private static func filePath(name: String, in folder: Folder) -> String { +#if SWIFT_PACKAGE + let bundle = Bundle.module + let resource = [ + "Jsons", + folder.rawValue, + name, + ].joined(separator: "/") +#else + let bundle = Bundle(for: Dummy.self) + let resource = name +#endif // SWIFT_PACKAGE + + return bundle.path(forResource: resource, ofType: "json")! + } +} + +#if !SWIFT_PACKAGE +private final class Dummy {} +#endif // SWIFT_PACKAGE diff --git a/TangemSdk/TangemSdkTests/JSONRPCTests.swift b/TangemSdk/TangemSdkTests/JSONRPCTests.swift index 37ccfd8e3..6f3d03221 100644 --- a/TangemSdk/TangemSdkTests/JSONRPCTests.swift +++ b/TangemSdk/TangemSdkTests/JSONRPCTests.swift @@ -13,10 +13,12 @@ import XCTest @available(iOS 13.0, *) class JSONRPCTests: XCTestCase { var testCard: Card { - let json = readFile(name: "Card") - let data = json.data(using: .utf8) - XCTAssertNotNil(data) - return try! JSONDecoder.tangemSdkDecoder.decode(Card.self, from: data!) + get throws { + let json = try Bundle.readFileAsString(name: "Card", in: .root) + let data = json.data(using: .utf8) + XCTAssertNotNil(data) + return try JSONDecoder.tangemSdkDecoder.decode(Card.self, from: data!) + } } func testDecodeMasterExtendedPublicKey() throws { @@ -112,11 +114,11 @@ class JSONRPCTests: XCTestCase { XCTAssert(data[1] == Data(hexString: "AABBCCDDEEFFGG")) } - func testScan() { - testMethod(name: "Scan", result: testCard) + func testScan() throws { + try testMethod(name: "Scan", in: .root, result: testCard) } - func testCreateWallet() { + func testCreateWallet() throws { let result = CreateWalletResponse(cardId: "c000111122223333", wallet: Card.Wallet(publicKey: Data(hexString: "5130869115a2ff91959774c99d4dc2873f0c41af3e0bb23d027ab16d39de1348"), chainCode: nil, @@ -128,10 +130,10 @@ class JSONRPCTests: XCTestCase { proof: nil, isImported: false, hasBackup: false)) - testMethod(name: "CreateWallet", result: result) + try testMethod(name: "CreateWallet", in: .root, result: result) } - func testImportWalletMnemonic() { + func testImportWalletMnemonic() throws { let result = CreateWalletResponse(cardId: "c000111122223333", wallet: Card.Wallet(publicKey: Data(hexString: "029983A77B155ED3B3B9E1DDD223BD5AA073834C8F61113B2F1B883AAA70971B5F"), chainCode: Data(hexString: "C7A888C4C670406E7AAEB6E86555CE0C4E738A337F9A9BC239F6D7E475110A4E"), @@ -143,95 +145,95 @@ class JSONRPCTests: XCTestCase { proof: nil, isImported: false, hasBackup: false)) - testMethod(name: "ImportWalletMnemonic", result: result) + try testMethod(name: "ImportWalletMnemonic", in: .root, result: result) } - func testPurgeWallet() { + func testPurgeWallet() throws { let result = PurgeWalletCommand.Response(cardId: "c000111122223333") - testMethod(name: "PurgeWallet", result: result) + try testMethod(name: "PurgeWallet", in: .root, result: result) } - func testDepersonalize() { + func testDepersonalize() throws { let result = DepersonalizeResponse(success: true) - testMethod(name: "Depersonalize", result: result) + try testMethod(name: "Depersonalize", in: .root, result: result) } - func testPersonalize() { - testPersonalizeConfig(name: "v4") - testPersonalizeConfig(name: "v3.05ada") + func testPersonalize() throws { + try testPersonalizeConfig(name: "v4") + try testPersonalizeConfig(name: "v3.05ada") } - func testSetPin1() { + func testSetPin1() throws { let result = SuccessResponse(cardId: "c000111122223333") - testMethod(name: "SetAccessCode", result: result) + try testMethod(name: "SetAccessCode", in: .root, result: result) } - func testSetPin2() { + func testSetPin2() throws { let result = SuccessResponse(cardId: "c000111122223333") - testMethod(name: "SetPasscode", result: result) + try testMethod(name: "SetPasscode", in: .root, result: result) } - func testSignHashes() { + func testSignHashes() throws { let result = SignHashesResponse(cardId: "c000111122223333", signatures: [Data(hexString: "eb7411c2b7d871c06dad51e58e44746583ad134f4e214e4899f2fc84802232a1"), Data(hexString: "33443bd93f350b62a90a0c23d30c6d4e9bb164606e809ccace60cf0e2591e58c")], totalSignedHashes: 2) - testMethod(name: "SignHashes", result: result) + try testMethod(name: "SignHashes", in: .root, result: result) } - func testSignHash() { + func testSignHash() throws { let result = SignHashResponse(cardId: "c000111122223333", signature: Data(hexString: "eb7411c2b7d871c06dad51e58e44746583ad134f4e214e4899f2fc84802232a1"), totalSignedHashes: 2) - testMethod(name: "SignHash", result: result) + try testMethod(name: "SignHash", in: .root, result: result) } - func testDerivePublicKey() { + func testDerivePublicKey() throws { let result = ExtendedPublicKey(publicKey: Data(hexString: "0200300397571D99D41BB2A577E2CBE495C04AC5B9A97B7A4ECF999F23CE45E962"), chainCode: Data(hexString: "537F7361175B150732E17508066982B42D9FB1F8239C4D7BFC490088C83A8BBB")) - testMethod(name: "DeriveWalletPublicKey", result: result) + try testMethod(name: "DeriveWalletPublicKey", in: .root, result: result) } - func testDerivePublicKeys() { + func testDerivePublicKeys() throws { let keys = [try! DerivationPath(rawPath: "m/44'/0'") : ExtendedPublicKey(publicKey: Data(hexString: "0200300397571D99D41BB2A577E2CBE495C04AC5B9A97B7A4ECF999F23CE45E962"), chainCode: Data(hexString: "537F7361175B150732E17508066982B42D9FB1F8239C4D7BFC490088C83A8BBB")), try! DerivationPath(rawPath: "m/44'/1'") : ExtendedPublicKey(publicKey: Data(hexString: "0200300397571D99D41BB2A577E2CBE495C04AC5B9A97B7A4ECF999F23CE45E962"), chainCode: Data(hexString: "537F7361175B150732E17508066982B42D9FB1F8239C4D7BFC490088C83A8BBB"))] let result = DerivedKeys(keys: keys) - testMethod(name: "DeriveWalletPublicKeys", result: result) + try testMethod(name: "DeriveWalletPublicKeys", in: .root, result: result) } - func testUserCodeRecoveryAllowed() { + func testUserCodeRecoveryAllowed() throws { let result = SuccessResponse(cardId: "c000111122223333") - testMethod(name: "SetUserCodeRecoveryAllowed", result: result) + try testMethod(name: "SetUserCodeRecoveryAllowed", in: .root, result: result) } - func testAttestCardKey() { + func testAttestCardKey() throws { let result = AttestCardKeyResponse(cardId: "c000111122223333", salt: Data(hexString: "BBBBBBBBBBBB"), cardSignature: Data(hexString: "AAAAAAAAAAAA"), challenge: Data(hexString: "000000000000"), linkedCardPublicKeys: []) - testMethod(name: "AttestCardKey", result: result) + try testMethod(name: "AttestCardKey", in: .root, result: result) } - func testFiles() { - testMethod(name: "ReadFiles", result: [File(data: Data(hexString: "00AABBCCDD"), + func testFiles() throws { + try testMethod(name: "ReadFiles", in: .files, result: [File(data: Data(hexString: "00AABBCCDD"), index: 0, settings: FileSettings(isPermanent: false, visibility: .public))]) - testMethod(name: "DeleteFiles", result: DeleteFilesTask.Response(cardId: "c000111122223333")) - testMethod(name: "WriteFiles", result: WriteFilesTask.Response(cardId: "c000111122223333", filesIndices: [0,1])) - testMethod(name: "ChangeFileSettings", result: ChangeFileSettingsTask.Response(cardId: "c000111122223333")) + try testMethod(name: "DeleteFiles", in: .files, result: DeleteFilesTask.Response(cardId: "c000111122223333")) + try testMethod(name: "WriteFiles", in: .files, result: WriteFilesTask.Response(cardId: "c000111122223333", filesIndices: [0,1])) + try testMethod(name: "ChangeFileSettings", in: .files, result: ChangeFileSettingsTask.Response(cardId: "c000111122223333")) } func testMethodNotFound() { @@ -248,9 +250,9 @@ class JSONRPCTests: XCTestCase { } } - func testParseRequest() { + func testParseRequest() throws { let name = "TestParseRequest" - let fileText = readFile(name: name) + let fileText = try Bundle.readFileAsString(name: name, in: .root) let jsonData = fileText.data(using: .utf8)! do { @@ -299,8 +301,8 @@ class JSONRPCTests: XCTestCase { } } - private func testPersonalizeConfig(name: String) { - guard let testData = getTestData(for: name) else { + private func testPersonalizeConfig(name: String) throws { + guard let testData = try getTestData(for: name, in: .personalize) else { XCTAssert(false, "Failed to create test data \(name)") return } @@ -316,8 +318,8 @@ class JSONRPCTests: XCTestCase { } } - private func testMethod(name: String, result: TResult) { - guard let testData = getTestData(for: name) else { + private func testMethod(name: String, in folder: Bundle.Folder, result: TResult) throws { + guard let testData = try getTestData(for: name, in: folder) else { XCTAssert(false, "Failed to create test data \(name)") return } @@ -345,25 +347,8 @@ class JSONRPCTests: XCTestCase { XCTAssertEqual(resultData.utf8String!.lowercased(), resultJsonData.utf8String!.lowercased()) } - private func testMethodRequest(name: String) { - guard let testData = getTestData(for: name) else { - XCTAssert(false, "Failed to create test data \(name)") - return - } - - //test request - do { - let request = try JSONRPCRequest(jsonString: testData.request) - //test convert request - XCTAssertNoThrow(try JSONRPCConverter.shared.convert(request: request)) - } catch { - XCTAssert(false, "Failed to create request for \(name)") - return - } - } - - private func getTestData(for method: String) -> (request: String, response: Data)? { - let fileText = readFile(name: method) + private func getTestData(for method: String, in folder: Bundle.Folder) throws -> (request: String, response: Data)? { + let fileText = try Bundle.readFileAsString(name: method, in: folder) let jsonData = fileText.data(using: .utf8)! do { @@ -379,7 +364,7 @@ class JSONRPCTests: XCTestCase { if let response = json["response"] { responseData = try JSONSerialization.data(withJSONObject: response, options: .prettyPrinted) } else { - let cardResponse = "{\"result\": \(testCard.json)}" + let cardResponse = "{\"result\": \(try testCard.json)}" responseData = cardResponse.data(using: .utf8)! } @@ -395,10 +380,4 @@ class JSONRPCTests: XCTestCase { return nil } } - - private func readFile(name: String) -> String { - let bundle = Bundle(for: type(of: self)) - let path = bundle.path(forResource: name, ofType: "json")! - return try! String(contentsOfFile: path) - } }