-
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.
Merge pull request #22 from Web3Auth/additional_update
refactor: update to match other sdks
- Loading branch information
Showing
14 changed files
with
202 additions
and
82 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
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
2 changes: 1 addition & 1 deletion
2
Sources/SingleFactorAuth/TorusKey.swift → Sources/SingleFactorAuth/SFAKey.swift
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
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,46 +2,45 @@ import BigInt | |
import JWTKit | ||
import XCTest | ||
import FetchNodeDetails | ||
|
||
@testable import SingleFactorAuth | ||
import SingleFactorAuth | ||
|
||
final class AquaTest: XCTestCase { | ||
var singleFactoreAuth: SingleFactorAuth! | ||
var singleFactorAuthArgs: SingleFactorAuthArgs! | ||
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" | ||
|
||
override func setUp() { | ||
singleFactorAuthArgs = SingleFactorAuthArgs(web3AuthClientId: "CLIENT ID", network: .legacy(.AQUA)) | ||
singleFactoreAuth = try! SingleFactorAuth(singleFactorAuthArgs: singleFactorAuthArgs) | ||
singleFactorAuthArgs = SFAParams(web3AuthClientId: "CLIENT ID", network: .legacy(.AQUA)) | ||
singleFactoreAuth = try! SingleFactorAuth(params: singleFactorAuthArgs) | ||
} | ||
|
||
func testGetTorusKey() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.getKey(loginParams: loginParams) | ||
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 = "d8204e9f8c270647294c54acd8d49ee208789f981a7503158e122527d38626d8" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
XCTAssertEqual("0x8b32926cD9224fec3B296aA7250B049029434807", 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 torusKey = try await singleFactoreAuth.getKey(loginParams: loginParams) | ||
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 torusKey = try await singleFactoreAuth.getKey(loginParams: loginParams) | ||
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" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
|
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,46 +1,45 @@ | ||
import BigInt | ||
import JWTKit | ||
import XCTest | ||
|
||
@testable import SingleFactorAuth | ||
import SingleFactorAuth | ||
|
||
final class CyanTest: XCTestCase { | ||
var singleFactoreAuth: SingleFactorAuth! | ||
var singleFactorAuthArgs: SingleFactorAuthArgs! | ||
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" | ||
|
||
override func setUp() { | ||
singleFactorAuthArgs = SingleFactorAuthArgs(web3AuthClientId: "CLIENT ID", network: .legacy(.CYAN)) | ||
singleFactoreAuth = try! SingleFactorAuth(singleFactorAuthArgs: singleFactorAuthArgs) | ||
singleFactorAuthArgs = SFAParams(web3AuthClientId: "CLIENT ID", network: .legacy(.CYAN)) | ||
singleFactoreAuth = try! SingleFactorAuth(params: singleFactorAuthArgs) | ||
} | ||
|
||
func testGetTorusKey() async throws { | ||
let idToken = try generateIdToken(email: TOURUS_TEST_EMAIL) | ||
let loginParams = LoginParams(verifier: TEST_VERIFIER, verifierId: TOURUS_TEST_EMAIL, idToken: idToken) | ||
let torusKey = try await singleFactoreAuth.getKey(loginParams: loginParams) | ||
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 = "223d982054fa1ad27d1497560521e4cce5b8c6438c38533c7bad27ff21ce0546" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
XCTAssertEqual("0x6b902fBCEb0E0374e5eB9eDFe68cD4B888c32150", 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 torusKey = try await singleFactoreAuth.getKey(loginParams: loginParams) | ||
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 torusKey = try await singleFactoreAuth.getKey(loginParams: loginParams) | ||
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" | ||
XCTAssertEqual(requiredPrivateKey, torusKey.getPrivateKey()) | ||
|
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()) | ||
} | ||
} |
Oops, something went wrong.