Skip to content

Commit

Permalink
renamed class
Browse files Browse the repository at this point in the history
  • Loading branch information
metallicalfa2 committed Apr 29, 2020
1 parent b3d45a5 commit 198e4e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Sources/torus-utils-swift/Extensions/torus+extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)!)
Expand Down Expand Up @@ -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<secp256k1_pubkey>(&pubKey2), privateKeyPointer)
let res = secp256k1_ec_pubkey_tweak_mul(TorusUtils.context!, UnsafeMutablePointer<secp256k1_pubkey>(&pubKey2), privateKeyPointer)
return res
} else {
return nil
Expand Down Expand Up @@ -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<secp256k1_pubkey>(&publicKey), privateKeyPointer)
let res = secp256k1_ec_pubkey_create(TorusUtils.context!, UnsafeMutablePointer<secp256k1_pubkey>(&publicKey), privateKeyPointer)
return res
} else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Tests/torus-utils-swiftTests/unit_test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 198e4e8

Please sign in to comment.