Skip to content

Commit e2ab8ad

Browse files
authored
Merge pull request #20 from tkey/feat/support-jsformat
feat: support js format
2 parents afd10e6 + da91dfa commit e2ab8ad

File tree

7 files changed

+27
-12
lines changed

7 files changed

+27
-12
lines changed

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
dependencies: [
1818
// Dependencies declare other packages that this package depends on.
1919
// .package(url: /* package url */, from: "1.0.0"),
20-
.package(name: "TorusUtils", url: "https://github.com/torusresearch/torus-utils-swift" , from: "6.0.1"),
20+
.package(name: "TorusUtils", url: "https://github.com/torusresearch/torus-utils-swift" , from: "6.1.0"),
2121
// dev dependencies only
2222
.package(name:"CryptoSwift", url: "https://github.com/krzyzanowskim/CryptoSwift.git",from: "1.5.1"),
2323
.package(name:"jwt-kit", url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0"),

Sources/ThresholdKey/Modules/TssModule.swift

+10-2
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,17 @@ public final class TssModule {
546546
guard let resultJson = try JSONSerialization.jsonObject(with: resultData) as? [String: Any] else {
547547
throw "Invalid factor key"
548548
}
549-
guard let deviceShareJson = resultJson["deviceShare"] as? [String: Any] else {
550-
throw "Invalid factor key"
549+
550+
var deviceShareJson = resultJson;
551+
552+
// backward competible
553+
if resultJson["deviceShare"] != nil {
554+
guard let deviceShare = resultJson["deviceShare"] as? [String: Any] else {
555+
throw "Invalid factor key"
556+
}
557+
deviceShareJson = deviceShare
551558
}
559+
552560
guard let shareJson = deviceShareJson["share"] as? [String: Any] else {
553561
throw "Invalid factor key"
554562
}

0 commit comments

Comments
 (0)