Skip to content

Commit

Permalink
Merge branch 'master' into pnp-android-v5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbaz17 authored Nov 14, 2023
2 parents 400478f + 4fb689f commit 568ce97
Show file tree
Hide file tree
Showing 7 changed files with 433 additions and 18 deletions.
307 changes: 307 additions & 0 deletions docs/pnp/migration-guides/ios-v6-to-v7.mdx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/sdk/pnp/ios/custom-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ public struct ExtraLoginOptions: Codable{
let leeway: Int?
let verifierIdField: String?
let isVerifierIdCaseSensitive: Bool?
let additionalParams: [String : String]?
}
```

Expand Down
5 changes: 4 additions & 1 deletion docs/sdk/pnp/ios/initialize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
4 changes: 2 additions & 2 deletions docs/sdk/pnp/ios/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.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.4.1'
```

## Configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/pnp/ios/ios.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.1` SDK Version.

### Requirements

Expand Down
100 changes: 100 additions & 0 deletions docs/sdk/pnp/ios/mfa.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,103 @@ class ViewModel: ObservableObject {
}

```

## 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`

<Tabs
defaultValue="table"
values={[
{ label: "Table", value: "table" },
{ label: "Class", value: "class" },
]}
>

<TabItem value="table">

`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 |

</TabItem>

<TabItem value="class">

```swift

public struct MfaSetting: Codable {
public init(enable: Bool, priority: Int?, mandatory: Bool? = nil) {
self.enable = enable
self.priority = priority
self.mandatory = mandatory
}

let enable: Bool
let priority: Int?
let mandatory: Bool?
}

public struct MfaSettings: Codable {
public init(deviceShareFactor: MfaSetting?, backUpShareFactor: MfaSetting?, socialBackupFactor: MfaSetting?, passwordFactor: MfaSetting?) {
self.deviceShareFactor = deviceShareFactor
self.backUpShareFactor = backUpShareFactor
self.socialBackupFactor = socialBackupFactor
self.passwordFactor = passwordFactor
}

let deviceShareFactor: MfaSetting?
let backUpShareFactor: MfaSetting?
let socialBackupFactor: MfaSetting?
let passwordFactor: MfaSetting?
}


```

</TabItem>

</Tabs>

```swift
let result = try await Web3Auth(.init(
clientId: clientId,
network: network,
loginConfig: [
TypeOfLogin.google.rawValue:
.init(
verifier: "w3a-agg-example",
typeOfLogin: .google,
name: "Web3Auth-Aggregate-Verifier-Google-Example",
clientId: "774338308167-q463s7kpvja16l4l0kko3nb925ikds2p.apps.googleusercontent.com",
verifierSubIdentifier: "w3a-google"
)
],
whiteLabel: W3AWhiteLabelData(
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
mode: .dark,
theme: ["primary": "#d53f8c"]),
mfaSettings: MfaSettings(
deviceShareFactor: MfaSetting(enable: true, priority: 1),
backUpShareFactor: MfaSetting(enable: true, priority: 2),
socialBackupFactor: MfaSetting(enable: true, priority: 3),
passwordFactor: MfaSetting(enable: true, priority: 4)
)
)).login(
W3ALoginParams(
loginProvider: .GOOGLE,
dappShare: nil,
extraLoginOptions: ExtraLoginOptions(display: nil, prompt: nil, max_age: nil, ui_locales: nil, id_token_hint: nil, id_token: nil, login_hint: nil, acr_values: nil, scope: nil, audience: nil, connection: nil, domain: nil, client_id: nil, redirect_uri: nil, leeway: nil, verifierIdField: nil, isVerifierIdCaseSensitive: nil, additionalParams: nil),
mfaLevel: .DEFAULT,
curve: .SECP256K1
))
```
32 changes: 18 additions & 14 deletions docs/sdk/pnp/ios/whitelabel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,31 @@ For defining custom UI, branding, and translations for your brand app, you just

<TabItem value="table">

| 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 | Description | Default | Mandatory |
| ----------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | --------- |
| `appName` | `String` | App name 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` | `Language` | Default Language to use. <br/> Choose from: <ul><li>`en` - English</li><li>`de` - German</li><li>`ja` - Japanese</li><li>`ko` - Korean</li><li>`zh` - Mandarin</li><li>`es` - Spanish</li><li>`fr` - French</li><li>`pt` - Portuguese</li><li>`nl` - Dutch</li></ul> | en - English | No |
| `mode` | `ThemeModes` | Choose between `auto`, `light` or `dark` modes. | `auto` | No |
| `theme` | `[String: String]` | Used to customize the theme of the login modal with the following options <br /> `'primary'` - To customize the primary color of the modal's content | `#0364FF` | No |
| `appUrl` | `String` | App URL to be displayed in the User Flow Screens. | dApp's Website URL | No |
| `useLogoLoader` | `Bool` | Loads the logo when loading | false | No |

</TabItem>

<TabItem value="interface">

```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?
}
```

Expand All @@ -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
Expand Down

0 comments on commit 568ce97

Please sign in to comment.