# Initialize Web3auth Core Kit tkey ios SDK After installation, the next step to using Web3Auth Core Kit tKey SDK is to Initialize the SDK. The Initialization takes a few steps, including initiating the tKey SDK with the service provider and modules. ## configuration of service provider Service Provider in tKey is used for generating a Share A, i.e. the private key share managed by a wallet service provider via their authentication flows. This share in our key infrastructure refers to the social login aspect, where we associate a private key share with the user's social login, enabling the seamless login experience. In order to configure your service provider, you must use [CustomAuth Swift SDK](https://github.com/torusresearch/customauth-swift-sdk). Since CustomAuth Swift SDK is not automatically installed when you install tkey ios SDK, let's start with installation first. ### Usage of CustomAuth Swift SDK You can find more detailed [document here.](https://github.com/torusresearch/customauth-swift-sdk) #### 1. Installation ##### Swift package manager In project settings, add the Github URL as a swift package dependency. ```swift import PackageDescription let package = Package( name: "CustomAuth", dependencies: [ .package(name: "CustomAuth", url: "https://github.com/torusresearch/customauth-swift-sdk", from: "2.4.0")) ] ) ``` ##### Cocoapods ```ruby pod 'CustomAuth', '~> 5.0.0' ``` ##### Manual import or other packages If you require a package manager other than SPM or Cocoapods, do reach out to hello@tor.us or alternatively clone the repo manually and import as a framework in your project #### 2. Initialization Initalize the SDK depending on the login you require. The example below does so for a single google login. `redirectURL` refers to a url for the login flow to redirect into your app, it should have a scheme that is registered by your app, for example `com.mycompany.myapp://redirect`. `browserRedirectURL` refers to a page that the browser should use in the login flow, it should have a http or https scheme. ```swift import CustomAuth let sub = SubVerifierDetails(loginType: .installed, // default .web loginProvider: .google, clientId: "<your-client-id>", verifierName: "<verifier-name>", redirectURL: "<your-redirect-url>", browserRedirectURL: "<your-browser-redirect-url>") let tdsdk = CustomAuth(aggregateVerifierType: "<type-of-verifier>", aggregateVerifierName: "<verifier-name>", subVerifierDetails: [sub], network: <etherum-network-to-use>) // controller is used to present a SFSafariViewController. tdsdk.triggerLogin(controller: <UIViewController>?, browserType: <method-of-opening-browser>, modalPresentationStyle: <style-of-modal>).done{ data in print("private key rebuild", data) }.catch{ err in print(err) } ``` Logins are dependent on verifier scripts/verifiers. There are other verifiers including `single_id_verifier`, `and_aggregate_verifier`, `or_aggregate_verifier` and `single_logins` of which you may need to use depending on your required logins. To get your application's verifier script setup, do reach out to hello@tor.us or to read more about verifiers do checkout [the docs](https://docs.tor.us/customauth/supported-authenticators-verifiers). ### After finished configuration of CustomAuth SDK function `triggerLogin()` returns a promise that resolve with a Dictionary that contain at least `privateKey` and `publicAddress` field. Initialize the service provider with the privateKey retrived by result of `triggerLogin()`. ```swift tdsdk.triggerLogin(controller: <UIViewController>?, browserType: <method-of-opening-browser>, modalPresentationStyle: <style-of-modal>).done{ data in print("private key rebuild", data) let key = data["privateKey"] service_provider = try! ServiceProvider(enable_logging: true, postbox_key: key) }.catch{ err in print(err) } ```