From d0c214ad397365de1b7f7410242b22200624d01d Mon Sep 17 00:00:00 2001 From: rathishubham7 Date: Wed, 31 Mar 2021 14:56:45 +0530 Subject: [PATCH 1/2] addded /allow signer API --- .../TorusUtils/Extensions/TorusUtils+extension.swift | 10 ++++++++++ Sources/TorusUtils/TorusUtils.swift | 2 ++ Torus-utils.podspec | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Sources/TorusUtils/Extensions/TorusUtils+extension.swift b/Sources/TorusUtils/Extensions/TorusUtils+extension.swift index 2b18fdd3..6f016697 100644 --- a/Sources/TorusUtils/Extensions/TorusUtils+extension.swift +++ b/Sources/TorusUtils/Extensions/TorusUtils+extension.swift @@ -504,6 +504,16 @@ extension TorusUtils { let encoder = JSONEncoder() let rpcdata = try! encoder.encode(JSONRPCrequest(method: "VerifierLookupRequest", params: ["verifier":verifier, "verifier_id":verifierId])) + // allowHost = 'https://signer.tor.us/api/allow' + var allowHostRequest = self.makeUrlRequest(url: "https://signer.tor.us/api/allow") + allowHostRequest.httpMethod = "GET" + allowHostRequest.addValue("torus-default", forHTTPHeaderField: "x-api-key") + URLSession.shared.dataTask(.promise, with: allowHostRequest).done{ data in + // swallow + }.catch{error in + self.logger.error("KeyLookup: signer allow:", error) + } + // Create Array of URLRequest Promises var promisesArray = Array >() for el in endpoints { diff --git a/Sources/TorusUtils/TorusUtils.swift b/Sources/TorusUtils/TorusUtils.swift index 6a16ea72..aaa2bcd1 100644 --- a/Sources/TorusUtils/TorusUtils.swift +++ b/Sources/TorusUtils/TorusUtils.swift @@ -106,6 +106,8 @@ public class TorusUtils{ seal.reject(TorusError.timeout) } + + getPublicAddress(endpoints: endpoints, torusNodePubs: nodePubKeys, verifier: verifierIdentifier, verifierId: verifierId, isExtended: true).then{ data -> Promise<[[String:String]]> in publicAddress = data["address"] ?? "" lookupPubkeyX = data["pub_key_X"]!.addLeading0sForLength64() diff --git a/Torus-utils.podspec b/Torus-utils.podspec index 44c9605b..ce61aaff 100644 --- a/Torus-utils.podspec +++ b/Torus-utils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Torus-utils" - spec.version = "0.1.1" + spec.version = "0.1.2" spec.platform = :ios, "10.0" spec.summary = "Retrieve user shares" spec.homepage = "https://github.com/torusresearch/torus-utils-swift" From 6be267fdb9d5bda080849b0d99fff5c920e73e95 Mon Sep 17 00:00:00 2001 From: rathishubham7 Date: Tue, 6 Apr 2021 15:41:00 +0530 Subject: [PATCH 2/2] updated utils --- Sources/TorusUtils/Extensions/TorusUtils+extension.swift | 1 + Torus-utils.podspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/TorusUtils/Extensions/TorusUtils+extension.swift b/Sources/TorusUtils/Extensions/TorusUtils+extension.swift index 6f016697..5bd5c3d0 100644 --- a/Sources/TorusUtils/Extensions/TorusUtils+extension.swift +++ b/Sources/TorusUtils/Extensions/TorusUtils+extension.swift @@ -508,6 +508,7 @@ extension TorusUtils { var allowHostRequest = self.makeUrlRequest(url: "https://signer.tor.us/api/allow") allowHostRequest.httpMethod = "GET" allowHostRequest.addValue("torus-default", forHTTPHeaderField: "x-api-key") + allowHostRequest.addValue(verifier, forHTTPHeaderField: "Origin") URLSession.shared.dataTask(.promise, with: allowHostRequest).done{ data in // swallow }.catch{error in diff --git a/Torus-utils.podspec b/Torus-utils.podspec index ce61aaff..a8c466db 100644 --- a/Torus-utils.podspec +++ b/Torus-utils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Torus-utils" - spec.version = "0.1.2" + spec.version = "0.1.4" spec.platform = :ios, "10.0" spec.summary = "Retrieve user shares" spec.homepage = "https://github.com/torusresearch/torus-utils-swift"