Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support js format #20

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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