From 4d01a8d07cfbde3c23b468d1f234a4a73b0ca200 Mon Sep 17 00:00:00 2001 From: metalurgical <97008724+metalurgical@users.noreply.github.com> Date: Sun, 6 Oct 2024 01:02:27 +0200 Subject: [PATCH 1/2] refactor: update to latest fetch node details update --- Package.resolved | 22 +++++++++---------- Package.swift | 2 +- Sources/TorusUtils/Helpers/Error.swift | 6 ++--- .../TorusUtils/Helpers/MetadataUtils.swift | 6 ++--- Sources/TorusUtils/Helpers/NodeUtils.swift | 14 ++++++------ .../TorusUtils/Interfaces/TorusOptions.swift | 4 ++-- Sources/TorusUtils/TorusUtils.swift | 21 ++++-------------- Tests/TorusUtilsTests/AquaTest.swift | 4 ++-- Tests/TorusUtilsTests/Celeste.swift | 8 +++---- Tests/TorusUtilsTests/CyanTest.swift | 4 ++-- Tests/TorusUtilsTests/MainnetTest.swift | 8 +++---- .../TorusUtilsTests/SapphireDevnetTest.swift | 4 ++-- .../SapphireMainnetTests.swift | 4 ++-- Tests/TorusUtilsTests/TestnetTest.swift | 8 +++---- Tests/TorusUtilsTests/oneKeyTest.swift | 4 ++-- Torus-utils.podspec | 4 ++-- 16 files changed, 55 insertions(+), 68 deletions(-) diff --git a/Package.resolved b/Package.resolved index 99bb4888..dacbf1a7 100644 --- a/Package.resolved +++ b/Package.resolved @@ -3,10 +3,10 @@ { "identity" : "bigint", "kind" : "remoteSourceControl", - "location" : "https://github.com/attaswift/BigInt", + "location" : "https://github.com/attaswift/BigInt.git", "state" : { - "revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6", - "version" : "5.3.0" + "revision" : "793a7fac0bfc318e85994bf6900652e827aef33e", + "version" : "5.4.1" } }, { @@ -21,19 +21,19 @@ { "identity" : "fetch-node-details-swift", "kind" : "remoteSourceControl", - "location" : "https://github.com/torusresearch/fetch-node-details-swift.git", + "location" : "https://github.com/torusresearch/fetch-node-details-swift", "state" : { - "revision" : "4bd96c33ba8d02d9e27190c5c7cedf09cfdfd656", - "version" : "6.0.3" + "branch" : "encapsulate_torusnetwork", + "revision" : "2fcd108ea89a48f092a955017977a299129d20c7" } }, { "identity" : "jwt-kit", "kind" : "remoteSourceControl", - "location" : "https://github.com/vapor/jwt-kit", + "location" : "https://github.com/vapor/jwt-kit.git", "state" : { - "revision" : "e05513b5aec24f88012b6e3034115b6bc915356a", - "version" : "4.13.2" + "revision" : "c2595b9ad7f512d7f334830b4df1fed6e917946a", + "version" : "4.13.4" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "f0525da24dc3c6cbb2b6b338b65042bc91cbc4bb", - "version" : "3.3.0" + "revision" : "ffca28be3c9c6a86a579949d23f68818a4b9b5d8", + "version" : "3.8.0" } } ], diff --git a/Package.swift b/Package.swift index 25e8de38..5baef24c 100644 --- a/Package.swift +++ b/Package.swift @@ -12,7 +12,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/tkey/curvelib.swift", from: "1.0.1"), - .package(url: "https://github.com/torusresearch/fetch-node-details-swift", from: "6.0.3"), + .package(url: "https://github.com/torusresearch/fetch-node-details-swift", branch: "encapsulate_torusnetwork"), // TODO: Update to 7.0.0 // NB: jwt-kit may only be a dependency in tests or it will break cocoapod support .package(url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0"), ], diff --git a/Sources/TorusUtils/Helpers/Error.swift b/Sources/TorusUtils/Helpers/Error.swift index a11f87ba..70739916 100644 --- a/Sources/TorusUtils/Helpers/Error.swift +++ b/Sources/TorusUtils/Helpers/Error.swift @@ -12,7 +12,7 @@ public enum TorusUtilError: Error, Equatable { case invalidKeySize case invalidPubKeySize case runtime(_ msg: String) - case retrieveOrImportShareError + case retrieveOrImportShareError(_ msg: String) case metadataNonceMissing case pubNonceMissing case gatingError(_ msg: String = "") @@ -46,8 +46,8 @@ extension TorusUtilError: CustomDebugStringConvertible { return "Invalid key size. Expected 64 bytes" case let .encodingFailed(msg): return "Could not encode data" + msg - case .retrieveOrImportShareError: - return "retrieve or import share failed" + case let .retrieveOrImportShareError(msg): + return msg case .metadataNonceMissing: return "Unable to fetch metadata nonce" case let .gatingError(msg): diff --git a/Sources/TorusUtils/Helpers/MetadataUtils.swift b/Sources/TorusUtils/Helpers/MetadataUtils.swift index ecb70c0c..ea97c44b 100644 --- a/Sources/TorusUtils/Helpers/MetadataUtils.swift +++ b/Sources/TorusUtils/Helpers/MetadataUtils.swift @@ -74,7 +74,7 @@ internal class MetadataUtils { let val = try await urlSession.data(for: request) let data: GetMetadataResponse = try JSONDecoder().decode(GetMetadataResponse.self, from: val.0) let msg: String = data.message - let ret = BigUInt(msg, radix: 16)! + let ret = BigUInt(msg, radix: 16) ?? 0 return ret } @@ -99,8 +99,8 @@ internal class MetadataUtils { return decoded } - public static func getOrSetSapphireMetadataNonce(metadataHost: String, network: TorusNetwork, X: String, Y: String, serverTimeOffset: Int? = nil, privateKey: String? = nil, getOnly: Bool = false, keyType: TorusKeyType = .secp256k1) async throws -> GetOrSetNonceResult { - if case .sapphire = network { + public static func getOrSetSapphireMetadataNonce(metadataHost: String, network: Web3AuthNetwork, X: String, Y: String, serverTimeOffset: Int? = nil, privateKey: String? = nil, getOnly: Bool = false, keyType: TorusKeyType = .secp256k1) async throws -> GetOrSetNonceResult { + if network.isSapphire { return try await getOrSetNonce(legacyMetadataHost: metadataHost, serverTimeOffset: serverTimeOffset ?? Int(trunc(Double(0 + Int(Date().timeIntervalSince1970)))), X: X, Y: Y, privateKey: privateKey, getOnly: getOnly, keyType: keyType) } else { throw TorusUtilError.metadataNonceMissing diff --git a/Sources/TorusUtils/Helpers/NodeUtils.swift b/Sources/TorusUtils/Helpers/NodeUtils.swift index 74b90c8c..bf7b8b6d 100644 --- a/Sources/TorusUtils/Helpers/NodeUtils.swift +++ b/Sources/TorusUtils/Helpers/NodeUtils.swift @@ -9,7 +9,7 @@ import OSLog internal class NodeUtils { public static func getPubKeyOrKeyAssign( endpoints: [String], - network: TorusNetwork, + network: Web3AuthNetwork, verifier: String, verifierId: String, legacyMetadataHost: String, @@ -122,7 +122,7 @@ internal class NodeUtils { serverTimeOffset: Int?, enableOneKey: Bool, allowHost: String, - network: TorusNetwork, + network: Web3AuthNetwork, clientId: String, endpoints: [String], verifier: String, @@ -364,7 +364,7 @@ internal class NodeUtils { } if thresholdPublicKey == nil { - throw TorusUtilError.retrieveOrImportShareError + throw TorusUtilError.retrieveOrImportShareError("invalid result from nodes, threshold number of public key results are not matching, please check configuration") } for item in shareResponses { @@ -395,7 +395,7 @@ internal class NodeUtils { // Invert comparision to return error early if !(shareResponses.count >= thresholdReqCount && thresholdPublicKey != nil && (thresholdNonceData != nil || verifierParams.extended_verifier_id != nil || TorusUtils.isLegacyNetworkRouteMap(network: network))) { - throw TorusUtilError.retrieveOrImportShareError + throw TorusUtilError.retrieveOrImportShareError("invalid result from nodes, threshold number of public key results are not matching") } var shares: [String?] = [] @@ -450,13 +450,13 @@ internal class NodeUtils { let validSigs = sessionTokenSigs.filter({ $0 != nil }).map({ $0! }) if verifierParams.extended_verifier_id == nil && validSigs.count < threshold { - throw TorusUtilError.retrieveOrImportShareError + throw TorusUtilError.retrieveOrImportShareError("Insufficient number of signatures from nodes") } let validTokens = sessionTokens.filter({ $0 != nil }).map({ $0! }) if verifierParams.extended_verifier_id == nil && validTokens.count < threshold { - throw TorusUtilError.runtime("Insufficient number of signatures from nodes") + throw TorusUtilError.retrieveOrImportShareError("Insufficient number of signatures from nodes") } for (i, item) in sessionTokens.enumerated() { @@ -560,7 +560,7 @@ internal class NodeUtils { } if finalPubKey == nil { - throw TorusUtilError.retrieveOrImportShareError + throw TorusUtilError.retrieveOrImportShareError("Invalid public key, this might be a bug, please report this to web3auth team") } let oAuthKeyAddress = try KeyUtils.generateAddressFromPubKey(publicKeyX: oAuthPublicKeyX, publicKeyY: oAuthPublicKeyY) diff --git a/Sources/TorusUtils/Interfaces/TorusOptions.swift b/Sources/TorusUtils/Interfaces/TorusOptions.swift index 2dd1795e..f07b9f3f 100644 --- a/Sources/TorusUtils/Interfaces/TorusOptions.swift +++ b/Sources/TorusUtils/Interfaces/TorusOptions.swift @@ -5,7 +5,7 @@ import Foundation public class TorusOptions { public var enableOneKey: Bool public var clientId: String - public var network: TorusNetwork + public var network: Web3AuthNetwork public var serverTimeOffset: Int public var legacyMetadataHost: String? @@ -19,7 +19,7 @@ public class TorusOptions { /// - enableOneKey: Use the oneKey flow. /// /// - Returns: `TorusOptions` - public init(clientId: String, network: TorusNetwork, legacyMetadataHost: String? = nil, serverTimeOffset: Int = 0, enableOneKey: Bool = false) { + public init(clientId: String, network: Web3AuthNetwork, legacyMetadataHost: String? = nil, serverTimeOffset: Int = 0, enableOneKey: Bool = false) { self.clientId = clientId self.enableOneKey = enableOneKey self.network = network diff --git a/Sources/TorusUtils/TorusUtils.swift b/Sources/TorusUtils/TorusUtils.swift index e77afc12..ff11fe04 100644 --- a/Sources/TorusUtils/TorusUtils.swift +++ b/Sources/TorusUtils/TorusUtils.swift @@ -15,7 +15,7 @@ public class TorusUtils { var serverTimeOffset: Int? - var network: TorusNetwork + var network: Web3AuthNetwork var clientId: String @@ -39,20 +39,7 @@ public class TorusUtils { public init(params: TorusOptions, loglevel: OSLogType = .default) throws { var defaultHost = "" if params.legacyMetadataHost == nil { - if case let .legacy(urlHost) = params.network { - defaultHost = urlHost.metadataMap - } else { - // TODO: Move this into fetchNodeDetails metadataMap - if case let .sapphire(sapphireNetwork) = params.network { - if sapphireNetwork == .SAPPHIRE_MAINNET { - defaultHost = "https://node-1.node.web3auth.io/metadata" - } else { - defaultHost = "https://node-1.dev-node.web3auth.io/metadata" - } - } else { - throw TorusUtilError.invalidInput - } - } + defaultHost = try params.network.metadataMap } else { defaultHost = params.legacyMetadataHost! } @@ -67,8 +54,8 @@ public class TorusUtils { signerHost = params.network.signerMap + "/api/sign" } - internal static func isLegacyNetworkRouteMap(network: TorusNetwork) -> Bool { - if case .legacy = network { + internal static func isLegacyNetworkRouteMap(network: Web3AuthNetwork) -> Bool { + if network.isLegacy { return true } return false diff --git a/Tests/TorusUtilsTests/AquaTest.swift b/Tests/TorusUtilsTests/AquaTest.swift index 69359a20..419ce40a 100644 --- a/Tests/TorusUtilsTests/AquaTest.swift +++ b/Tests/TorusUtilsTests/AquaTest.swift @@ -13,8 +13,8 @@ class AquaTest: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .legacy(.AQUA)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .legacy(.AQUA))) + fnd = NodeDetailManager(network: .AQUA) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .AQUA)) } func test_should_fetch_public_address() async throws { diff --git a/Tests/TorusUtilsTests/Celeste.swift b/Tests/TorusUtilsTests/Celeste.swift index 8f4c3a88..79f9b78a 100644 --- a/Tests/TorusUtilsTests/Celeste.swift +++ b/Tests/TorusUtilsTests/Celeste.swift @@ -13,15 +13,15 @@ class CelesteTest: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .legacy(.CELESTE)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .legacy(.CELESTE))) + fnd = NodeDetailManager(network: .CELESTE) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .CELESTE)) } func test_should_fetch_public_address() async throws { let verifier = "tkey-google-celeste" let verifierID = TORUS_TEST_EMAIL let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) - let val = try await torus.getPublicAddress(endpoints: nodeDetails.torusNodeEndpoints, verifier: verifier, verifierId: verifierID) + let val = try await torus.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) XCTAssertEqual(val.finalKeyData!.evmAddress, "0xC3115b9d6FaB99739b23DA9dfcBA47A4Ec4Cd113") XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) @@ -148,7 +148,7 @@ class CelesteTest: XCTestCase { let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) let verifierParams = VerifierParams(verifier_id: verifierID, sub_verifier_ids: [TORUS_TEST_VERIFIER], verify_params: [VerifyParams(verifier_id: verifierID, idtoken: jwt)]) - let data = try await torus.retrieveShares(endpoints: nodeDetails.torusNodeEndpoints, verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) + let data = try await torus.retrieveShares(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) XCTAssertEqual(data.finalKeyData.evmAddress, "0x535Eb1AefFAc6f699A2a1A5846482d7b5b2BD564") XCTAssertLessThan(data.metadata.serverTimeOffset, 20) diff --git a/Tests/TorusUtilsTests/CyanTest.swift b/Tests/TorusUtilsTests/CyanTest.swift index 8c29c847..fbcccb91 100644 --- a/Tests/TorusUtilsTests/CyanTest.swift +++ b/Tests/TorusUtilsTests/CyanTest.swift @@ -13,8 +13,8 @@ class CyanTest: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .legacy(.CYAN)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .legacy(.CYAN))) + fnd = NodeDetailManager(network: .CYAN) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .CYAN)) } func test_should_fetch_public_address() async throws { diff --git a/Tests/TorusUtilsTests/MainnetTest.swift b/Tests/TorusUtilsTests/MainnetTest.swift index 2c2382b8..28538c13 100644 --- a/Tests/TorusUtilsTests/MainnetTest.swift +++ b/Tests/TorusUtilsTests/MainnetTest.swift @@ -20,15 +20,15 @@ class MainnetTests: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .legacy(.MAINNET)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .legacy(.MAINNET))) + fnd = NodeDetailManager(network: .MAINNET) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .MAINNET)) } func test_should_fetch_public_address() async throws { let verifier = "google" let verifierID = TORUS_TEST_EMAIL let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) - let val = try await torus.getPublicAddress(endpoints: nodeDetails.torusNodeEndpoints, verifier: verifier, verifierId: verifierID) + let val = try await torus.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) XCTAssertEqual(val.finalKeyData!.evmAddress, "0x0C44AFBb5395a9e8d28DF18e1326aa0F16b9572A") XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) @@ -156,7 +156,7 @@ class MainnetTests: XCTestCase { let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) let verifierParams = VerifierParams(verifier_id: verifierID, sub_verifier_ids: [TORUS_TEST_VERIFIER], verify_params: [VerifyParams(verifier_id: verifierID, idtoken: jwt)]) - let data = try await torus.retrieveShares(endpoints: nodeDetails.torusNodeEndpoints, verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) + let data = try await torus.retrieveShares(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) XCTAssertEqual(data.finalKeyData.evmAddress, "0x621a4d458cFd345dAE831D9E756F10cC40A50381") XCTAssertLessThan(data.metadata.serverTimeOffset, 20) diff --git a/Tests/TorusUtilsTests/SapphireDevnetTest.swift b/Tests/TorusUtilsTests/SapphireDevnetTest.swift index fabd4144..2aa10187 100644 --- a/Tests/TorusUtilsTests/SapphireDevnetTest.swift +++ b/Tests/TorusUtilsTests/SapphireDevnetTest.swift @@ -20,8 +20,8 @@ final class SapphireDevnetTest: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .sapphire(.SAPPHIRE_DEVNET)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .sapphire(.SAPPHIRE_DEVNET))) + fnd = NodeDetailManager(network: .SAPPHIRE_DEVNET) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .SAPPHIRE_DEVNET)) } func test_should_fetch_public_address() async throws { diff --git a/Tests/TorusUtilsTests/SapphireMainnetTests.swift b/Tests/TorusUtilsTests/SapphireMainnetTests.swift index 5bfbf28b..74732cdd 100644 --- a/Tests/TorusUtilsTests/SapphireMainnetTests.swift +++ b/Tests/TorusUtilsTests/SapphireMainnetTests.swift @@ -23,8 +23,8 @@ class SapphireMainnetTests: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .sapphire(.SAPPHIRE_MAINNET)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .sapphire(.SAPPHIRE_MAINNET), enableOneKey: true)) + fnd = NodeDetailManager(network: .SAPPHIRE_MAINNET) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .SAPPHIRE_MAINNET, enableOneKey: true)) } func test_should_fetch_public_address() async throws { diff --git a/Tests/TorusUtilsTests/TestnetTest.swift b/Tests/TorusUtilsTests/TestnetTest.swift index 9b1c9f9e..39e8d55a 100644 --- a/Tests/TorusUtilsTests/TestnetTest.swift +++ b/Tests/TorusUtilsTests/TestnetTest.swift @@ -13,15 +13,15 @@ class TestnetTest: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .legacy(.TESTNET)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .legacy(.TESTNET))) + fnd = NodeDetailManager(network: .TESTNET) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .TESTNET)) } func test_should_fetch_public_address() async throws { let verifier = "google-lrc" let verifierID = TORUS_TEST_EMAIL let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) - let val = try await torus.getPublicAddress(endpoints: nodeDetails.torusNodeEndpoints, verifier: verifier, verifierId: verifierID) + let val = try await torus.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) XCTAssertEqual(val.finalKeyData!.evmAddress, "0x9bcBAde70546c0796c00323CD1b97fa0a425A506") XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) @@ -149,7 +149,7 @@ class TestnetTest: XCTestCase { let verifierParams = VerifierParams(verifier_id: verifierID, sub_verifier_ids: [TORUS_TEST_VERIFIER], verify_params: [VerifyParams(verifier_id: verifierID, idtoken: jwt)]) - let data = try await torus.retrieveShares(endpoints: nodeDetails.torusNodeEndpoints, verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) + let data = try await torus.retrieveShares(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) XCTAssertEqual(data.finalKeyData.evmAddress, "0x938a40E155d118BD31E439A9d92D67bd55317965") XCTAssertLessThan(data.metadata.serverTimeOffset, 20) diff --git a/Tests/TorusUtilsTests/oneKeyTest.swift b/Tests/TorusUtilsTests/oneKeyTest.swift index dd679d1b..ebb4faf9 100644 --- a/Tests/TorusUtilsTests/oneKeyTest.swift +++ b/Tests/TorusUtilsTests/oneKeyTest.swift @@ -13,8 +13,8 @@ class OneKeyTest: XCTestCase { override func setUp() { super.setUp() - fnd = NodeDetailManager(network: .legacy(.TESTNET)) - torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .legacy(.TESTNET), enableOneKey: true)) + fnd = NodeDetailManager(network: .TESTNET) + torus = try! TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .TESTNET, enableOneKey: true)) } func test_should_still_fetch_v1_address_correctly() async throws { diff --git a/Torus-utils.podspec b/Torus-utils.podspec index 35e0a5aa..2de94961 100644 --- a/Torus-utils.podspec +++ b/Torus-utils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Torus-utils" - spec.version = "9.0.1" + spec.version = "10.0.0" spec.ios.deployment_target = "13.0" spec.summary = "Retrieve user shares" spec.homepage = "https://github.com/torusresearch/torus-utils-swift" @@ -10,6 +10,6 @@ Pod::Spec.new do |spec| spec.module_name = "TorusUtils" spec.source = { :git => "https://github.com/torusresearch/torus-utils-swift.git", :tag => spec.version } spec.source_files = "Sources/TorusUtils/*.{swift,json}","Sources/TorusUtils/**/*.{swift,json}" - spec.dependency 'Torus-fetchNodeDetails', '~> 6.0.3' + spec.dependency 'Torus-fetchNodeDetails', '~> 7.0.0' spec.dependency 'curvelib.swift', '~> 1.0.1' end From 13befed8899c363a99badd32ae7b97f6b54793d8 Mon Sep 17 00:00:00 2001 From: metalurgical <97008724+metalurgical@users.noreply.github.com> Date: Thu, 24 Oct 2024 06:41:31 +0200 Subject: [PATCH 2/2] update to latest dependencies --- Package.resolved | 16 ++++++++-------- Package.swift | 6 +++--- README.md | 6 +++--- Torus-utils.podspec | 4 ++-- cocoapods/Podfile.lock | 18 +++++++++--------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Package.resolved b/Package.resolved index dacbf1a7..bfb176db 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/attaswift/BigInt.git", "state" : { - "revision" : "793a7fac0bfc318e85994bf6900652e827aef33e", - "version" : "5.4.1" + "revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6", + "version" : "5.3.0" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tkey/curvelib.swift", "state" : { - "revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea", - "version" : "1.0.1" + "revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0", + "version" : "2.0.0" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/torusresearch/fetch-node-details-swift", "state" : { - "branch" : "encapsulate_torusnetwork", - "revision" : "2fcd108ea89a48f092a955017977a299129d20c7" + "revision" : "52fb5efaa94e0fe3775913ab00964bcb51601c2a", + "version" : "8.0.0" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "ffca28be3c9c6a86a579949d23f68818a4b9b5d8", - "version" : "3.8.0" + "revision" : "f0525da24dc3c6cbb2b6b338b65042bc91cbc4bb", + "version" : "3.3.0" } } ], diff --git a/Package.swift b/Package.swift index 5baef24c..0d3281cc 100644 --- a/Package.swift +++ b/Package.swift @@ -4,15 +4,15 @@ import PackageDescription let package = Package( name: "TorusUtils", - platforms: [.iOS(.v13), .macOS(.v10_15)], + platforms: [.iOS(.v14), .macOS(.v10_15)], products: [ .library( name: "TorusUtils", targets: ["TorusUtils"]) ], dependencies: [ - .package(url: "https://github.com/tkey/curvelib.swift", from: "1.0.1"), - .package(url: "https://github.com/torusresearch/fetch-node-details-swift", branch: "encapsulate_torusnetwork"), // TODO: Update to 7.0.0 + .package(url: "https://github.com/tkey/curvelib.swift", from: "2.0.0"), + .package(url: "https://github.com/torusresearch/fetch-node-details-swift", from: "8.0.0"), // NB: jwt-kit may only be a dependency in tests or it will break cocoapod support .package(url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0"), ], diff --git a/README.md b/README.md index 3cbecc7f..1518a411 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ You can install the TorusUtils using Swift Package Manager: ... dependencies: [ ... - .package(url: "https://github.com/torusresearch/torus-utils-swift", from: "9.0.0") + .package(url: "https://github.com/torusresearch/torus-utils-swift", from: "10.0.0") ], targets: [ .target( name: "", @@ -30,7 +30,7 @@ Or CocoaPods: ``` ... - pod 'Torus-utils', '~> 9.0.0' + pod 'Torus-utils', '~> 10.0.0' ... ``` @@ -38,7 +38,7 @@ Or CocoaPods: Initialize the `TorusUtils` class by passing `TorusOptions` as params. Params includes `TorusNetwork`, `enableOneKey`, and your `clientId`. `enableOneKey` if true, adds the nonce value to the key, to make it compatible with v2 users. The package supports both legacy and sapphire networks. ```swift - let torusUtils = TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .sapphire(.SAPPHIRE_MAINNET), enableOneKey: true)) + let torusUtils = TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .SAPPHIRE_MAINNET, enableOneKey: true)) ``` diff --git a/Torus-utils.podspec b/Torus-utils.podspec index 2de94961..d55823b1 100644 --- a/Torus-utils.podspec +++ b/Torus-utils.podspec @@ -10,6 +10,6 @@ Pod::Spec.new do |spec| spec.module_name = "TorusUtils" spec.source = { :git => "https://github.com/torusresearch/torus-utils-swift.git", :tag => spec.version } spec.source_files = "Sources/TorusUtils/*.{swift,json}","Sources/TorusUtils/**/*.{swift,json}" - spec.dependency 'Torus-fetchNodeDetails', '~> 7.0.0' - spec.dependency 'curvelib.swift', '~> 1.0.1' + spec.dependency 'Torus-fetchNodeDetails', '~> 8.0.0' + spec.dependency 'curvelib.swift', '~> 2.0.0' end diff --git a/cocoapods/Podfile.lock b/cocoapods/Podfile.lock index b2c3d277..55b97770 100644 --- a/cocoapods/Podfile.lock +++ b/cocoapods/Podfile.lock @@ -1,11 +1,11 @@ PODS: - BigInt (5.2.0) - - curvelib.swift (1.0.1) - - Torus-fetchNodeDetails (6.0.3): + - curvelib.swift (2.0.0) + - Torus-fetchNodeDetails (8.0.0): - BigInt (~> 5.2.0) - - Torus-utils (9.0.0): - - curvelib.swift (~> 1.0.1) - - Torus-fetchNodeDetails (~> 6.0.3) + - Torus-utils (10.0.0): + - curvelib.swift (~> 2.0.0) + - Torus-fetchNodeDetails (~> 8.0.0) DEPENDENCIES: - Torus-utils (from `../`) @@ -22,10 +22,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: BigInt: f668a80089607f521586bbe29513d708491ef2f7 - curvelib.swift: d0746ae82bee34016c06da3567a97e493b3c979f - Torus-fetchNodeDetails: 6c349f47cbca36a4b3f276fe26d03c1b39b20949 - Torus-utils: 0f993fffd66a66a0423092c9ddea2cbff4d298df + curvelib.swift: b9223e5cac801effed8a5fe8968e952b3fe427a5 + Torus-fetchNodeDetails: 2a5fbb222ec28af4128d64e4c2d520c7db456b78 + Torus-utils: 4a1db3d9c1aa221df312ffa7ec154e7e4719850a PODFILE CHECKSUM: 2d35466879f2d32f53c6ccbca958796c381f0e62 -COCOAPODS: 1.13.0 +COCOAPODS: 1.15.2