Skip to content

Commit

Permalink
feat: update ios integration builder
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellee8 committed Oct 6, 2021
1 parent fab687c commit c33a4c7
Show file tree
Hide file tree
Showing 7 changed files with 13,399 additions and 39 deletions.
50 changes: 34 additions & 16 deletions files/customauth/ios/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"))
}
}
Expand All @@ -293,4 +312,3 @@ struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
2 changes: 1 addition & 1 deletion files/customauth/ios/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
],
)
2 changes: 2 additions & 0 deletions files/customauth/ios/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SwiftUI
import TorusSwiftDirectSDK

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

// Handle Universal logins
Expand Down Expand Up @@ -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@*/
Expand Down
Loading

0 comments on commit c33a4c7

Please sign in to comment.