diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index eca5ca3..179888b 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -12,7 +12,7 @@ jobs: name: Build and Deploy strategy: matrix: - node: ["14.x"] + node: ["16.x"] os: [ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/files/customauth/ios/ContentView.swift b/files/customauth/ios/ContentView.swift index 925517d..a2a9ff4 100644 --- a/files/customauth/ios/ContentView.swift +++ b/files/customauth/ios/ContentView.swift @@ -3,13 +3,13 @@ import TorusSwiftDirectSDK import FetchNodeDetails import PromiseKit import SafariServices -import web3swift import CryptoSwift struct ContentView: View { @State var showSafari = false + var body: some View { NavigationView{ List { @@ -24,7 +24,8 @@ struct ContentView: View { verifierName: "google-lrc", redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "google-lrc", subVerifierDetails: [sub], loglevel: .trace) + + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "google-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -40,7 +41,7 @@ struct ContentView: View { clientId: "rXIp6g2y3h1wqg", verifierName: "reddit-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback") - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "reddit-shubs", subVerifierDetails: [sub], network: .ROPSTEN, loglevel: .trace) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "reddit-shubs", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -56,7 +57,7 @@ struct ContentView: View { clientId: "700259843063152661", verifierName: "discord-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback") - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "discord-shubs", subVerifierDetails: [sub]) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "discord-shubs", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -73,7 +74,7 @@ struct ContentView: View { verifierName: "facebook-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback", browserRedirectURL: "https://scripts.toruswallet.io/redirect.html") - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "facebook-shubs", subVerifierDetails: [sub]) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "facebook-shubs", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -89,7 +90,7 @@ struct ContentView: View { clientId: "p560duf74b2bidzqu6uo0b3ot7qaao", verifierName: "twitch-shubs", redirectURL: "tdsdk://tdsdk/oauthCallback") - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "twitch-shubs", subVerifierDetails: [sub]) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "twitch-shubs", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -107,7 +108,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-twitter-lrc", subVerifierDetails: [sub]) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-twitter-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -126,7 +127,7 @@ struct ContentView: View { browserRedirectURL: "https://scripts.toruswallet.io/redirect.html", jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-github-lrc", subVerifierDetails: [sub], loglevel: .error) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-github-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -144,7 +145,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-linkedin-lrc", subVerifierDetails: [sub], loglevel: .trace) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-linkedin-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -162,7 +163,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-apple-lrc", subVerifierDetails: [sub], loglevel: .trace) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-apple-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -184,7 +185,7 @@ struct ContentView: View { extraQueryParams: ["verifier_id_field": "name"], jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-email-passwordless", subVerifierDetails: [sub], loglevel: .trace) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-email-passwordless", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -202,7 +203,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-kakao-lrc", subVerifierDetails: [sub], loglevel: .trace) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-kakao-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -220,7 +221,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-weibo-lrc", subVerifierDetails: [sub], loglevel: .trace) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-weibo-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -238,7 +239,7 @@ struct ContentView: View { redirectURL: "tdsdk://tdsdk/oauthCallback", jwtParams: ["domain":"torus-test.auth0.com"]) - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-wechat-lrc", subVerifierDetails: [sub], loglevel: .trace) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleLogin, aggregateVerifierName: "torus-auth0-wechat-lrc", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -260,7 +261,7 @@ struct ContentView: View { clientId: "238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4.apps.googleusercontent.com", verifierName: "google-ios", redirectURL: "com.googleusercontent.apps.238941746713-vfap8uumijal4ump28p9jd3lbe6onqt4:/oauthredirect") - let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleIdVerifier, aggregateVerifierName: "multigoogle-torus", subVerifierDetails: [sub]) + let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleIdVerifier, aggregateVerifierName: "multigoogle-torus", subVerifierDetails: [sub], network: .ROPSTEN) tdsdk.triggerLogin(browserType: .external).done{ data in print("private key rebuild", data) }.catch{ err in @@ -269,7 +270,25 @@ struct ContentView: View { }, label: { Text("Google Login - Deep link flow") }) + +// Button(action: { +// let sub = SubVerifierDetails(loginType: .web, +// loginProvider: .google, +// clientId: "238941746713-qqe4a7rduuk256d8oi5l0q34qtu9gpfg.apps.googleusercontent.com", +// verifierName: "google-shubs", +// redirectURL: "https://backend.relayer.dev.tor.us/demoapp/redirect") +// let tdsdk = TorusSwiftDirectSDK(aggregateVerifierType: .singleIdVerifier, aggregateVerifierName: "multigoogle-torus", subVerifierDetails: [sub]) +// tdsdk.triggerLogin(browserType: .external).done{ data in +// print("private key rebuild", data) +// }.catch{ err in +// print(err) +// } +// }, label: { +// Text("Google Login - Universal link flow") +// }) + } + }.navigationBarTitle(Text("DirectAuth app")) } } @@ -293,4 +312,3 @@ struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } -} diff --git a/files/customauth/ios/Package.swift b/files/customauth/ios/Package.swift index 63ea40f..b16da3a 100644 --- a/files/customauth/ios/Package.swift +++ b/files/customauth/ios/Package.swift @@ -3,6 +3,6 @@ import PackageDescription let package = Package( name: "TorusSwiftDirectSDK", dependencies: [ - .package(name: "TorusSwiftDirectSDK", url: "https://github.com/torusresearch/torus-direct-swift-sdk", .upToNextMajor(from: "0.0.1")) + .package(name: "TorusSwiftDirectSDK", url: "https://github.com/torusresearch/torus-direct-swift-sdk", .upToNextMajor(from: "1.1.0")) ], ) diff --git a/files/customauth/ios/SceneDelegate.swift b/files/customauth/ios/SceneDelegate.swift index ff7cc0a..a7b8969 100644 --- a/files/customauth/ios/SceneDelegate.swift +++ b/files/customauth/ios/SceneDelegate.swift @@ -3,6 +3,7 @@ import SwiftUI import TorusSwiftDirectSDK class SceneDelegate: UIResponder, UIWindowSceneDelegate { + var window: UIWindow? // Handle Universal logins @@ -69,6 +70,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } + struct SceneDelegate_Previews: PreviewProvider { static var previews: some View { /*@START_MENU_TOKEN@*/Text("Hello, World!")/*@END_MENU_TOKEN@*/ diff --git a/src/lib/integration-builder/customauth/index.ts b/src/lib/integration-builder/customauth/index.ts index d4262fd..7a924f2 100644 --- a/src/lib/integration-builder/customauth/index.ts +++ b/src/lib/integration-builder/customauth/index.ts @@ -261,15 +261,15 @@ const directAuthIntegrationBuilder: IntegrationBuilder = { }, { ...STEPS.setupSwiftUrlSchema, - pointer: { filename: "ios/SceneDelegate.swift", range: "18-23" }, + pointer: { filename: "ios/SceneDelegate.swift", range: "19-24" }, }, { ...STEPS.setupSwiftUniversalLinks, - pointer: { filename: "ios/SceneDelegate.swift", range: "9-15" }, + pointer: { filename: "ios/SceneDelegate.swift", range: "10-16" }, }, { ...STEPS.triggerSwiftLogin, - pointer: { filename: "ios/ContentView.swift", range: "21-32" }, + pointer: { filename: "ios/ContentView.swift", range: "21-33" }, } ); } diff --git a/src/lib/integration-builder/customauth/steps/install-swift-package.mdx b/src/lib/integration-builder/customauth/steps/install-swift-package.mdx index bd66b94..ea2a18f 100644 --- a/src/lib/integration-builder/customauth/steps/install-swift-package.mdx +++ b/src/lib/integration-builder/customauth/steps/install-swift-package.mdx @@ -11,7 +11,7 @@ import PackageDescription let package = Package( name: "TorusSwiftDirectSDK", dependencies: [ - .package(name: "TorusSwiftDirectSDK", url: "https://github.com/torusresearch/torus-direct-swift-sdk", .upToNextMajor(from: "0.0.1")) + .package(name: "TorusSwiftDirectSDK", url: "https://github.com/torusresearch/torus-direct-swift-sdk", .upToNextMajor(from: "1.1.0")) ] ) ``` diff --git a/src/lib/integration-builder/customauth/steps/trigger-swift-login.mdx b/src/lib/integration-builder/customauth/steps/trigger-swift-login.mdx index d3224c0..b07a94f 100644 --- a/src/lib/integration-builder/customauth/steps/trigger-swift-login.mdx +++ b/src/lib/integration-builder/customauth/steps/trigger-swift-login.mdx @@ -13,8 +13,9 @@ let sub = SubVerifierDetails(loginType: .installed, loginProvider: .google, clientId: "", verifierName: , - redirectURL: "") -let sdk = TorusSwiftDirectSDK(aggregateVerifierType: , aggregateVerifierName: , subVerifierDetails: [sub]) + redirectURL: "", + browserRedirectURL: "") +let sdk = TorusSwiftDirectSDK(aggregateVerifierType: "," aggregateVerifierName: "", subVerifierDetails: [sub], network: ) sdk.triggerLogin(controller: ?).done{ data in print("Private key reconstructed:", data) }.catch{ err in