Skip to content

Commit

Permalink
Merge pull request #4 from torusresearch/feat/allowSignerAPI
Browse files Browse the repository at this point in the history
added /allow signer API
  • Loading branch information
rathishubham7 authored Apr 6, 2021
2 parents 920b909 + 6be267f commit 0f23062
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Sources/TorusUtils/Extensions/TorusUtils+extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,17 @@ 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")
allowHostRequest.addValue(verifier, forHTTPHeaderField: "Origin")
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<Promise<(data: Data, response: URLResponse)> >()
for el in endpoints {
Expand Down
2 changes: 2 additions & 0 deletions Sources/TorusUtils/TorusUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion Torus-utils.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "Torus-utils"
spec.version = "0.1.1"
spec.version = "0.1.4"
spec.platform = :ios, "10.0"
spec.summary = "Retrieve user shares"
spec.homepage = "https://github.com/torusresearch/torus-utils-swift"
Expand Down

0 comments on commit 0f23062

Please sign in to comment.