From 7edc8962e4869fbc44dc602f59a812ae8b961491 Mon Sep 17 00:00:00 2001 From: hqjang-pepper Date: Mon, 6 Nov 2023 11:17:36 +0900 Subject: [PATCH 1/5] pnp swift v7 docs update --- docs/pnp/migration-guides/ios-v6-to-v7.mdx | 153 +++++++++++++++++++++ docs/sdk/pnp/ios/initialize.mdx | 5 +- docs/sdk/pnp/ios/install.mdx | 4 +- docs/sdk/pnp/ios/ios.mdx | 2 +- docs/sdk/pnp/ios/mfa.mdx | 18 +-- docs/sdk/pnp/ios/whitelabel.mdx | 32 +++-- sidebars.js | 7 + 7 files changed, 194 insertions(+), 27 deletions(-) create mode 100644 docs/pnp/migration-guides/ios-v6-to-v7.mdx diff --git a/docs/pnp/migration-guides/ios-v6-to-v7.mdx b/docs/pnp/migration-guides/ios-v6-to-v7.mdx new file mode 100644 index 000000000..b147a5153 --- /dev/null +++ b/docs/pnp/migration-guides/ios-v6-to-v7.mdx @@ -0,0 +1,153 @@ +--- +title: PnP IOS SDK - v6 to v7 +displayed_sidebar: docs +description: "PnP IOS SDK - v6 to v7 | Documentation - Web3Auth" +sidebar_label: v6 to v7 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +## General + +### openlogin v5 is supported + +With V7, Users can now log in from sapphire mainnet and sapphire devnet. + +```swift +import Web3Auth + +let web3auth = Web3Auth(W3AInitParams( + clientId: "", + network: .MAINNET, // you can use .sapphire_devnet or .sapphire_mainnet + sdkUrl: ..., + redirectUrl: ..., +)) +``` + +### Web3AuthState now has more parameters + +In v7, you should add `coreKitKey` and `coreKitEd25519PrivKey` field when you initialize Web3authState. + +```swift +let user: Web3AuthState = .init(privKey: "12345", + ed25519PrivKey: "32334", + sessionId: "23234384y7735y47shdj", + userInfo: nil, + error: nil, + // highlight-start + coreKitKey: "45676", + coreKitEd25519PrivKey: "84567" + // highlight-end +) +``` + +### W3AInitParams param configuration changed + +In v7, the whiteLabel parameter type and configuration has changed. And, as mentioned earlier, the sapphire network type has been added. Also several +parameters have been added to W3AInitParams. + +#### change of `WhiteLabel` parameter configuration + + + + + +| Parameter | Type | Mandatory | Description | +| ----------------- | ------------------ | --------- | ------------------------------------------------- | +| `name` | `String` | No | Name of your application | +| `logoLight` | `String` | No | Light logo for dark background | +| `logoDark` | `String` | No | Dark logo for light background | +| `defaultLanguage` | `String` | No | Default translation language to be used | +| `dark` | `Boolean` | No | If true, enables dark mode. Default is light mode | +| `theme` | `[String, String]` | No | Whitelabel theme | + + + + + +| Parameter | Type | Mandatory | Description | +| ----------------- | ------------------ | --------- | --------------------------------------- | +| `appName` | `String` | No | Name of your application | +| `logoLight` | `String` | No | Light logo for dark background | +| `logoDark` | `String` | No | Dark logo for light background | +| `defaultLanguage` | `String` | No | Default translation language to be used | +| `mode` | `Bool` | No | 3 Theme modes of the application | +| `theme` | `[String, String]` | No | Whitelabel theme | +| `appUrl` | `String` | No | Url of your application | +| `useLogoLoader` | `Bool` | No | Loads the logo when loading | + + + + + +#### change of `W3AInitParams` object + +The `Web3Auth` constructor takes an object called `W3AInitParams` as input. The below are the aviliable fields of the `W3AInitParams` object. + + + + + +| Parameter | Type | Mandatory | Description | +| ---------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| `clientId` | String | Yes | Your Web3Auth project ID | +| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet` or `.cyan` | +| `sdkUrl` | URL | No | Web3Auth sdk frontend to be used. This field is for advanced usage only and should not be changed. | +| `redirectUrl` | String | No | redirectUrl to be passed to the sdk frontend. This field is for advanced usage only and should not be changed. | +| `whiteLabel` | W3AWhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. | +| `loginConfig` | `[String : W3ALoginConfig]` | No | A configuration optional object to customize login flow. | +| `useCoreKitKey` | `bool` | No | Use CoreKit Key to get core kit key. | +| `chainNamespace` | `ChainNamespace` | No | Chain Namespace [`eip155` and `solana`] | + + + + + +| Parameter | Type | Mandatory | Description | +| ---------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| `clientId` | String | Yes | Your Web3Auth project ID | +| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet`, `.cyan`, or `.sapphire_devnet` or `.sapphire_mainnet` | +| `buildEnv` | BuildEnv | No | Obtion for auth service, `production`, `staging`, `testing` available | +| `sdkUrl` | URL | No | Web3Auth sdk frontend to be used. This field is for advanced usage only and should not be changed. | +| `redirectUrl` | String | No | redirectUrl to be passed to the sdk frontend. This field is for advanced usage only and should not be changed. | +| `whiteLabel` | W3AWhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. | +| `loginConfig` | `[String : W3ALoginConfig]` | No | A configuration optional object to customize login flow. | +| `useCoreKitKey` | `bool` | No | Use CoreKit Key to get core kit key. | +| `chainNamespace` | `ChainNamespace` | No | Chain Namespace [`eip155` and `solana`] | +| `MfaSettings` | `MfaSettings` | No | Settings for Multi factor authentication | +| `sessionTIme` | Int | No | Session maintainance time | + + + + + +Here's the example configuration of Web3AuthOptions. + +```swift +web3Auth = await Web3Auth(W3AInitParams( + clientId: clientId, + network: network, + whiteLabel: W3AWhiteLabelData( + appName: "Web3Auth iOS Example", + defaultLanguage: .en, + mode: .dark, theme: ["primary": "#123456"]) + )) +``` + +### web3.swift version updated to v1.6 + +With V7, lots of package dependencies have been updated. Among that, version of package `web3.swift` is updated to v1.6.0. Ethereum-related calls from +the client changed lot, so need to care about that. diff --git a/docs/sdk/pnp/ios/initialize.mdx b/docs/sdk/pnp/ios/initialize.mdx index 6d9f25528..e538345b8 100644 --- a/docs/sdk/pnp/ios/initialize.mdx +++ b/docs/sdk/pnp/ios/initialize.mdx @@ -62,10 +62,13 @@ The `Web3Auth` constructor takes an object called `W3AInitParams` as input. The | Parameter | Type | Mandatory | Description | | ---------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `clientId` | String | Yes | Your Web3Auth project ID | -| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet` or `.cyan` | +| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet`, `.cyan`, or `.sapphire_devnet` or `.sapphire_mainnet` | +| `buildEnv` | BuildEnv | No | Obtion for auth service, `production`, `staging`, `testing` available | | `sdkUrl` | URL | No | Web3Auth sdk frontend to be used. This field is for advanced usage only and should not be changed. | | `redirectUrl` | String | No | redirectUrl to be passed to the sdk frontend. This field is for advanced usage only and should not be changed. | | `whiteLabel` | W3AWhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. | | `loginConfig` | `[String : W3ALoginConfig]` | No | A configuration optional object to customize login flow. | | `useCoreKitKey` | `bool` | No | Use CoreKit Key to get core kit key. | | `chainNamespace` | `ChainNamespace` | No | Chain Namespace [`eip155` and `solana`] | +| `MfaSettings` | `MfaSettings` | No | Settings for Multi factor authentication | +| `sessionTIme` | Int | No | Session maintainance time | diff --git a/docs/sdk/pnp/ios/install.mdx b/docs/sdk/pnp/ios/install.mdx index 68bc690c6..4b3549d33 100644 --- a/docs/sdk/pnp/ios/install.mdx +++ b/docs/sdk/pnp/ios/install.mdx @@ -17,14 +17,14 @@ description: "Installing Web3Auth PnP iOS SDK | Documentation - Web3Auth" https://github.com/Web3Auth/web3auth-swift-sdk ``` - From the `Dependency Rule` dropdown, select `Exact Version` and enter `6.0.1` as the version. + From the `Dependency Rule` dropdown, select `Exact Version` and enter `7.3.0` as the version. 1. When finished, Xcode will automatically begin resolving and downloading your dependencies in the background. ## Cocoapods ```sh -pod 'Web3Auth', '~> 6.0.1' +pod 'Web3Auth', '~> 7.2.0' ``` ## Configuration diff --git a/docs/sdk/pnp/ios/ios.mdx b/docs/sdk/pnp/ios/ios.mdx index 599794a3c..887325dbe 100644 --- a/docs/sdk/pnp/ios/ios.mdx +++ b/docs/sdk/pnp/ios/ios.mdx @@ -10,7 +10,7 @@ iOS SDK is a client-side library you can use with your iOS app to authenticate u custodial way on successful authentication of the user. This authentication can be achieved by using any of the social logins Web3Auth provides or using a custom authentication flow of your choice. -#### This Documentation is based on the `6.0.1` SDK Version. +#### This Documentation is based on the `7.3.0` SDK Version. ### Requirements diff --git a/docs/sdk/pnp/ios/mfa.mdx b/docs/sdk/pnp/ios/mfa.mdx index 2bd7162ff..4e8f99646 100644 --- a/docs/sdk/pnp/ios/mfa.mdx +++ b/docs/sdk/pnp/ios/mfa.mdx @@ -10,12 +10,6 @@ device and also to recover their account if they lose their original device. You can set the mfaLevel within the `loginParams` to customize when mfa screen should be shown to user. It currently accepts 4 values: -- **`default`** - Setting the mfaLevel to default will present the MFA screen to user on every third login. `mfaLevel = MFALevel.DEFAULT` -- **`optional`** - Setting mfaLevel to optional will present the MFA screen to user on every login but user will have the option to skip it. - `mfaLevel = MFALevel.OPTIONAL` -- **`mandatory`** - Setting mfaLevel to mandatory will make it mandatory for user to setup MFA after login. `mfaLevel = MFALevel.MANDATORY` -- **`none`** - Setting mfaLevel to none will skip the mfa setup screen totally. `mfaLevel = MFALevel.NONE` - ```swift Web3Auth().login(W3ALoginParams(loginProvider: provider, mfaLevel = MFALevel.MANDATORY)) ``` @@ -54,9 +48,15 @@ class ViewModel: ObservableObject { let result = try await Web3Auth().login( W3ALoginParams( loginProvider: provider, // can be .GOOGLE, .FACEBOOK, .APPLE etc - // highlight-next-line - mfaLevel: MFALevel.MANDATORY - )) + // highlight-start + mfaSettings: MfaSettings( + deviceShareFactor: .init(enable: true, priority: 1), + backUpShareFactor: .init(enable: true, priority: 2), + socialBackupFactor: .init(enable: true, priority: 3), + passwordFactor: .init(enable: true, priority: 4) + ) + // highlight-end + )) await MainActor.run(body: { user = result loggedIn = true diff --git a/docs/sdk/pnp/ios/whitelabel.mdx b/docs/sdk/pnp/ios/whitelabel.mdx index 824af1ff8..03651e930 100644 --- a/docs/sdk/pnp/ios/whitelabel.mdx +++ b/docs/sdk/pnp/ios/whitelabel.mdx @@ -25,14 +25,16 @@ For defining custom UI, branding, and translations for your brand app, you just -| Parameter | Type | Mandatory | Description | -| ----------------- | ------------------ | --------- | ------------------------------------------------- | -| `name` | `String` | No | Name of your application | -| `logoLight` | `String` | No | Light logo for dark background | -| `logoDark` | `String` | No | Dark logo for light background | -| `defaultLanguage` | `String` | No | Default translation language to used | -| `dark` | `Bool` | No | If true, enables dark mode. Default is light mode | -| `theme` | `[String, String]` | No | Whitelabel theme | +| Parameter | Type | Mandatory | Description | +| ----------------- | ------------------ | --------- | --------------------------------------- | +| `appName` | `String` | No | Name of your application | +| `logoLight` | `String` | No | Light logo for dark background | +| `logoDark` | `String` | No | Dark logo for light background | +| `defaultLanguage` | `String` | No | Default translation language to be used | +| `mode` | `Bool` | No | 3 Theme modes of the application | +| `theme` | `[String, String]` | No | Whitelabel theme | +| `appUrl` | `String` | No | Url of your application | +| `useLogoLoader` | `Bool` | No | Loads the logo when loading | @@ -40,12 +42,14 @@ For defining custom UI, branding, and translations for your brand app, you just ```swift public struct W3AWhiteLabelData: Codable { - let name: String? + let appName: String? let logoLight: String? let logoDark: String? - let defaultLanguage: String? - let dark: Bool? + let defaultLanguage: Language? + let mode: ThemeModes? let theme: [String: String]? + let appUrl: String? + let useLogoLoader: Bool? } ``` @@ -60,11 +64,11 @@ web3Auth = await Web3Auth( network: .testnet, // highlight-start whiteLabel: W3AWhiteLabelData( - name: "Web3Auth Stub", + appName: "Web3Auth Stub", logoLight: "https://images.web3auth.io/web3auth-logo-w.svg", logoDark: "https://images.web3auth.io/web3auth-logo-w.svg", - defaultLanguage: "en", // en, de, ja, ko, zh, es, fr, pt, nl - dark: true, + defaultLanguage: .en, // en, de, ja, ko, zh, es, fr, pt, nl + mode: .dark theme: ["primary": "#d53f8c"]) )) // highlight-end diff --git a/sidebars.js b/sidebars.js index e5200732e..6ac6ea687 100644 --- a/sidebars.js +++ b/sidebars.js @@ -128,6 +128,13 @@ module.exports = { collapsible: true, items: ["pnp/migration-guides/android-v4-to-v5"], }, + { + type: "category", + label: "PnP IOS", + collapsed: true, + collapsible: true, + items: ["pnp/migration-guides/ios-v6-to-v7"], + }, "pnp/migration-guides/rn-v3-to-v4", ], From 0c1bd9ef8136b9f484b923e72b287fe68f0eba4c Mon Sep 17 00:00:00 2001 From: hqjang-pepper Date: Fri, 10 Nov 2023 01:35:14 +0900 Subject: [PATCH 2/5] fix whitelabel --- docs/sdk/pnp/android/android.mdx | 2 +- docs/sdk/pnp/android/install.mdx | 2 +- docs/sdk/pnp/android/whitelabel.mdx | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/sdk/pnp/android/android.mdx b/docs/sdk/pnp/android/android.mdx index 57c2aedb0..5f3bffc28 100644 --- a/docs/sdk/pnp/android/android.mdx +++ b/docs/sdk/pnp/android/android.mdx @@ -10,7 +10,7 @@ authenticate users using Web3Auth. For using Web3Auth natively in Android, Web3A key generated in a non-custodial way on successful user authentication. This authentication can be achieved by using any social login options that Web3Auth supports or custom authentication flow of your choice. -#### This Documentation is based on the `5.1.1` SDK Version. +#### This Documentation is based on the `5.3.0` SDK Version. ## Requirements diff --git a/docs/sdk/pnp/android/install.mdx b/docs/sdk/pnp/android/install.mdx index 44f35ed04..faa15b8ce 100644 --- a/docs/sdk/pnp/android/install.mdx +++ b/docs/sdk/pnp/android/install.mdx @@ -27,7 +27,7 @@ Then, in your app-level `build.gradle` dependencies section, add the following: dependencies { // ... // highlight-next-line - implementation 'com.github.Web3Auth:web3auth-android-sdk:5.0.2' + implementation 'com.github.Web3Auth:web3auth-android-sdk:5.3.0' } ``` diff --git a/docs/sdk/pnp/android/whitelabel.mdx b/docs/sdk/pnp/android/whitelabel.mdx index 2bb149f0b..0c27aa298 100644 --- a/docs/sdk/pnp/android/whitelabel.mdx +++ b/docs/sdk/pnp/android/whitelabel.mdx @@ -27,16 +27,16 @@ Object called `whiteLabel`. This parameter takes another object called `WhiteLab -| Parameter | Type | Mandatory | Description | -| ----------------- | ------------------ | --------- | --------------------------------------- | -| `appName` | `String` | No | Name of your application | -| `appUrl` | `String` | No | Url of your application | -| `logoLight` | `String` | No | Light logo for dark background | -| `logoDark` | `String` | No | Dark logo for light background | -| `defaultLanguage` | `String` | No | Default translation language to be used | -| `mode` | `Boolean` | No | 3 Theme modes of the application | -| `theme` | `Map` | No | Whitelabel theme | -| `useLogoLoader` | `Boolean` | No | Loads the logo when loading | +| Parameter | Type | Description | Default | Mandatory | +| ------------------ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | --------- | +| `appName?` | `string` | App name to be displayed in the User Flow Screens. | dApp's Website URL | No | +| `appUrl?` | `string` | App URL to be displayed in the User Flow Screens. | dApp's Website URL | No | +| `logoLight?` | `string` | App logo to be shown on the dark background (dark theme) | [web3auth-logo.svg](https://images.web3auth.io/web3auth-logo.svg) | No | +| `logoDark?` | `string` | App logo to be shown on the light background (light theme) | [web3auth-logo.svg](https://images.web3auth.io/web3auth-logo.svg) | No | +| `defaultLanguage?` | `string` | Default Language to use.
Choose from:
  • `Language.EN` - English
  • `Language.DE` - German
  • `Language.JA` - Japanese
  • `Language.KO` - Korean
  • `Language.ZH` - Mandarin
  • `Language.ES` - Spanish
  • `Language.FR` - French
  • `Language.PT` - Portuguese
  • `Language.NL` - Dutch
