diff --git a/Package.swift b/Package.swift index 2262457..a131d3f 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,7 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(name: "TorusUtils", url: "https://github.com/torusresearch/torus-utils-swift" , from: "6.0.1"), + .package(name: "TorusUtils", url: "https://github.com/torusresearch/torus-utils-swift" , from: "6.1.0"), // dev dependencies only .package(name:"CryptoSwift", url: "https://github.com/krzyzanowskim/CryptoSwift.git",from: "1.5.1"), .package(name:"jwt-kit", url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0"), diff --git a/Sources/ThresholdKey/Modules/TssModule.swift b/Sources/ThresholdKey/Modules/TssModule.swift index f0977e5..32670e6 100644 --- a/Sources/ThresholdKey/Modules/TssModule.swift +++ b/Sources/ThresholdKey/Modules/TssModule.swift @@ -546,9 +546,17 @@ public final class TssModule { guard let resultJson = try JSONSerialization.jsonObject(with: resultData) as? [String: Any] else { throw "Invalid factor key" } - guard let deviceShareJson = resultJson["deviceShare"] as? [String: Any] else { - throw "Invalid factor key" + + var deviceShareJson = resultJson; + + // backward competible + if resultJson["deviceShare"] != nil { + guard let deviceShare = resultJson["deviceShare"] as? [String: Any] else { + throw "Invalid factor key" + } + deviceShareJson = deviceShare } + guard let shareJson = deviceShareJson["share"] as? [String: Any] else { throw "Invalid factor key" } diff --git a/Sources/libtkey/include/tkey.h b/Sources/libtkey/include/tkey.h index 809cda3..1185670 100644 --- a/Sources/libtkey/include/tkey.h +++ b/Sources/libtkey/include/tkey.h @@ -30,7 +30,6 @@ struct TssOptions; struct NodeDetails; struct FFIRssComm; - //Methods char* get_version(int* error_code); void string_free(char *ptr); @@ -80,6 +79,7 @@ void generate_share_store_result_free(struct GenerateShareStoreResult* ptr); void share_store_poly_id_index_map_free(struct ShareStorePolyIDShareIndexMap* ptr); struct GenerateShareStoreResult* threshold_key_generate_share(struct FFIThresholdKey* threshold_key, char* curve_n, bool use_tss, struct TssOptions* tss_options, int* error_code); + void threshold_key_import_tss_key(struct FFIThresholdKey* threshold_key, bool update_metadata, char* tss_tag, char* import_key, int new_tss_index, struct KeyPoint* factor_pub, char* selected_servers, char* auth_signatures, char* curve_n, int* error_code); void threshold_key_delete_share(struct FFIThresholdKey* threshold_key, char* share_index, char* curve_n, bool use_tss, struct TssOptions* tss_options, int* error_code); void threshold_key_delete_tkey(struct FFIThresholdKey* threshold_key, char* curve_n, int* error_code); char* threshold_key_output_share(struct FFIThresholdKey* threshold_key, char* share_index, char* share_type, char* curve_n, int* error_code); @@ -199,10 +199,10 @@ // TssOptions struct TssOptions* tss_options(char* input_tss_share, int input_tss_index, struct KeyPoint* factor_pub, char* auth_signatures, char* selected_servers, int* new_tss_index, struct KeyPoint* new_factor_pub, int* error_code); void tss_options_free(struct TssOptions* ptr); - //NodeDetails + // NodeDetails struct NodeDetails* node_details(char* server_endpoints, char* server_public_keys, int server_threshold, int* error_code); void node_details_free(struct NodeDetails* ptr); - //RssComm + // RssComm struct FFIRSSComm* rss_comm(char* (*network_callback)(char*, char*, void*, int*), void* parent_instance_ref, int* error_code); void* rss_comm_free(struct FFIRssComm* ptr); #ifdef __cplusplus diff --git a/Sources/libtkey/libtkey.xcframework/Info.plist b/Sources/libtkey/libtkey.xcframework/Info.plist index 51ab6cd..d14a1c2 100644 --- a/Sources/libtkey/libtkey.xcframework/Info.plist +++ b/Sources/libtkey/libtkey.xcframework/Info.plist @@ -5,8 +5,10 @@ AvailableLibraries + BinaryPath + libtkey.a LibraryIdentifier - ios-arm64_x86_64-simulator + macos-arm64_x86_64 LibraryPath libtkey.a SupportedArchitectures @@ -15,21 +17,24 @@ x86_64 SupportedPlatform - ios - SupportedPlatformVariant - simulator + macos + BinaryPath + libtkey.a LibraryIdentifier - ios-arm64 + ios-arm64_x86_64-simulator LibraryPath libtkey.a SupportedArchitectures arm64 + x86_64 SupportedPlatform ios + SupportedPlatformVariant + simulator CFBundlePackageType diff --git a/Sources/libtkey/libtkey.xcframework/ios-arm64_x86_64-simulator/libtkey.a b/Sources/libtkey/libtkey.xcframework/ios-arm64_x86_64-simulator/libtkey.a index ab241f2..68a4bcc 100644 Binary files a/Sources/libtkey/libtkey.xcframework/ios-arm64_x86_64-simulator/libtkey.a and b/Sources/libtkey/libtkey.xcframework/ios-arm64_x86_64-simulator/libtkey.a differ diff --git a/Sources/libtkey/libtkey.xcframework/macos-arm64_x86_64/libtkey.a b/Sources/libtkey/libtkey.xcframework/macos-arm64_x86_64/libtkey.a new file mode 100644 index 0000000..cc4907d Binary files /dev/null and b/Sources/libtkey/libtkey.xcframework/macos-arm64_x86_64/libtkey.a differ diff --git a/Tests/tkeypkgTests/IntegrationTests.swift b/Tests/tkeypkgTests/IntegrationTests.swift index c7e8ca6..1c07a5a 100644 --- a/Tests/tkeypkgTests/IntegrationTests.swift +++ b/Tests/tkeypkgTests/IntegrationTests.swift @@ -149,7 +149,9 @@ final class integrationTests: XCTestCase { let share = try threshold.output_share(shareIndex: shareIndex.hex) print(share) - let testTags = ["tag1", "tag2", "tag3", "tag4", "tag5"] + // Too much tags with too much shares cause the ios complaint + // `Receive failed with error "Message too long"` + let testTags = ["tag1", "tag2", "tag3", "tags4"] var tssMods: [(ThresholdKey, String)] = []