-
Notifications
You must be signed in to change notification settings - Fork 1
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
e3ec925
commit 9d1ff3f
Showing
6 changed files
with
127 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,13 @@ import BigInt | |
import JWTKit | ||
import XCTest | ||
import FetchNodeDetails | ||
|
||
@testable import SingleFactorAuth | ||
import SingleFactorAuth | ||
|
||
final class AquaTest: XCTestCase { | ||
var singleFactoreAuth: SingleFactorAuth! | ||
var singleFactorAuthArgs: SFAParams! | ||
|
||
let TOURUS_TEST_EMAIL = "[email protected]" | ||
let TORUS_TEST_EMAIL = "[email protected]" | ||
let TEST_VERIFIER = "torus-test-health" | ||
let TEST_AGGREGRATE_VERIFIER = "torus-test-health-aggregate" | ||
|
||
|
@@ -19,8 +18,8 @@ final class AquaTest: XCTestCase { | |
} | ||
|
||
func testConnect() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "d8204e9f8c270647294c54acd8d49ee208789f981a7503158e122527d38626d8" | ||
|
@@ -29,18 +28,18 @@ final class AquaTest: XCTestCase { | |
} | ||
|
||
func testInitialise() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
let savedKey = try await singleFactoreAuth.initialize() | ||
let requiredPrivateKey = "d8204e9f8c270647294c54acd8d49ee208789f981a7503158e122527d38626d8" | ||
XCTAssertEqual(requiredPrivateKey, savedKey.getPrivateKey()) | ||
XCTAssertEqual(torusKey.publicAddress, savedKey.getPublicAddress()) | ||
XCTAssertEqual(torusKey.getPublicAddress(), savedKey.getPublicAddress()) | ||
} | ||
|
||
func testAggregrateGetTorusKey() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "6f8b884f19975fb0d138ed21b22a6a7e1b79e37f611d0a29f1442b34efc6bacd" | ||
|
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,14 +1,13 @@ | ||
import BigInt | ||
import JWTKit | ||
import XCTest | ||
|
||
@testable import SingleFactorAuth | ||
import SingleFactorAuth | ||
|
||
final class CyanTest: XCTestCase { | ||
var singleFactoreAuth: SingleFactorAuth! | ||
var singleFactorAuthArgs: SFAParams! | ||
|
||
let TOURUS_TEST_EMAIL = "[email protected]" | ||
let TORUS_TEST_EMAIL = "[email protected]" | ||
let TEST_VERIFIER = "torus-test-health" | ||
let TEST_AGGREGRATE_VERIFIER = "torus-test-health-aggregate" | ||
|
||
|
@@ -18,8 +17,8 @@ final class CyanTest: XCTestCase { | |
} | ||
|
||
func testConnect() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "223d982054fa1ad27d1497560521e4cce5b8c6438c38533c7bad27ff21ce0546" | ||
|
@@ -28,18 +27,18 @@ final class CyanTest: XCTestCase { | |
} | ||
|
||
func testInitialise() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
let requiredPrivateKey = "223d982054fa1ad27d1497560521e4cce5b8c6438c38533c7bad27ff21ce0546" | ||
let savedKey = try await singleFactoreAuth.initialize() | ||
XCTAssertEqual(requiredPrivateKey, savedKey.getPrivateKey()) | ||
XCTAssertEqual(torusKey.publicAddress, savedKey.getPublicAddress()) | ||
XCTAssertEqual(torusKey.getPublicAddress(), savedKey.getPublicAddress()) | ||
} | ||
|
||
func testAggregrateGetTorusKey() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "66af498ea82c95d52fdb8c8dedd44cf2f758424a0eecab7ac3dd8721527ea2d4" | ||
|
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import BigInt | ||
import JWTKit | ||
import XCTest | ||
import FetchNodeDetails | ||
import SingleFactorAuth | ||
|
||
final class SapphireDevnetTests: XCTestCase { | ||
var singleFactoreAuth: SingleFactorAuth! | ||
var singleFactorAuthArgs: SFAParams! | ||
|
||
let TORUS_TEST_EMAIL = "[email protected]" | ||
let TEST_VERIFIER = "torus-test-health" | ||
let TEST_AGGREGRATE_VERIFIER = "torus-test-health-aggregate" | ||
|
||
override func setUp() { | ||
singleFactorAuthArgs = SFAParams(web3AuthClientId: "CLIENT ID", network: .sapphire(.SAPPHIRE_DEVNET)) | ||
singleFactoreAuth = try! SingleFactorAuth(params: singleFactorAuthArgs) | ||
} | ||
|
||
func testConnect() async throws { | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "230dad9f42039569e891e6b066ff5258b14e9764ef5176d74aeb594d1a744203" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
XCTAssertEqual("0x462A8BF111A55C9354425F875F89B22678c0Bc44", torusKey.getPublicAddress()) | ||
} | ||
|
||
func testInitialise() async throws { | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
let savedKey = try await singleFactoreAuth.initialize() | ||
let requiredPrivateKey = "230dad9f42039569e891e6b066ff5258b14e9764ef5176d74aeb594d1a744203" | ||
XCTAssertEqual(requiredPrivateKey, savedKey.getPrivateKey()) | ||
XCTAssertEqual(torusKey.getPublicAddress(), savedKey.getPublicAddress()) | ||
} | ||
|
||
func testAggregrateGetTorusKey() async throws { | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "edef171853fdf23ed3cfc702d32cf46f181b475a449d2f7b636924cabecd81d4" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
XCTAssertEqual("0xfC58EB0475F1E3fa05877eE2e1350f6A619E2d78", torusKey.getPublicAddress()) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import BigInt | ||
import JWTKit | ||
import XCTest | ||
import FetchNodeDetails | ||
import SingleFactorAuth | ||
|
||
final class SapphireMainnetTests: XCTestCase { | ||
var singleFactoreAuth: SingleFactorAuth! | ||
var singleFactorAuthArgs: SFAParams! | ||
|
||
let TORUS_TEST_EMAIL = "[email protected]" | ||
let TEST_VERIFIER = "torus-test-health" | ||
let TEST_AGGREGRATE_VERIFIER = "torus-aggregate-sapphire-mainnet" | ||
|
||
override func setUp() { | ||
singleFactorAuthArgs = SFAParams(web3AuthClientId: "CLIENT ID", network: .sapphire(.SAPPHIRE_MAINNET)) | ||
singleFactoreAuth = try! SingleFactorAuth(params: singleFactorAuthArgs) | ||
} | ||
|
||
func testConnect() async throws { | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "2c4b346a91ecd11fe8a02d111d00bd921bf9b543f0a1e811face91b5f28947d6" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
XCTAssertEqual("0x0934d844a0a6db37CF75aF0269436ae1b2Ae5D36", torusKey.getPublicAddress()) | ||
} | ||
|
||
func testInitialise() async throws { | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
let savedKey = try await singleFactoreAuth.initialize() | ||
let requiredPrivateKey = "2c4b346a91ecd11fe8a02d111d00bd921bf9b543f0a1e811face91b5f28947d6" | ||
XCTAssertEqual(requiredPrivateKey, savedKey.getPrivateKey()) | ||
XCTAssertEqual(torusKey.getPublicAddress(), savedKey.getPublicAddress()) | ||
} | ||
|
||
func testAggregrateGetTorusKey() async throws { | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "0c724bb285560dc41e585b91aa2ded94fdd703c2e7133dcc64b1361b0d1fd105" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
XCTAssertEqual("0xA92E2C756B5b2abABc127907b02D4707dc085612", torusKey.getPublicAddress()) | ||
} | ||
} |
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,14 +1,13 @@ | ||
import BigInt | ||
import JWTKit | ||
import XCTest | ||
|
||
@testable import SingleFactorAuth | ||
import SingleFactorAuth | ||
|
||
final class SingleFactorAuthTests: XCTestCase { | ||
var singleFactoreAuth: SingleFactorAuth! | ||
var singleFactorAuthArgs: SFAParams! | ||
|
||
let TOURUS_TEST_EMAIL = "[email protected]" | ||
let TORUS_TEST_EMAIL = "[email protected]" | ||
let TEST_VERIFIER = "torus-test-health" | ||
let TEST_AGGREGRATE_VERIFIER = "torus-test-health-aggregate" | ||
|
||
|
@@ -18,27 +17,27 @@ final class SingleFactorAuthTests: XCTestCase { | |
} | ||
|
||
func testConnect() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
let requiredPrivateKey = "296045a5599afefda7afbdd1bf236358baff580a0fe2db62ae5c1bbe817fbae4" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
XCTAssertEqual("0x53010055542cCc0f2b6715a5c53838eC4aC96EF7", torusKey.getPublicAddress()) | ||
} | ||
|
||
func testInitialise() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
let savedKey = try await singleFactoreAuth.initialize() | ||
let requiredPrivateKey = "296045a5599afefda7afbdd1bf236358baff580a0fe2db62ae5c1bbe817fbae4" | ||
XCTAssertEqual(requiredPrivateKey, savedKey.getPrivateKey()) | ||
XCTAssertEqual(torusKey.publicAddress, savedKey.getPublicAddress()) | ||
XCTAssertEqual(torusKey.getPublicAddress(), savedKey.getPublicAddress()) | ||
} | ||
|
||
func testAggregrateGetTorusKey() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let idToken = try generateIdToken(email: TORUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_AGGREGRATE_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: idToken, subVerifierInfoArray: [TorusSubVerifierInfo(verifier: TEST_VERIFIER, idToken: idToken)]) | ||
let torusKey = try await singleFactoreAuth.connect(loginParams: loginParams) | ||
|
||
let requiredPrivateKey = "ad47959db4cb2e63e641bac285df1b944f54d1a1cecdaeea40042b60d53c35d2" | ||
|