| en - English | No | +| `mode?` | `string` | Choose between `auto`, `light` or `dark` modes. | `auto` | No | +| `theme?` | `Map` | Used to customize the theme of the login modal with the following options
`'primary'` - To customize the primary color of the modal's content | `#0364FF` | No | +| `useLogoLoader` | `Boolean` | Loads the logo when loading | false | No |
From 1db92e89cb3f9d845c11f62e6af838a4c8efd0f0 Mon Sep 17 00:00:00 2001 From: hqjang-pepper Date: Fri, 10 Nov 2023 02:08:17 +0900 Subject: [PATCH 3/5] add mfaSettings description --- docs/sdk/pnp/android/initialize.mdx | 70 +++++++++++++++++++++---- docs/sdk/pnp/android/mfa.mdx | 81 +++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 9 deletions(-) diff --git a/docs/sdk/pnp/android/initialize.mdx b/docs/sdk/pnp/android/initialize.mdx index 653e60697..36a5ef078 100644 --- a/docs/sdk/pnp/android/initialize.mdx +++ b/docs/sdk/pnp/android/initialize.mdx @@ -52,6 +52,8 @@ The Web3Auth Constructor takes an object with `Web3AuthOptions` as input. | loginConfig | LoginConfigItem | No | A configuration optional object to use custom authentication. Refer [Custom Authentication](/pnp/features/custom-authentication) for more info. | | useCoreKitKey | Boolean | No | Use Core Kit Key true to the Core Kit keys. | | chainNamespace | enum com.web3auth.core.Web3Auth.ChainNamespace ["EIP155", "SOLANA"] | No | A configuration optional object to use chain namespace. | +| `mfaSettings` | MfaSettings | No | MFA Settings | +| `sessionTime` | `Int | No | Session Time in seconds, default is `86400` seconds | @@ -59,15 +61,18 @@ The Web3Auth Constructor takes an object with `Web3AuthOptions` as input. ```kotlin data class Web3AuthOptions( - var context: Context, - val clientId: String, - val network: Network, - @Transient var redirectUrl: Uri? = null, - var sdkUrl: String = getSdkUrl(network), - val whiteLabel: WhiteLabelData? = null, - val loginConfig: HashMap? = null, - val useCoreKitKey: Boolean? = false, - val chainNamespace: ChainNamespace? = ChainNamespace.EIP155 + var context: Context, + val clientId: String, + val network: Network, + var buildEnv: BuildEnv? = BuildEnv.PRODUCTION, + @Transient var redirectUrl: Uri? = null, + var sdkUrl: String = getSdkUrl(buildEnv), + val whiteLabel: WhiteLabelData? = null, + val loginConfig: HashMap? = null, + val useCoreKitKey: Boolean? = false, + val chainNamespace: ChainNamespace? = ChainNamespace.EIP155, + val mfaSettings: MfaSettings? = null, + val sessionTime: Int? = 86400 ) ``` @@ -101,6 +106,53 @@ Add the below line to your `app/res/values/strings.xml` file: ``` +### Using the `mfaSettings` to configure MFA Order + +You can configure the order of MFA or enable/disable MFA type by passing the `mfaSettings` object in `Web3AuthOptions`. + +`MfaSettings` + + + + + +`deviceShareFactor` | `backUpShareFactor` | `socialBackupFactor` | `passwordFactor` + +| Parameter | Type | Mandatory | Description | +| ----------- | ------ | --------- | ---------------------- | +| `enable` | `bool` | Yes | Enable/Disable MFA | +| `priority` | `int` | No | Priority of MFA | +| `mandatory` | `bool` | No | Mandatory/Optional MFA | + + + + + +```kotlin + data class MfaSetting( + var enable: Boolean, + var priority: Int?, + var mandatory: Boolean? + ) + + data class MfaSettings( + private var deviceShareFactor: MfaSetting? = null, + private var backUpShareFactor: MfaSetting? = null, + private var socialBackupFactor: MfaSetting? = null, + private var passwordFactor: MfaSetting? = null, + ) +``` + + + + + ### Session Management The Session Management feature allows you to check the existing sessions with Web3Auth. The `sessionResponse()` will allow users to remain diff --git a/docs/sdk/pnp/android/mfa.mdx b/docs/sdk/pnp/android/mfa.mdx index 553ee9c57..6ecee5571 100644 --- a/docs/sdk/pnp/android/mfa.mdx +++ b/docs/sdk/pnp/android/mfa.mdx @@ -57,3 +57,84 @@ class MainActivity : AppCompatActivity() { // ... } ``` + +## Using the `mfaSettings` to configure MFA Order + +You can configure the order of MFA or enable/disable MFA type by passing the `mfaSettings` object in `Web3AuthOptions`. + +`MfaSettings` + + + + + +`deviceShareFactor` | `backUpShareFactor` | `socialBackupFactor` | `passwordFactor` + +| Parameter | Type | Mandatory | Description | +| ----------- | ------ | --------- | ---------------------- | +| `enable` | `bool` | Yes | Enable/Disable MFA | +| `priority` | `int` | No | Priority of MFA | +| `mandatory` | `bool` | No | Mandatory/Optional MFA | + + + + + +```kotlin + data class MfaSetting( + var enable: Boolean, + var priority: Int?, + var mandatory: Boolean? + ) + + data class MfaSettings( + private var deviceShareFactor: MfaSetting? = null, + private var backUpShareFactor: MfaSetting? = null, + private var socialBackupFactor: MfaSetting? = null, + private var passwordFactor: MfaSetting? = null, + ) +``` + + + + + +```kotlin + web3Auth = Web3Auth( + Web3AuthOptions( + context = this, + clientId = getString(R.string.web3auth_project_id), // pass over your Web3Auth Client ID from Developer Dashboard + network = Network.SAPPHIRE_MAINNET, // pass over the network you want to use (MAINNET or TESTNET or CYAN, AQUA, SAPPHIRE_MAINNET or SAPPHIRE_TESTNET) + buildEnv = BuildEnv.PRODUCTION, + redirectUrl = Uri.parse("com.w3a.web3authdemoapp://auth"), // your app's redirect URL + // Optional parameters + whiteLabel = WhiteLabelData( + "Web3Auth Android FireBase Example", + null, + null, + null, + Language.EN, + ThemeModes.LIGHT, + true, + hashMapOf( + "primary" to "#eb5424" + ) + ), + // highlight-start + mfaSettings = MfaSettings( + deviceShareFactor = MfaSetting(true, 1, true), + socialBackupFactor = MfaSetting(true, 2, false), + passwordFactor = MfaSetting(true, 3, false), + backUpShareFactor = MfaSetting(true, 4, false), + ) + // highlight-end + ... // add your loginconfig + ) + ) +``` From 057a0db73a2ffdaad54dccc2a0bc79b0c7082466 Mon Sep 17 00:00:00 2001 From: hqjang-pepper Date: Fri, 10 Nov 2023 20:02:43 +0900 Subject: [PATCH 4/5] rollback ios changes, nothing to do with this PR --- docs/sdk/pnp/ios/initialize.mdx | 5 +---- docs/sdk/pnp/ios/install.mdx | 4 ++-- docs/sdk/pnp/ios/ios.mdx | 2 +- docs/sdk/pnp/ios/mfa.mdx | 18 +++++++++--------- docs/sdk/pnp/ios/whitelabel.mdx | 32 ++++++++++++++------------------ 5 files changed, 27 insertions(+), 34 deletions(-) diff --git a/docs/sdk/pnp/ios/initialize.mdx b/docs/sdk/pnp/ios/initialize.mdx index e538345b8..6d9f25528 100644 --- a/docs/sdk/pnp/ios/initialize.mdx +++ b/docs/sdk/pnp/ios/initialize.mdx @@ -62,13 +62,10 @@ The `Web3Auth` constructor takes an object called `W3AInitParams` as input. The | Parameter | Type | Mandatory | Description | | ---------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `clientId` | String | Yes | Your Web3Auth project ID | -| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet`, `.cyan`, or `.sapphire_devnet` or `.sapphire_mainnet` | -| `buildEnv` | BuildEnv | No | Obtion for auth service, `production`, `staging`, `testing` available | +| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet` or `.cyan` | | `sdkUrl` | URL | No | Web3Auth sdk frontend to be used. This field is for advanced usage only and should not be changed. | | `redirectUrl` | String | No | redirectUrl to be passed to the sdk frontend. This field is for advanced usage only and should not be changed. | | `whiteLabel` | W3AWhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. | | `loginConfig` | `[String : W3ALoginConfig]` | No | A configuration optional object to customize login flow. | | `useCoreKitKey` | `bool` | No | Use CoreKit Key to get core kit key. | | `chainNamespace` | `ChainNamespace` | No | Chain Namespace [`eip155` and `solana`] | -| `MfaSettings` | `MfaSettings` | No | Settings for Multi factor authentication | -| `sessionTIme` | Int | No | Session maintainance time | diff --git a/docs/sdk/pnp/ios/install.mdx b/docs/sdk/pnp/ios/install.mdx index 4b3549d33..68bc690c6 100644 --- a/docs/sdk/pnp/ios/install.mdx +++ b/docs/sdk/pnp/ios/install.mdx @@ -17,14 +17,14 @@ description: "Installing Web3Auth PnP iOS SDK | Documentation - Web3Auth" https://github.com/Web3Auth/web3auth-swift-sdk ``` - From the `Dependency Rule` dropdown, select `Exact Version` and enter `7.3.0` as the version. + From the `Dependency Rule` dropdown, select `Exact Version` and enter `6.0.1` as the version. 1. When finished, Xcode will automatically begin resolving and downloading your dependencies in the background. ## Cocoapods ```sh -pod 'Web3Auth', '~> 7.2.0' +pod 'Web3Auth', '~> 6.0.1' ``` ## Configuration diff --git a/docs/sdk/pnp/ios/ios.mdx b/docs/sdk/pnp/ios/ios.mdx index 887325dbe..599794a3c 100644 --- a/docs/sdk/pnp/ios/ios.mdx +++ b/docs/sdk/pnp/ios/ios.mdx @@ -10,7 +10,7 @@ iOS SDK is a client-side library you can use with your iOS app to authenticate u custodial way on successful authentication of the user. This authentication can be achieved by using any of the social logins Web3Auth provides or using a custom authentication flow of your choice. -#### This Documentation is based on the `7.3.0` SDK Version. +#### This Documentation is based on the `6.0.1` SDK Version. ### Requirements diff --git a/docs/sdk/pnp/ios/mfa.mdx b/docs/sdk/pnp/ios/mfa.mdx index 4e8f99646..2bd7162ff 100644 --- a/docs/sdk/pnp/ios/mfa.mdx +++ b/docs/sdk/pnp/ios/mfa.mdx @@ -10,6 +10,12 @@ device and also to recover their account if they lose their original device. You can set the mfaLevel within the `loginParams` to customize when mfa screen should be shown to user. It currently accepts 4 values: +- **`default`** - Setting the mfaLevel to default will present the MFA screen to user on every third login. `mfaLevel = MFALevel.DEFAULT` +- **`optional`** - Setting mfaLevel to optional will present the MFA screen to user on every login but user will have the option to skip it. + `mfaLevel = MFALevel.OPTIONAL` +- **`mandatory`** - Setting mfaLevel to mandatory will make it mandatory for user to setup MFA after login. `mfaLevel = MFALevel.MANDATORY` +- **`none`** - Setting mfaLevel to none will skip the mfa setup screen totally. `mfaLevel = MFALevel.NONE` + ```swift Web3Auth().login(W3ALoginParams(loginProvider: provider, mfaLevel = MFALevel.MANDATORY)) ``` @@ -48,15 +54,9 @@ class ViewModel: ObservableObject { let result = try await Web3Auth().login( W3ALoginParams( loginProvider: provider, // can be .GOOGLE, .FACEBOOK, .APPLE etc - // highlight-start - mfaSettings: MfaSettings( - deviceShareFactor: .init(enable: true, priority: 1), - backUpShareFactor: .init(enable: true, priority: 2), - socialBackupFactor: .init(enable: true, priority: 3), - passwordFactor: .init(enable: true, priority: 4) - ) - // highlight-end - )) + // highlight-next-line + mfaLevel: MFALevel.MANDATORY + )) await MainActor.run(body: { user = result loggedIn = true diff --git a/docs/sdk/pnp/ios/whitelabel.mdx b/docs/sdk/pnp/ios/whitelabel.mdx index 03651e930..824af1ff8 100644 --- a/docs/sdk/pnp/ios/whitelabel.mdx +++ b/docs/sdk/pnp/ios/whitelabel.mdx @@ -25,16 +25,14 @@ For defining custom UI, branding, and translations for your brand app, you just -| Parameter | Type | Mandatory | Description | -| ----------------- | ------------------ | --------- | --------------------------------------- | -| `appName` | `String` | No | Name of your application | -| `logoLight` | `String` | No | Light logo for dark background | -| `logoDark` | `String` | No | Dark logo for light background | -| `defaultLanguage` | `String` | No | Default translation language to be used | -| `mode` | `Bool` | No | 3 Theme modes of the application | -| `theme` | `[String, String]` | No | Whitelabel theme | -| `appUrl` | `String` | No | Url of your application | -| `useLogoLoader` | `Bool` | No | Loads the logo when loading | +| Parameter | Type | Mandatory | Description | +| ----------------- | ------------------ | --------- | ------------------------------------------------- | +| `name` | `String` | No | Name of your application | +| `logoLight` | `String` | No | Light logo for dark background | +| `logoDark` | `String` | No | Dark logo for light background | +| `defaultLanguage` | `String` | No | Default translation language to used | +| `dark` | `Bool` | No | If true, enables dark mode. Default is light mode | +| `theme` | `[String, String]` | No | Whitelabel theme | @@ -42,14 +40,12 @@ For defining custom UI, branding, and translations for your brand app, you just ```swift public struct W3AWhiteLabelData: Codable { - let appName: String? + let name: String? let logoLight: String? let logoDark: String? - let defaultLanguage: Language? - let mode: ThemeModes? + let defaultLanguage: String? + let dark: Bool? let theme: [String: String]? - let appUrl: String? - let useLogoLoader: Bool? } ``` @@ -64,11 +60,11 @@ web3Auth = await Web3Auth( network: .testnet, // highlight-start whiteLabel: W3AWhiteLabelData( - appName: "Web3Auth Stub", + name: "Web3Auth Stub", logoLight: "https://images.web3auth.io/web3auth-logo-w.svg", logoDark: "https://images.web3auth.io/web3auth-logo-w.svg", - defaultLanguage: .en, // en, de, ja, ko, zh, es, fr, pt, nl - mode: .dark + defaultLanguage: "en", // en, de, ja, ko, zh, es, fr, pt, nl + dark: true, theme: ["primary": "#d53f8c"]) )) // highlight-end From e36ef54aeede39daae0ec79475c77d1b66a21f09 Mon Sep 17 00:00:00 2001 From: hqjang-pepper Date: Tue, 14 Nov 2023 16:16:14 +0900 Subject: [PATCH 5/5] update android sdk version to v5.3.1, delete ios update from this PR --- docs/pnp/migration-guides/ios-v6-to-v7.mdx | 153 --------------------- docs/sdk/pnp/android/android.mdx | 2 +- docs/sdk/pnp/android/install.mdx | 2 +- 3 files changed, 2 insertions(+), 155 deletions(-) delete mode 100644 docs/pnp/migration-guides/ios-v6-to-v7.mdx diff --git a/docs/pnp/migration-guides/ios-v6-to-v7.mdx b/docs/pnp/migration-guides/ios-v6-to-v7.mdx deleted file mode 100644 index b147a5153..000000000 --- a/docs/pnp/migration-guides/ios-v6-to-v7.mdx +++ /dev/null @@ -1,153 +0,0 @@ ---- -title: PnP IOS SDK - v6 to v7 -displayed_sidebar: docs -description: "PnP IOS SDK - v6 to v7 | Documentation - Web3Auth" -sidebar_label: v6 to v7 ---- - -import TabItem from "@theme/TabItem"; -import Tabs from "@theme/Tabs"; - -## General - -### openlogin v5 is supported - -With V7, Users can now log in from sapphire mainnet and sapphire devnet. - -```swift -import Web3Auth - -let web3auth = Web3Auth(W3AInitParams( - clientId: "", - network: .MAINNET, // you can use .sapphire_devnet or .sapphire_mainnet - sdkUrl: ..., - redirectUrl: ..., -)) -``` - -### Web3AuthState now has more parameters - -In v7, you should add `coreKitKey` and `coreKitEd25519PrivKey` field when you initialize Web3authState. - -```swift -let user: Web3AuthState = .init(privKey: "12345", - ed25519PrivKey: "32334", - sessionId: "23234384y7735y47shdj", - userInfo: nil, - error: nil, - // highlight-start - coreKitKey: "45676", - coreKitEd25519PrivKey: "84567" - // highlight-end -) -``` - -### W3AInitParams param configuration changed - -In v7, the whiteLabel parameter type and configuration has changed. And, as mentioned earlier, the sapphire network type has been added. Also several -parameters have been added to W3AInitParams. - -#### change of `WhiteLabel` parameter configuration - - - - - -| Parameter | Type | Mandatory | Description | -| ----------------- | ------------------ | --------- | ------------------------------------------------- | -| `name` | `String` | No | Name of your application | -| `logoLight` | `String` | No | Light logo for dark background | -| `logoDark` | `String` | No | Dark logo for light background | -| `defaultLanguage` | `String` | No | Default translation language to be used | -| `dark` | `Boolean` | No | If true, enables dark mode. Default is light mode | -| `theme` | `[String, String]` | No | Whitelabel theme | - - - - - -| Parameter | Type | Mandatory | Description | -| ----------------- | ------------------ | --------- | --------------------------------------- | -| `appName` | `String` | No | Name of your application | -| `logoLight` | `String` | No | Light logo for dark background | -| `logoDark` | `String` | No | Dark logo for light background | -| `defaultLanguage` | `String` | No | Default translation language to be used | -| `mode` | `Bool` | No | 3 Theme modes of the application | -| `theme` | `[String, String]` | No | Whitelabel theme | -| `appUrl` | `String` | No | Url of your application | -| `useLogoLoader` | `Bool` | No | Loads the logo when loading | - - - - - -#### change of `W3AInitParams` object - -The `Web3Auth` constructor takes an object called `W3AInitParams` as input. The below are the aviliable fields of the `W3AInitParams` object. - - - - - -| Parameter | Type | Mandatory | Description | -| ---------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| `clientId` | String | Yes | Your Web3Auth project ID | -| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet` or `.cyan` | -| `sdkUrl` | URL | No | Web3Auth sdk frontend to be used. This field is for advanced usage only and should not be changed. | -| `redirectUrl` | String | No | redirectUrl to be passed to the sdk frontend. This field is for advanced usage only and should not be changed. | -| `whiteLabel` | W3AWhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. | -| `loginConfig` | `[String : W3ALoginConfig]` | No | A configuration optional object to customize login flow. | -| `useCoreKitKey` | `bool` | No | Use CoreKit Key to get core kit key. | -| `chainNamespace` | `ChainNamespace` | No | Chain Namespace [`eip155` and `solana`] | - - - - - -| Parameter | Type | Mandatory | Description | -| ---------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| `clientId` | String | Yes | Your Web3Auth project ID | -| `network` | Network | Yes | Web3Auth Network to run the authentication on, either `.mainnet`,`.aqua`, `.testnet`, `.cyan`, or `.sapphire_devnet` or `.sapphire_mainnet` | -| `buildEnv` | BuildEnv | No | Obtion for auth service, `production`, `staging`, `testing` available | -| `sdkUrl` | URL | No | Web3Auth sdk frontend to be used. This field is for advanced usage only and should not be changed. | -| `redirectUrl` | String | No | redirectUrl to be passed to the sdk frontend. This field is for advanced usage only and should not be changed. | -| `whiteLabel` | W3AWhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. | -| `loginConfig` | `[String : W3ALoginConfig]` | No | A configuration optional object to customize login flow. | -| `useCoreKitKey` | `bool` | No | Use CoreKit Key to get core kit key. | -| `chainNamespace` | `ChainNamespace` | No | Chain Namespace [`eip155` and `solana`] | -| `MfaSettings` | `MfaSettings` | No | Settings for Multi factor authentication | -| `sessionTIme` | Int | No | Session maintainance time | - - - - - -Here's the example configuration of Web3AuthOptions. - -```swift -web3Auth = await Web3Auth(W3AInitParams( - clientId: clientId, - network: network, - whiteLabel: W3AWhiteLabelData( - appName: "Web3Auth iOS Example", - defaultLanguage: .en, - mode: .dark, theme: ["primary": "#123456"]) - )) -``` - -### web3.swift version updated to v1.6 - -With V7, lots of package dependencies have been updated. Among that, version of package `web3.swift` is updated to v1.6.0. Ethereum-related calls from -the client changed lot, so need to care about that. diff --git a/docs/sdk/pnp/android/android.mdx b/docs/sdk/pnp/android/android.mdx index 5f3bffc28..803b6e476 100644 --- a/docs/sdk/pnp/android/android.mdx +++ b/docs/sdk/pnp/android/android.mdx @@ -10,7 +10,7 @@ authenticate users using Web3Auth. For using Web3Auth natively in Android, Web3A key generated in a non-custodial way on successful user authentication. This authentication can be achieved by using any social login options that Web3Auth supports or custom authentication flow of your choice. -#### This Documentation is based on the `5.3.0` SDK Version. +#### This Documentation is based on the `5.3.1` SDK Version. ## Requirements diff --git a/docs/sdk/pnp/android/install.mdx b/docs/sdk/pnp/android/install.mdx index faa15b8ce..7cc5d4a27 100644 --- a/docs/sdk/pnp/android/install.mdx +++ b/docs/sdk/pnp/android/install.mdx @@ -27,7 +27,7 @@ Then, in your app-level `build.gradle` dependencies section, add the following: dependencies { // ... // highlight-next-line - implementation 'com.github.Web3Auth:web3auth-android-sdk:5.3.0' + implementation 'com.github.Web3Auth:web3auth-android-sdk:5.3.1' } ```