-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff75355
commit 0b5e898
Showing
11 changed files
with
106 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import BigInt | ||
import FetchNodeDetails | ||
import JWTKit | ||
import XCTest | ||
import TorusUtils | ||
import XCTest | ||
|
||
class AquaTest: XCTestCase { | ||
var TORUS_TEST_EMAIL = "[email protected]" | ||
|
@@ -22,14 +22,14 @@ class AquaTest: XCTestCase { | |
let verifierID: String = TORUS_TEST_EMAIL | ||
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
let val = try await torus.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) | ||
|
||
XCTAssertEqual(val.finalKeyData!.evmAddress, "0xDfA967285AC699A70DA340F60d00DB19A272639d") | ||
XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(val.oAuthKeyData!.evmAddress, "0xDfA967285AC699A70DA340F60d00DB19A272639d") | ||
XCTAssertEqual(val.oAuthKeyData!.X, "4fc8db5d3fe164a3ab70fd6348721f2be848df2cc02fd2db316a154855a7aa7d") | ||
XCTAssertEqual(val.oAuthKeyData!.Y, "f76933cbf5fe2916681075bb6cb4cde7d5f6b6ce290071b1b7106747d906457c") | ||
|
||
XCTAssertEqual(val.finalKeyData!.evmAddress, "0xDfA967285AC699A70DA340F60d00DB19A272639d") | ||
XCTAssertEqual(val.finalKeyData!.X, "4fc8db5d3fe164a3ab70fd6348721f2be848df2cc02fd2db316a154855a7aa7d") | ||
XCTAssertEqual(val.finalKeyData!.Y, "f76933cbf5fe2916681075bb6cb4cde7d5f6b6ce290071b1b7106747d906457c") | ||
|
@@ -45,7 +45,7 @@ class AquaTest: XCTestCase { | |
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
let result1 = try await torus.getUserTypeAndAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) | ||
XCTAssertLessThan(result1.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(result1.oAuthKeyData!.evmAddress, "0xDfA967285AC699A70DA340F60d00DB19A272639d") | ||
XCTAssertEqual(result1.oAuthKeyData!.X, "4fc8db5d3fe164a3ab70fd6348721f2be848df2cc02fd2db316a154855a7aa7d") | ||
XCTAssertEqual(result1.oAuthKeyData!.Y, "f76933cbf5fe2916681075bb6cb4cde7d5f6b6ce290071b1b7106747d906457c") | ||
|
@@ -63,9 +63,9 @@ class AquaTest: XCTestCase { | |
verifier = "tkey-google-aqua" | ||
verifierID = "[email protected]" | ||
let result2 = try await torus.getUserTypeAndAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) | ||
|
||
XCTAssertLessThan(result2.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(result2.oAuthKeyData!.evmAddress, "0x4ea5260fF85678A2a326D08DF9C44d1f559a5828") | ||
XCTAssertEqual(result2.oAuthKeyData!.X, "0e6febe33a9d4eeb680cc6b63ff6237ad1971f27adcd7f104a3b1de18eda9337") | ||
XCTAssertEqual(result2.oAuthKeyData!.Y, "a5a915561f3543688e71281a850b9ee10b9690f305d9e79028dfc8359192b82d") | ||
|
@@ -79,13 +79,13 @@ class AquaTest: XCTestCase { | |
XCTAssertEqual(result2.metadata?.upgraded, false) | ||
XCTAssertEqual(result2.metadata?.typeOfUser, .v2) | ||
XCTAssertNotNil(result2.nodesData) | ||
|
||
// 2/n user | ||
verifierID = "[email protected]" | ||
let result3 = try await torus.getUserTypeAndAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) | ||
|
||
XCTAssertLessThan(result2.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(result3.oAuthKeyData!.evmAddress, "0x4ce0D09C3989eb3cC9372cC27fa022D721D737dD") | ||
XCTAssertEqual(result3.oAuthKeyData!.X, "e76d2f7fa2c0df324b4ab74629c3af47aa4609c35f1d2b6b90b77a47ab9a1281") | ||
XCTAssertEqual(result3.oAuthKeyData!.Y, "b33b35148d72d357070f66372e07fec436001bdb15c098276b120b9ed64c1e5f") | ||
|
@@ -106,7 +106,7 @@ class AquaTest: XCTestCase { | |
let verifierID: String = fakeEmail | ||
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
let data = try await torus.getPublicAddress(endpoints: nodeDetails.getTorusNodeEndpoints(), verifier: verifier, verifierId: verifierID) | ||
//note: duplicated checks on next two lines in javascript | ||
// note: duplicated checks on next two lines in javascript | ||
XCTAssertNotNil(data.finalKeyData?.evmAddress) | ||
XCTAssertNotNil(data.oAuthKeyData?.evmAddress) | ||
XCTAssertEqual(data.metadata?.typeOfUser, .v1) | ||
|
@@ -121,9 +121,9 @@ class AquaTest: XCTestCase { | |
let jwt = try! generateIdToken(email: verifierID) | ||
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
let data = try await torus.retrieveShares(endpoints: nodeDetails.getTorusNodeEndpoints(), indexes: nodeDetails.getTorusIndexes(), verifier: verifier, verifierParams: verifierParams, idToken: jwt) | ||
|
||
XCTAssertLessThan(data.metadata.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(data.finalKeyData.evmAddress, "0x9EBE51e49d8e201b40cAA4405f5E0B86d9D27195") | ||
XCTAssertEqual(data.finalKeyData.X, "c7bcc239f0957bb05bda94757eb4a5f648339424b22435da5cf7a0f2b2323664") | ||
XCTAssertEqual(data.finalKeyData.Y, "63795690a33e575ee12d832935d563c2b5f2e1b1ffac63c32a4674152f68cb3f") | ||
|
@@ -145,11 +145,11 @@ class AquaTest: XCTestCase { | |
let verifierID: String = TORUS_TEST_EMAIL | ||
let jwt = try! generateIdToken(email: TORUS_TEST_EMAIL) | ||
let hashedIDToken = try KeyUtils.keccak256Data(jwt) | ||
|
||
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
let verifierParams = VerifierParams(verifier_id: verifierID, sub_verifier_ids: [TORUS_TEST_VERIFIER], verify_params: [VerifyParams(verifier_id: TORUS_TEST_EMAIL, idtoken: jwt)]) | ||
|
||
let verifierParams = VerifierParams(verifier_id: verifierID, sub_verifier_ids: [TORUS_TEST_VERIFIER], verify_params: [VerifyParams(verifier_id: TORUS_TEST_EMAIL, idtoken: jwt)]) | ||
|
||
let data = try await torus.retrieveShares(endpoints: nodeDetails.getTorusNodeEndpoints(), indexes: nodeDetails.getTorusIndexes(), verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) | ||
XCTAssertEqual(data.finalKeyData.evmAddress, "0x5b58d8a16fDA79172cd42Dc3068d5CEf26a5C81D") | ||
XCTAssertEqual(data.finalKeyData.X, "37a4ac8cbef68e88bcec5909d9b6fffb539187365bb723f3d7bffe56ae80e31d") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import Foundation | ||
import BigInt | ||
import FetchNodeDetails | ||
import XCTest | ||
import Foundation | ||
import TorusUtils | ||
import BigInt | ||
import XCTest | ||
|
||
class CelesteTest: XCTestCase { | ||
var TORUS_TEST_EMAIL = "[email protected]" | ||
var TORUS_TEST_VERIFIER = "torus-test-health" | ||
var TORUS_TEST_AGGREGATE_VERIFIER = "torus-test-health-aggregate" | ||
var fnd: NodeDetailManager! | ||
var torus: TorusUtils! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
fnd = NodeDetailManager(network: .legacy(.CELESTE)) | ||
torus = TorusUtils(params: TorusOptions(clientId: "YOUR_CLIENT_ID", network: .legacy(.CELESTE))) | ||
} | ||
|
||
func test_should_fetch_public_address() async throws { | ||
let verifier = "tkey-google-celeste" | ||
let verifierID = TORUS_TEST_EMAIL | ||
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
let val = try await torus.getPublicAddress(endpoints: nodeDetails.torusNodeEndpoints, verifier: verifier, verifierId: verifierID) | ||
|
||
XCTAssertEqual(val.finalKeyData!.evmAddress, "0xC3115b9d6FaB99739b23DA9dfcBA47A4Ec4Cd113") | ||
XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(val.finalKeyData!.evmAddress, "0xC3115b9d6FaB99739b23DA9dfcBA47A4Ec4Cd113") | ||
XCTAssertEqual(val.finalKeyData!.X, "b89b9d66b247d7294a98616b95b7bfa1675aa85a1df4d89f2780283864f1b6e9") | ||
XCTAssertEqual(val.finalKeyData!.Y, "65422a8ccd66e638899fc53497e468a9a0bf50d45c9cb85ae0ffcfc13f433ffb") | ||
|
@@ -47,7 +47,7 @@ class CelesteTest: XCTestCase { | |
|
||
XCTAssertEqual(val.finalKeyData!.evmAddress, "0xC3115b9d6FaB99739b23DA9dfcBA47A4Ec4Cd113") | ||
XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(val.oAuthKeyData!.evmAddress, "0xC3115b9d6FaB99739b23DA9dfcBA47A4Ec4Cd113") | ||
XCTAssertEqual(val.oAuthKeyData!.X, "b89b9d66b247d7294a98616b95b7bfa1675aa85a1df4d89f2780283864f1b6e9") | ||
XCTAssertEqual(val.oAuthKeyData!.Y, "65422a8ccd66e638899fc53497e468a9a0bf50d45c9cb85ae0ffcfc13f433ffb") | ||
|
@@ -64,7 +64,7 @@ class CelesteTest: XCTestCase { | |
|
||
XCTAssertEqual(val.finalKeyData!.evmAddress, "0x8d69CE354DA39413f205FdC8680dE1F3FBBb36e2") | ||
XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(val.oAuthKeyData!.evmAddress, "0xda4afB35493094Dd2C05b186Ca0FABAD96491B21") | ||
XCTAssertEqual(val.oAuthKeyData!.X, "cfa646a2949ebe559205c5c407d734d1b6927f2ea5fbeabfcbc31ab9a985a336") | ||
XCTAssertEqual(val.oAuthKeyData!.Y, "8f988eb8b59515293820aa38af172b153e8d25307db8d5f410407c20e062b6e6") | ||
|
@@ -86,7 +86,7 @@ class CelesteTest: XCTestCase { | |
|
||
XCTAssertEqual(val.finalKeyData!.evmAddress, "0x8108c29976C458e76f797AD55A3715Ce80a3fe78") | ||
XCTAssertLessThan(val.metadata!.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(val.oAuthKeyData!.evmAddress, "0xc8c4748ec135196fb482C761da273C31Ec48B099") | ||
XCTAssertEqual(val.oAuthKeyData!.X, "0cc857201e6c304dd893b243e323fe95982e5a99c0994cf902efa2432a672eb4") | ||
XCTAssertEqual(val.oAuthKeyData!.Y, "37a2f53c250b3e1186e38ece3dfcbcb23e325913038703531831b96d3e7b54cc") | ||
|
@@ -121,10 +121,9 @@ class CelesteTest: XCTestCase { | |
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
let data = try await torus.retrieveShares(endpoints: nodeDetails.getTorusNodeEndpoints(), indexes: nodeDetails.getTorusIndexes(), verifier: verifier, verifierParams: verifierParams, idToken: jwt) | ||
|
||
|
||
XCTAssertEqual(data.finalKeyData.evmAddress, "0x58420FB83971C4490D8c9B091f8bfC890D716617") | ||
XCTAssertLessThan(data.metadata.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(data.oAuthKeyData.evmAddress, "0x58420FB83971C4490D8c9B091f8bfC890D716617") | ||
XCTAssertEqual(data.oAuthKeyData.X, "73b82ce0f8201a962636d404fe7a683f37c2267a9528576e1dac9964940add74") | ||
XCTAssertEqual(data.oAuthKeyData.Y, "6d28c46c5385b90322bde74d6c5096e154eae2838399f4d6e8d752f7b0c449c1") | ||
|
@@ -147,13 +146,13 @@ class CelesteTest: XCTestCase { | |
let jwt = try! generateIdToken(email: TORUS_TEST_EMAIL) | ||
let hashedIDToken = try KeyUtils.keccak256Data(jwt) | ||
let nodeDetails = try await fnd.getNodeDetails(verifier: verifier, verifierID: verifierID) | ||
|
||
let verifierParams = VerifierParams(verifier_id: verifierID, sub_verifier_ids: [TORUS_TEST_VERIFIER], verify_params: [VerifyParams(verifier_id: verifierID, idtoken: jwt)]) | ||
let data = try await torus.retrieveShares(endpoints: nodeDetails.torusNodeEndpoints, indexes: nodeDetails.getTorusIndexes(), verifier: verifier, verifierParams: verifierParams, idToken: hashedIDToken) | ||
|
||
XCTAssertEqual(data.finalKeyData.evmAddress, "0x535Eb1AefFAc6f699A2a1A5846482d7b5b2BD564") | ||
XCTAssertLessThan(data.metadata.serverTimeOffset, 20) | ||
|
||
XCTAssertEqual(data.oAuthKeyData.evmAddress, "0x535Eb1AefFAc6f699A2a1A5846482d7b5b2BD564") | ||
XCTAssertEqual(data.oAuthKeyData.X, "df6eb11d52e76b388a44896e9442eda17096c2b67b0be957a4ba0b68a70111ca") | ||
XCTAssertEqual(data.oAuthKeyData.Y, "bfd29ab1e97b3f7c444bb3e7ad0acb39d72589371387436c7d623d1e83f3d6eb") | ||
|
Oops, something went wrong.