From 05afffa788f855a4c560312f3d90b833d6a305b7 Mon Sep 17 00:00:00 2001 From: ieow Date: Mon, 18 Mar 2024 12:28:55 +0800 Subject: [PATCH 1/6] feat: make clientId mandatory --- Package.resolved | 6 +++--- Package.swift | 6 +++--- Sources/CustomAuth/CustomAuth.swift | 21 ++++++++++++------- Tests/CustomAuthTests/CustomAuthTests.swift | 4 ++-- Tests/CustomAuthTests/IntegrationTests.swift | 19 +++++++++++++++-- .../StubURLProtocolTests.swift | 2 +- 6 files changed, 39 insertions(+), 19 deletions(-) diff --git a/Package.resolved b/Package.resolved index 195a207..fc89ec3 100644 --- a/Package.resolved +++ b/Package.resolved @@ -77,9 +77,9 @@ "package": "TorusUtils", "repositoryURL": "https://github.com/torusresearch/torus-utils-swift.git", "state": { - "branch": null, - "revision": "3fb829e71caa275556a067a1ffa1ca579bafbf8e", - "version": "7.0.1" + "branch": "feat/clientId_allowTest", + "revision": "7ad67f0d14229d91890b01ef85e19d1b13397ce6", + "version": null } } ] diff --git a/Package.swift b/Package.swift index bc30766..df86de4 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.2 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -14,14 +14,14 @@ let package = Package( targets: ["CustomAuth"]) ], dependencies: [ - .package(name: "TorusUtils", url: "https://github.com/torusresearch/torus-utils-swift.git", from: "7.0.1"), + .package(url: "https://github.com/torusresearch/torus-utils-swift.git", branch: "feat/clientId_allowTest"), .package(name: "jwt-kit", url: "https://github.com/vapor/jwt-kit.git", from: "4.13.0"), .package(name: "JWTDecode", url: "https://github.com/auth0/JWTDecode.swift.git", from: "3.1.0") ], targets: [ .target( name: "CustomAuth", - dependencies: ["TorusUtils", "JWTDecode"]), + dependencies: ["JWTDecode", .product(name: "TorusUtils", package: "torus-utils-swift")]), .testTarget( name: "CustomAuthTests", dependencies: ["CustomAuth", .product(name: "JWTKit", package: "jwt-kit")]) diff --git a/Sources/CustomAuth/CustomAuth.swift b/Sources/CustomAuth/CustomAuth.swift index 696a8a9..0f997df 100644 --- a/Sources/CustomAuth/CustomAuth.swift +++ b/Sources/CustomAuth/CustomAuth.swift @@ -18,6 +18,11 @@ var tsSdkLogType = OSLogType.default public struct TorusKeyData { public let torusKey : TorusKey public var userInfo : [String: Any] + + public init(torusKey: TorusKey, userInfo: [String : Any]) { + self.torusKey = torusKey + self.userInfo = userInfo + } } /// Provides integration of an iOS app with Torus CustomAuth. @@ -44,7 +49,7 @@ open class CustomAuth { /// - factory: Providng mocking by implementing TDSDKFactoryProtocol. /// - network: Etherum network to be used. /// - loglevel: Indicates the log level of this instance. All logs lower than this level will be ignored. - public init(aggregateVerifierType: verifierTypes, aggregateVerifier: String, subVerifierDetails: [SubVerifierDetails], network: TorusNetwork = .legacy(.MAINNET), loglevel: OSLogType = .debug, urlSession: URLSession = URLSession.shared, enableOneKey: Bool = false, networkUrl: String? = nil) { + public init(web3AuthClientId: String ,aggregateVerifierType: verifierTypes, aggregateVerifier: String, subVerifierDetails: [SubVerifierDetails], network: TorusNetwork, loglevel: OSLogType = .debug, urlSession: URLSession = URLSession.shared, enableOneKey: Bool = false, networkUrl: String? = nil) { tsSdkLogType = loglevel self.networkUrl = networkUrl self.enableOneKey = enableOneKey @@ -52,7 +57,7 @@ open class CustomAuth { self.nodeDetailManager = NodeDetailManager(network: network) self.urlSession = urlSession - self.torusUtils = TorusUtils(loglevel: loglevel, urlSession: urlSession, enableOneKey: enableOneKey, serverTimeOffset: 1000, network: network) + self.torusUtils = TorusUtils( loglevel: loglevel, urlSession: urlSession, enableOneKey: enableOneKey, serverTimeOffset: 1000, network: network, clientId: web3AuthClientId) // verifier details self.aggregateVerifier = aggregateVerifier @@ -66,15 +71,15 @@ open class CustomAuth { /// - aggregateVerifierType: Type of the verifier. Use `singleLogin` for single providers. Only `singleLogin` and `singleIdVerifier` is supported currently. /// - aggregateVerifier: Name of the verifier to be used.. /// - subVerifierDetails: Details of each subverifiers to be used. - public convenience init(aggregateVerifierType: verifierTypes, aggregateVerifier: String, subVerifierDetails: [SubVerifierDetails], enableOneKey: Bool = false, networkUrl: String? = nil) { + public convenience init(web3AuthClientId: String ,aggregateVerifierType: verifierTypes, aggregateVerifier: String, subVerifierDetails: [SubVerifierDetails], network: TorusNetwork, enableOneKey: Bool = false, networkUrl: String? = nil) { // let factory = CASDKFactory() - self.init(aggregateVerifierType: aggregateVerifierType, aggregateVerifier: aggregateVerifier, subVerifierDetails: subVerifierDetails, network: .legacy(.MAINNET), loglevel: .debug, enableOneKey: enableOneKey, networkUrl: networkUrl) + self.init(web3AuthClientId: web3AuthClientId, aggregateVerifierType: aggregateVerifierType, aggregateVerifier: aggregateVerifier, subVerifierDetails: subVerifierDetails, network: network, loglevel: .debug, enableOneKey: enableOneKey, networkUrl: networkUrl) } - public convenience init(aggregateVerifierType: verifierTypes, aggregateVerifier: String, subVerifierDetails: [SubVerifierDetails], loglevel: OSLogType = .debug, enableOneKey: Bool = false, networkUrl: String? = nil) { -// let factory = CASDKFactory() - self.init(aggregateVerifierType: aggregateVerifierType, aggregateVerifier: aggregateVerifier, subVerifierDetails: subVerifierDetails, network: .legacy(.MAINNET), loglevel: loglevel, enableOneKey: enableOneKey, networkUrl: networkUrl) - } +// public convenience init(web3AuthClientId: String ,aggregateVerifierType: verifierTypes, aggregateVerifier: String, subVerifierDetails: [SubVerifierDetails], network: TorusNetwork, loglevel: OSLogType = .debug, enableOneKey: Bool = false, networkUrl: String? = nil) { +//// let factory = CASDKFactory() +// self.init(web3AuthClientId: web3AuthClientId, aggregateVerifierType: aggregateVerifierType, aggregateVerifier: aggregateVerifier, subVerifierDetails: subVerifierDetails, network: network, loglevel: loglevel, enableOneKey: enableOneKey, networkUrl: networkUrl) +// } /// Retrieve information of Torus nodes from a predefined Etherum contract. /// - Returns: An array of URLs to the nodes. diff --git a/Tests/CustomAuthTests/CustomAuthTests.swift b/Tests/CustomAuthTests/CustomAuthTests.swift index cdec204..f1b0a63 100644 --- a/Tests/CustomAuthTests/CustomAuthTests.swift +++ b/Tests/CustomAuthTests/CustomAuthTests.swift @@ -20,7 +20,7 @@ final class MockSDKTest: XCTestCase { let expectedVerifier = fakeData.generateVerifier() let expectedVerfierId = fakeData.generateRandomEmail(of: 6) - let CustomAuth = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: expectedVerifier, subVerifierDetails: []) + let CustomAuth = CustomAuth(web3AuthClientId:"YOUR_CLIENT_ID", aggregateVerifierType: .singleLogin, aggregateVerifier: expectedVerifier, subVerifierDetails: [], network: .legacy(.MAINNET)) var mockTorusUtils = MockTorusUtils() CustomAuth.torusUtils = mockTorusUtils @@ -55,7 +55,7 @@ final class MockSDKTest: XCTestCase { let subVerifier = [SubVerifierDetails(loginProvider: .jwt, clientId: fakeData.generateVerifier(), verifier: expectedVerifier, redirectURL: fakeData.generateVerifier())] - let CustomAuth = CustomAuth(aggregateVerifierType: .singleIdVerifier, aggregateVerifier: expectedVerifier, subVerifierDetails: subVerifier) + let CustomAuth = CustomAuth(web3AuthClientId:"YOUR_CLIENT_ID", aggregateVerifierType: .singleIdVerifier, aggregateVerifier: expectedVerifier, subVerifierDetails: subVerifier, network: .legacy(.MAINNET)) // var mockTorusUtils = CustomAuth.torusUtils as! MockAbstractTorusUtils let mockTorusUtils = MockTorusUtils() CustomAuth.torusUtils = mockTorusUtils diff --git a/Tests/CustomAuthTests/IntegrationTests.swift b/Tests/CustomAuthTests/IntegrationTests.swift index 432e48c..0087256 100644 --- a/Tests/CustomAuthTests/IntegrationTests.swift +++ b/Tests/CustomAuthTests/IntegrationTests.swift @@ -23,7 +23,7 @@ final class IntegrationTests: XCTestCase { redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - IntegrationTests.sdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-test-ios-public", subVerifierDetails: [sub], network: .legacy(.CYAN)) + IntegrationTests.sdk = CustomAuth(web3AuthClientId:"YOUR_CLIENT_ID", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-test-ios-public", subVerifierDetails: [sub], network: .legacy(.CYAN)) } func test_getTorusKey() async throws { @@ -53,7 +53,7 @@ final class IntegrationTests: XCTestCase { verifier: "google-lrc", redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - let sdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-test-ios-public", subVerifierDetails: [sub], network: .sapphire(.SAPPHIRE_DEVNET)) + let sdk = CustomAuth(web3AuthClientId:"YOUR_CLIENT_ID", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-test-ios-public", subVerifierDetails: [sub], network: .sapphire(.SAPPHIRE_DEVNET)) let jwt = try! generateIdToken(email: TORUS_TEST_EMAIL) let data = try await sdk.getTorusKey(verifier: TORUS_TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: jwt) @@ -61,6 +61,21 @@ final class IntegrationTests: XCTestCase { let evmAddress = finalKeyDataDict.evmAddress XCTAssertEqual(evmAddress, "0x81001206C06AD09b3611b593aEEd3A607d79871E") } + + func test_Sapphire_getTorusKey_gated() async throws { + let sub = SubVerifierDetails(loginType: .web, + loginProvider: .jwt, + clientId: "221898609709-obfn3p63741l5333093430j3qeiinaa8.apps.googleusercontent.com", + verifier: "w3a-auth0-demo", + redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect", + browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") + let sdk = CustomAuth(web3AuthClientId:"BAEbRWQOMd_lfYUIzxqNiik2qxamCcOeKOCllBpcaVrBhJWw-CGbVl2U244BETDmKhCMLz1VFJM2Hc_XtLRqPVM", aggregateVerifierType: .singleLogin, aggregateVerifier: "w3a-auth0-demo", subVerifierDetails: [sub], network: .sapphire(.SAPPHIRE_MAINNET)) + + let jwt = try! generateIdToken(email: TORUS_TEST_EMAIL) + let data = try await sdk.getTorusKey(verifier: "w3a-auth0-demo", verifierId: TORUS_TEST_EMAIL, idToken: jwt) + let finalKeyDataDict = data.finalKeyData! + let evmAddress = finalKeyDataDict.evmAddress + } } // JWT payload structure. diff --git a/Tests/CustomAuthTests/StubURLProtocolTests.swift b/Tests/CustomAuthTests/StubURLProtocolTests.swift index d1ecf41..739773a 100644 --- a/Tests/CustomAuthTests/StubURLProtocolTests.swift +++ b/Tests/CustomAuthTests/StubURLProtocolTests.swift @@ -27,7 +27,7 @@ public class StubMockCASDKFactory: CASDKFactoryProtocol { public func createTorusUtils(loglevel: OSLogType, urlSession: URLSession, enableOneKey: Bool, network: TorusNetwork) -> AbstractTorusUtils { let allowHost = network.signerMap.appending("/api/allow") let signerHost = network.signerMap.appending("/api/sign") - return StubMockTorusUtils(loglevel: loglevel, urlSession: urlSession, enableOneKey: enableOneKey, signerHost: signerHost, allowHost: allowHost) + return StubMockTorusUtils(loglevel: loglevel, urlSession: urlSession, enableOneKey: enableOneKey, signerHost: signerHost, allowHost: allowHost, clientId: "Your Client ID") } public init() { From 7b27b09b707f667fef7fcbd8362ee24bdaa84fb4 Mon Sep 17 00:00:00 2001 From: metalurgical <97008724+metalurgical@users.noreply.github.com> Date: Mon, 25 Mar 2024 08:15:04 +0200 Subject: [PATCH 2/6] fix: tests --- Tests/CustomAuthTests/CustomAuthTests.swift | 2 +- Tests/CustomAuthTests/IntegrationTests.swift | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Tests/CustomAuthTests/CustomAuthTests.swift b/Tests/CustomAuthTests/CustomAuthTests.swift index f1b0a63..dd9aee3 100644 --- a/Tests/CustomAuthTests/CustomAuthTests.swift +++ b/Tests/CustomAuthTests/CustomAuthTests.swift @@ -22,7 +22,7 @@ final class MockSDKTest: XCTestCase { let CustomAuth = CustomAuth(web3AuthClientId:"YOUR_CLIENT_ID", aggregateVerifierType: .singleLogin, aggregateVerifier: expectedVerifier, subVerifierDetails: [], network: .legacy(.MAINNET)) - var mockTorusUtils = MockTorusUtils() + let mockTorusUtils = MockTorusUtils() CustomAuth.torusUtils = mockTorusUtils // Set Mock data mockTorusUtils.retrieveShares_output["privateKey"] = expectedPrivateKey diff --git a/Tests/CustomAuthTests/IntegrationTests.swift b/Tests/CustomAuthTests/IntegrationTests.swift index 0087256..26dd8a6 100644 --- a/Tests/CustomAuthTests/IntegrationTests.swift +++ b/Tests/CustomAuthTests/IntegrationTests.swift @@ -53,7 +53,7 @@ final class IntegrationTests: XCTestCase { verifier: "google-lrc", redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - let sdk = CustomAuth(web3AuthClientId:"YOUR_CLIENT_ID", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-test-ios-public", subVerifierDetails: [sub], network: .sapphire(.SAPPHIRE_DEVNET)) + let sdk = CustomAuth(web3AuthClientId:"221898609709-obfn3p63741l5333093430j3qeiinaa8.apps.googleusercontent.com", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-test-ios-public", subVerifierDetails: [sub], network: .sapphire(.SAPPHIRE_DEVNET)) let jwt = try! generateIdToken(email: TORUS_TEST_EMAIL) let data = try await sdk.getTorusKey(verifier: TORUS_TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: jwt) @@ -66,15 +66,16 @@ final class IntegrationTests: XCTestCase { let sub = SubVerifierDetails(loginType: .web, loginProvider: .jwt, clientId: "221898609709-obfn3p63741l5333093430j3qeiinaa8.apps.googleusercontent.com", - verifier: "w3a-auth0-demo", + verifier: "torus-test-ios-public", redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - let sdk = CustomAuth(web3AuthClientId:"BAEbRWQOMd_lfYUIzxqNiik2qxamCcOeKOCllBpcaVrBhJWw-CGbVl2U244BETDmKhCMLz1VFJM2Hc_XtLRqPVM", aggregateVerifierType: .singleLogin, aggregateVerifier: "w3a-auth0-demo", subVerifierDetails: [sub], network: .sapphire(.SAPPHIRE_MAINNET)) + let sdk = CustomAuth(web3AuthClientId:"221898609709-obfn3p63741l5333093430j3qeiinaa8.apps.googleusercontent.com", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-test-ios-public", subVerifierDetails: [sub], network: .sapphire(.SAPPHIRE_DEVNET)) let jwt = try! generateIdToken(email: TORUS_TEST_EMAIL) - let data = try await sdk.getTorusKey(verifier: "w3a-auth0-demo", verifierId: TORUS_TEST_EMAIL, idToken: jwt) + let data = try await sdk.getTorusKey(verifier: TORUS_TEST_VERIFIER, verifierId: TORUS_TEST_EMAIL, idToken: jwt) let finalKeyDataDict = data.finalKeyData! let evmAddress = finalKeyDataDict.evmAddress + XCTAssertEqual(evmAddress, "0x81001206C06AD09b3611b593aEEd3A607d79871E") } } From 56e718b0545c7d0ed959fe9fc5fc246937805278 Mon Sep 17 00:00:00 2001 From: ieow Date: Mon, 25 Mar 2024 14:31:43 +0800 Subject: [PATCH 3/6] feat: update torus-utils with release tag --- Package.resolved | 6 +++--- Package.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Package.resolved b/Package.resolved index fc89ec3..c2c15d1 100644 --- a/Package.resolved +++ b/Package.resolved @@ -77,9 +77,9 @@ "package": "TorusUtils", "repositoryURL": "https://github.com/torusresearch/torus-utils-swift.git", "state": { - "branch": "feat/clientId_allowTest", - "revision": "7ad67f0d14229d91890b01ef85e19d1b13397ce6", - "version": null + "branch": null, + "revision": "04c62fd5f73f21bd01b7c07e08f6135db26c5940", + "version": "8.0.0" } } ] diff --git a/Package.swift b/Package.swift index df86de4..7232d41 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,7 @@ let package = Package( targets: ["CustomAuth"]) ], dependencies: [ - .package(url: "https://github.com/torusresearch/torus-utils-swift.git", branch: "feat/clientId_allowTest"), + .package(url: "https://github.com/torusresearch/torus-utils-swift.git", from: "8.0.0"), .package(name: "jwt-kit", url: "https://github.com/vapor/jwt-kit.git", from: "4.13.0"), .package(name: "JWTDecode", url: "https://github.com/auth0/JWTDecode.swift.git", from: "3.1.0") ], From 3a887c32eff70ef20c5959c0fa0380c1d8d3817e Mon Sep 17 00:00:00 2001 From: metalurgical <97008724+metalurgical@users.noreply.github.com> Date: Mon, 25 Mar 2024 08:48:26 +0200 Subject: [PATCH 4/6] Delete CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved --- .../xcshareddata/swiftpm/Package.resolved | 97 ------------------- 1 file changed, 97 deletions(-) delete mode 100644 CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 80f6b1d..0000000 --- a/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,97 +0,0 @@ -{ - "object": { - "pins": [ - { - "package": "AnyCodable", - "repositoryURL": "https://github.com/Flight-School/AnyCodable", - "state": { - "branch": null, - "revision": "862808b2070cd908cb04f9aafe7de83d35f81b05", - "version": "0.6.7" - } - }, - { - "package": "BigInt", - "repositoryURL": "https://github.com/attaswift/BigInt.git", - "state": { - "branch": null, - "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", - "version": "5.3.0" - } - }, - { - "package": "CryptoSwift", - "repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift", - "state": { - "branch": null, - "revision": "7892a123f7e8d0fe62f9f03728b17bbd4f94df5c", - "version": "1.8.1" - } - }, - { - "package": "curvelib.swift", - "repositoryURL": "https://github.com/tkey/curvelib.swift", - "state": { - "branch": null, - "revision": "7dad3bf1793de263f83406c08c18c9316abf082f", - "version": "0.1.2" - } - }, - { - "package": "FetchNodeDetails", - "repositoryURL": "https://github.com/torusresearch/fetch-node-details-swift", - "state": { - "branch": null, - "revision": "d591af500f32ce3c88d04af9bb74d746585acfea", - "version": "5.1.0" - } - }, - { - "package": "jwt-kit", - "repositoryURL": "https://github.com/vapor/jwt-kit.git", - "state": { - "branch": null, - "revision": "e05513b5aec24f88012b6e3034115b6bc915356a", - "version": "4.13.2" - } - }, - { - "package": "JWTDecode", - "repositoryURL": "https://github.com/auth0/JWTDecode.swift.git", - "state": { - "branch": null, - "revision": "58af7278797871e460d79496621b3e5366b865b2", - "version": "3.1.0" - } - }, - { - "package": "PromiseKit", - "repositoryURL": "https://github.com/mxcl/PromiseKit", - "state": { - "branch": null, - "revision": "cb70b070cde06837cd10a1febdf6105c1a3bb348", - "version": "8.1.1" - } - }, - { - "package": "swift-crypto", - "repositoryURL": "https://github.com/apple/swift-crypto.git", - "state": { - "branch": null, - "revision": "cc76b894169a3c86b71bac10c78a4db6beb7a9ad", - "version": "3.2.0" - } - }, - { - "package": "TorusUtils", - "repositoryURL": "https://github.com/torusresearch/torus-utils-swift.git", - "state": { - "branch": null, - "revision": "3fb829e71caa275556a067a1ffa1ca579bafbf8e", - "version": "7.0.1" - } - } - ] - }, - "version": 1 -} From 48e639d2b133837255d43fc9aa79a8e3d85e64a0 Mon Sep 17 00:00:00 2001 From: metalurgical <97008724+metalurgical@users.noreply.github.com> Date: Mon, 25 Mar 2024 08:55:36 +0200 Subject: [PATCH 5/6] Revert "Delete CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" This reverts commit 3a887c32eff70ef20c5959c0fa0380c1d8d3817e. --- .../xcshareddata/swiftpm/Package.resolved | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..80f6b1d --- /dev/null +++ b/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,97 @@ +{ + "object": { + "pins": [ + { + "package": "AnyCodable", + "repositoryURL": "https://github.com/Flight-School/AnyCodable", + "state": { + "branch": null, + "revision": "862808b2070cd908cb04f9aafe7de83d35f81b05", + "version": "0.6.7" + } + }, + { + "package": "BigInt", + "repositoryURL": "https://github.com/attaswift/BigInt.git", + "state": { + "branch": null, + "revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6", + "version": "5.3.0" + } + }, + { + "package": "CryptoSwift", + "repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift", + "state": { + "branch": null, + "revision": "7892a123f7e8d0fe62f9f03728b17bbd4f94df5c", + "version": "1.8.1" + } + }, + { + "package": "curvelib.swift", + "repositoryURL": "https://github.com/tkey/curvelib.swift", + "state": { + "branch": null, + "revision": "7dad3bf1793de263f83406c08c18c9316abf082f", + "version": "0.1.2" + } + }, + { + "package": "FetchNodeDetails", + "repositoryURL": "https://github.com/torusresearch/fetch-node-details-swift", + "state": { + "branch": null, + "revision": "d591af500f32ce3c88d04af9bb74d746585acfea", + "version": "5.1.0" + } + }, + { + "package": "jwt-kit", + "repositoryURL": "https://github.com/vapor/jwt-kit.git", + "state": { + "branch": null, + "revision": "e05513b5aec24f88012b6e3034115b6bc915356a", + "version": "4.13.2" + } + }, + { + "package": "JWTDecode", + "repositoryURL": "https://github.com/auth0/JWTDecode.swift.git", + "state": { + "branch": null, + "revision": "58af7278797871e460d79496621b3e5366b865b2", + "version": "3.1.0" + } + }, + { + "package": "PromiseKit", + "repositoryURL": "https://github.com/mxcl/PromiseKit", + "state": { + "branch": null, + "revision": "cb70b070cde06837cd10a1febdf6105c1a3bb348", + "version": "8.1.1" + } + }, + { + "package": "swift-crypto", + "repositoryURL": "https://github.com/apple/swift-crypto.git", + "state": { + "branch": null, + "revision": "cc76b894169a3c86b71bac10c78a4db6beb7a9ad", + "version": "3.2.0" + } + }, + { + "package": "TorusUtils", + "repositoryURL": "https://github.com/torusresearch/torus-utils-swift.git", + "state": { + "branch": null, + "revision": "3fb829e71caa275556a067a1ffa1ca579bafbf8e", + "version": "7.0.1" + } + } + ] + }, + "version": 1 +} From b388fbd0c886409602a64bd972b6b1e6661c49be Mon Sep 17 00:00:00 2001 From: metalurgical <97008724+metalurgical@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:03:31 +0200 Subject: [PATCH 6/6] fix: update demo --- .../xcshareddata/swiftpm/Package.resolved | 8 +++--- .../CustomAuthDemo/ContentView.swift | 28 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 80f6b1d..3a07809 100644 --- a/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/CustomAuthDemo/CustomAuthDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -78,8 +78,8 @@ "repositoryURL": "https://github.com/apple/swift-crypto.git", "state": { "branch": null, - "revision": "cc76b894169a3c86b71bac10c78a4db6beb7a9ad", - "version": "3.2.0" + "revision": "f0525da24dc3c6cbb2b6b338b65042bc91cbc4bb", + "version": "3.3.0" } }, { @@ -87,8 +87,8 @@ "repositoryURL": "https://github.com/torusresearch/torus-utils-swift.git", "state": { "branch": null, - "revision": "3fb829e71caa275556a067a1ffa1ca579bafbf8e", - "version": "7.0.1" + "revision": "04c62fd5f73f21bd01b7c07e08f6135db26c5940", + "version": "8.0.0" } } ] diff --git a/CustomAuthDemo/CustomAuthDemo/ContentView.swift b/CustomAuthDemo/CustomAuthDemo/ContentView.swift index 405fbf5..3839f54 100644 --- a/CustomAuthDemo/CustomAuthDemo/ContentView.swift +++ b/CustomAuthDemo/CustomAuthDemo/ContentView.swift @@ -29,7 +29,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "google-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "221898609709-obfn3p63741l5333093430j3qeiinaa8.apps.googleusercontent.com", aggregateVerifierType: .singleLogin, aggregateVerifier: "google-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -48,7 +48,7 @@ struct ContentView: View { clientId: "rXIp6g2y3h1wqg", verifier: "reddit-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback") - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "reddit-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "rXIp6g2y3h1wqg", aggregateVerifierType: .singleLogin, aggregateVerifier: "reddit-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -67,7 +67,7 @@ struct ContentView: View { clientId: "700259843063152661", verifier: "discord-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback") - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "discord-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "700259843063152661", aggregateVerifierType: .singleLogin, aggregateVerifier: "discord-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -87,7 +87,7 @@ struct ContentView: View { verifier: "facebook-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "facebook-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "221898609709-obfn3p63741l5333093430j3qeiinaa8.apps.googleusercontent.com", aggregateVerifierType: .singleLogin, aggregateVerifier: "facebook-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -106,7 +106,7 @@ struct ContentView: View { clientId: "p560duf74b2bidzqu6uo0b3ot7qaao", verifier: "twitch-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback") - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "twitch-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "p560duf74b2bidzqu6uo0b3ot7qaao", aggregateVerifierType: .singleLogin, aggregateVerifier: "twitch-shubs", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -127,7 +127,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain": "torus-test.auth0.com"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-twitter-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "A7H8kkcmyFRlusJQ9dZiqBLraG2yWIsO", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-twitter-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -149,7 +149,7 @@ struct ContentView: View { browserRedirectURL: "https://scripts.toruswallet.io/redirect.html", jwtParams: ["domain": "torus-test.auth0.com"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-github-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "PC2a4tfNRvXbT48t89J5am0oFM21Nxff", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-github-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -170,7 +170,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain": "torus-test.auth0.com"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-linkedin-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "59YxSgx79Vl3Wi7tQUBqQTRTxWroTuoc", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-linkedin-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -191,7 +191,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain": "torus-test.auth0.com"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-apple-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "m1Q0gvDfOyZsJCZ3cucSQEe9XMvl9d9L", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-apple-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -214,7 +214,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain": "torus-test.auth0.com", "verifier_id_field": "name"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-email-passwordless", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "P7PJuBCXIHP41lcyty0NEb7Lgf7Zme8Q", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-email-passwordless", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -235,7 +235,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain": "torus-test.auth0.com"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-kakao-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "wpkcc7alGJjEgjaL6q5AWRqgRWHFsdTL", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-kakao-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -256,7 +256,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain": "torus-test.auth0.com"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-weibo-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "dhFGlWQMoACOI5oS5A1jFglp772OAWr1", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-weibo-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -277,7 +277,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain": "torus-test.auth0.com"]) - let tdsdk = CustomAuth(aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-wechat-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "cewDD3i6F1vtHeV1KIbaxUZ8vJQjJZ8V", aggregateVerifierType: .singleLogin, aggregateVerifier: "torus-auth0-wechat-lrc", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData! @@ -299,7 +299,7 @@ struct ContentView: View { clientId: "238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4.apps.googleusercontent.com", verifier: "google-ios", redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect") - let tdsdk = CustomAuth(aggregateVerifierType: .singleIdVerifier, aggregateVerifier: "multigoogle-torus", subVerifierDetails: [sub], network: .legacy(.TESTNET)) + let tdsdk = CustomAuth(web3AuthClientId: "238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4.apps.googleusercontent.com", aggregateVerifierType: .singleIdVerifier, aggregateVerifier: "multigoogle-torus", subVerifierDetails: [sub], network: .legacy(.TESTNET)) Task { do { let loginData = try await tdsdk.triggerLogin().torusKey.finalKeyData!