From 198e4e8c001e874ebf2513370f640258a92a0f6a Mon Sep 17 00:00:00 2001 From: shubham Date: Wed, 29 Apr 2020 19:59:28 +0800 Subject: [PATCH] renamed class --- Sources/torus-utils-swift/Extensions/torus+extension.swift | 6 +++--- Sources/torus-utils-swift/{torus.swift => TorusUtils.swift} | 4 ++-- Tests/torus-utils-swiftTests/unit_test.swift | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename Sources/torus-utils-swift/{torus.swift => TorusUtils.swift} (99%) diff --git a/Sources/torus-utils-swift/Extensions/torus+extension.swift b/Sources/torus-utils-swift/Extensions/torus+extension.swift index c846918a..7c0787c6 100644 --- a/Sources/torus-utils-swift/Extensions/torus+extension.swift +++ b/Sources/torus-utils-swift/Extensions/torus+extension.swift @@ -11,7 +11,7 @@ import PromiseKit import secp256k1 import PMKFoundation -extension Torus { +extension TorusUtils { func makeUrlRequest(url: String) throws -> URLRequest { var rq = URLRequest(url: URL(string: url)!) @@ -42,7 +42,7 @@ extension Torus { let result = privateKey.withUnsafeBytes { (a: UnsafeRawBufferPointer) -> Int32? in if let pkRawPointer = a.baseAddress, a.count > 0 { let privateKeyPointer = pkRawPointer.assumingMemoryBound(to: UInt8.self) - let res = secp256k1_ec_pubkey_tweak_mul(Torus.context!, UnsafeMutablePointer(&pubKey2), privateKeyPointer) + let res = secp256k1_ec_pubkey_tweak_mul(TorusUtils.context!, UnsafeMutablePointer(&pubKey2), privateKeyPointer) return res } else { return nil @@ -166,7 +166,7 @@ extension Torus { let result = privateKey.withUnsafeBytes { (a: UnsafeRawBufferPointer) -> Int32? in if let pkRawPointer = a.baseAddress, a.count > 0 { let privateKeyPointer = pkRawPointer.assumingMemoryBound(to: UInt8.self) - let res = secp256k1_ec_pubkey_create(Torus.context!, UnsafeMutablePointer(&publicKey), privateKeyPointer) + let res = secp256k1_ec_pubkey_create(TorusUtils.context!, UnsafeMutablePointer(&publicKey), privateKeyPointer) return res } else { return nil diff --git a/Sources/torus-utils-swift/torus.swift b/Sources/torus-utils-swift/TorusUtils.swift similarity index 99% rename from Sources/torus-utils-swift/torus.swift rename to Sources/torus-utils-swift/TorusUtils.swift index 2359389a..a7bb5008 100644 --- a/Sources/torus-utils-swift/torus.swift +++ b/Sources/torus-utils-swift/TorusUtils.swift @@ -13,7 +13,7 @@ import CryptoSwift import BigInt -public class Torus{ +public class TorusUtils{ public var torusUtils : utils = utils() static let context = secp256k1_context_create(UInt32(SECP256K1_CONTEXT_SIGN|SECP256K1_CONTEXT_VERIFY)) var privateKey = "" @@ -315,7 +315,7 @@ public class Torus{ var nodeReturnedPubKeyX:String = "" var nodeReturnedPubKeyY:String = "" - print(privateKey?.toHexString(), publicKeyHex, pubKeyX, pubKeyY, tokenCommitment) + print(privateKey?.toHexString() as Any, publicKeyHex as Any, pubKeyX as Any, pubKeyY as Any, tokenCommitment) commitmentRequest(endpoints: endpoints, verifier: verifier, pubKeyX: pubKeyX!, pubKeyY: pubKeyY!, timestamp: timestamp, tokenCommitment: tokenCommitment) .then{ data -> Promise<[Int:[String:String]]> in diff --git a/Tests/torus-utils-swiftTests/unit_test.swift b/Tests/torus-utils-swiftTests/unit_test.swift index b3ccc076..4224e99c 100644 --- a/Tests/torus-utils-swiftTests/unit_test.swift +++ b/Tests/torus-utils-swiftTests/unit_test.swift @@ -34,7 +34,7 @@ final class torus_utils_swiftTests: XCTestCase { } func testKeyLookup() { - let obj = Torus() + let obj = TorusUtils() let exp1 = XCTestExpectation(description: "Do keylookup with success") let keyLookupSuccess = obj.keyLookup(endpoints: nodeList, verifier: self.verifier, verifierId: self.verifierId) @@ -59,7 +59,7 @@ final class torus_utils_swiftTests: XCTestCase { func testKeyAssign(){ let exp1 = XCTestExpectation(description: "Do keyAssign success") - let obj = Torus() + let obj = TorusUtils() let keyAssign = obj.keyAssign(endpoints: self.nodeList, torusNodePubs: nodePubKeys, verifier: verifier, verifierId: self.verifierId) keyAssign.done{ data in XCTAssertNotNil(data) @@ -72,7 +72,7 @@ final class torus_utils_swiftTests: XCTestCase { func testGetPublicAddress(){ let exp1 = XCTestExpectation(description: "testing get public address") - let obj = Torus() + let obj = TorusUtils() let getpublicaddress = obj.getPublicAddress(endpoints: self.nodeList, torusNodePubs: nodePubKeys, verifier: "google", verifierId: self.verifierId, isExtended: true) getpublicaddress.done{ data in print("data", data)