Skip to content

Commit

Permalink
Merge pull request #20 from tkey/feat/support-jsformat
Browse files Browse the repository at this point in the history
feat: support js format
  • Loading branch information
ieow authored Jan 9, 2024
2 parents afd10e6 + da91dfa commit e2ab8ad
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
12 changes: 10 additions & 2 deletions Sources/ThresholdKey/Modules/TssModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Loading

0 comments on commit e2ab8ad

Please sign in to comment.