Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
metalurgical committed Oct 10, 2023
1 parent 64aa8af commit 99b35e5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Sources/TorusUtils/Convenience/Data+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public extension Data {
let pointer = bodyAddress.assumingMemoryBound(to: T.self)
return [T](UnsafeBufferPointer(start: pointer, count: self.count / MemoryLayout<T>.stride))
} else {
throw Web3Error.dataError
throw TorusUtilError.runtime("Failed to convert to array")
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/TorusUtils/Helpers/LangrangeInterpolatePoly.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
import BigInt


func modInverse(_ a: BigInt, _ m: BigInt) -> BigInt? {
var (t, newT) = (BigInt(0), BigInt(1))
var (r, newR) = (m, a)
Expand Down
34 changes: 0 additions & 34 deletions Sources/TorusUtils/Helpers/Web3ERROR.swift

This file was deleted.

34 changes: 0 additions & 34 deletions Sources/TorusUtils/Helpers/Web3Error.swift

This file was deleted.

3 changes: 1 addition & 2 deletions Sources/TorusUtils/TorusUtils.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BigInt
import CryptoKit
import FetchNodeDetails
import CommonSources
/**
Expand Down Expand Up @@ -356,7 +355,7 @@ open class TorusUtils: AbstractTorusUtils {
}

open func generatePrivateKeyData() -> Data? {
return Data.randomOfLength(32)
return SECP256K1.generatePrivateKey()
}

open func getTimestamp() -> TimeInterval {
Expand Down
8 changes: 6 additions & 2 deletions Tests/TorusUtilsTests/IntegrationTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ class IntegrationTests: XCTestCase {
let data = try await tu.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), torusNodePubs: nodeDetails.getTorusNodePub(), verifier: "google-lrc", verifierId: "[email protected]")
XCTAssertEqual(data.finalKeyData?.evmAddress, "0x872eEfa7495599A6983d396fE8dcf542457CF33f")

nodeDetails = try await get_fnd_and_tu_data(verifer: TORUS_TEST_VERIFIER_FAKE, veriferID: TORUS_TEST_EMAIL)
_ = try await tu.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), torusNodePubs: nodeDetails.getTorusNodePub(), verifier: TORUS_TEST_VERIFIER_FAKE, verifierId: TORUS_TEST_EMAIL)
do {
nodeDetails = try await get_fnd_and_tu_data(verifer: TORUS_TEST_VERIFIER_FAKE, veriferID: TORUS_TEST_EMAIL)
_ = try await tu.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), torusNodePubs: nodeDetails.getTorusNodePub(), verifier: TORUS_TEST_VERIFIER_FAKE, verifierId: TORUS_TEST_EMAIL)
} catch _ {

}
}

func test_getUserTypeAndAddress() async throws {
Expand Down

0 comments on commit 99b35e5

Please sign in to comment.