Skip to content

Commit

Permalink
Merge branch 'master' into skale-feedback-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbaz17 authored Nov 14, 2023
2 parents 83aa20a + adee8e0 commit 97be832
Show file tree
Hide file tree
Showing 48 changed files with 1,193 additions and 276 deletions.
8 changes: 4 additions & 4 deletions docs/connect-blockchain/algorand.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ description: "Integrate Web3Auth with the Algorand Blockchain | Documentation -

import GetUserInfoSnippet from "@site/src/common/docs/_get-userinfo.mdx";

While using the Web3Auth Web SDK for a non-EVM chain like [Algorand](https://www.algorand.com/) you get a standard provider from which you can get the
private key of the user. Using this private key, you can use the corresponding libraries of the blockchain to make blockchain calls like getting the
user's `account`, fetch `balance`, `sign transaction`, `send transaction`, `read` from and `write` to the smart contract, etc. We have highlighted a
few methods here to get you started quickly on that.
While using the Web3Auth Web SDK for a non-EVM chain like [Algorand](https://algorandtechnologies.com/) you get a standard provider from which you can
get the private key of the user. Using this private key, you can use the corresponding libraries of the blockchain to make blockchain calls like
getting the user's `account`, fetch `balance`, `sign transaction`, `send transaction`, `read` from and `write` to the smart contract, etc. We have
highlighted a few methods here to get you started quickly on that.

:::note

Expand Down
307 changes: 307 additions & 0 deletions docs/pnp/migration-guides/ios-v6-to-v7.mdx

Large diffs are not rendered by default.

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

## Requirements

Expand Down
70 changes: 61 additions & 9 deletions docs/sdk/pnp/android/initialize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,27 @@ 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 |

</TabItem>

<TabItem value="interface">

```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<String, LoginConfigItem>? = 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<String, LoginConfigItem>? = null,
val useCoreKitKey: Boolean? = false,
val chainNamespace: ChainNamespace? = ChainNamespace.EIP155,
val mfaSettings: MfaSettings? = null,
val sessionTime: Int? = 86400
)
```

Expand Down Expand Up @@ -101,6 +106,53 @@ Add the below line to your `app/res/values/strings.xml` file:
</resources>
```

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

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

</TabItem>

</Tabs>

### Session Management

The Session Management feature allows you to check the existing sessions with Web3Auth. The `sessionResponse()` will allow users to remain
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/pnp/android/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.1'
}
```

Expand Down
81 changes: 81 additions & 0 deletions docs/sdk/pnp/android/mfa.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`

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

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

</TabItem>

</Tabs>

```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
)
)
```
20 changes: 10 additions & 10 deletions docs/sdk/pnp/android/whitelabel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ Object called `whiteLabel`. This parameter takes another object called `WhiteLab

<TabItem value="table">

| 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<String, Any>` | 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. <br/> Choose from: <ul><li>`Language.EN` - English</li><li>`Language.DE` - German</li><li>`Language.JA` - Japanese</li><li>`Language.KO` - Korean</li><li>`Language.ZH` - Mandarin</li><li>`Language.ES` - Spanish</li><li>`Language.FR` - French</li><li>`Language.PT` - Portuguese</li><li>`Language.NL` - Dutch</li></ul> | en - English | No |
| `mode?` | `string` | Choose between `auto`, `light` or `dark` modes. | `auto` | No |
| `theme?` | `Map<String, Any>` | 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 |
| `useLogoLoader` | `Boolean` | Loads the logo when loading | false | No |

</TabItem>

Expand Down
78 changes: 68 additions & 10 deletions docs/sdk/pnp/flutter/custom-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,16 @@ Future<void> initPlatformState() async {
network: Network.testnet,
redirectUrl: redirectUrl,
whiteLabel: WhiteLabelData(
dark: true, name: "Web3Auth Flutter App", theme: themeMap),
appName: "Web3Auth Flutter App",
logoLight:
"https://www.vectorlogo.zone/logos/flutterio/flutterio-icon.svg",
logoDark:
"https://cdn.icon-icons.com/icons2/2389/PNG/512/flutter_logo_icon_145273.png",
defaultLanguage: Language.en,
mode: ThemeModes.auto,
appUrl: "https://web3auth.io",
useLogoLoader: true,
theme: themeMap),
// highlight-next-line
loginConfig: loginConfig
));
Expand Down Expand Up @@ -234,7 +243,16 @@ Future<void> initPlatformState() async {
network: Network.testnet,
redirectUrl: redirectUrl,
whiteLabel: WhiteLabelData(
dark: true, name: "Web3Auth Flutter App", theme: themeMap),
appName: "Web3Auth Flutter App",
logoLight:
"https://www.vectorlogo.zone/logos/flutterio/flutterio-icon.svg",
logoDark:
"https://cdn.icon-icons.com/icons2/2389/PNG/512/flutter_logo_icon_145273.png",
defaultLanguage: Language.en,
mode: ThemeModes.auto,
appUrl: "https://web3auth.io",
useLogoLoader: true,
theme: themeMap),
// highlight-next-line
loginConfig: loginConfig
));
Expand Down Expand Up @@ -281,7 +299,16 @@ Future<void> initPlatformState() async {
network: Network.testnet,
redirectUrl: redirectUrl,
whiteLabel: WhiteLabelData(
dark: true, name: "Web3Auth Flutter App", theme: themeMap),
appName: "Web3Auth Flutter App",
logoLight:
"https://www.vectorlogo.zone/logos/flutterio/flutterio-icon.svg",
logoDark:
"https://cdn.icon-icons.com/icons2/2389/PNG/512/flutter_logo_icon_145273.png",
defaultLanguage: Language.en,
mode: ThemeModes.auto,
appUrl: "https://web3auth.io",
useLogoLoader: true,
theme: themeMap),
// highlight-next-line
loginConfig: loginConfig
));
Expand All @@ -293,7 +320,7 @@ final Web3AuthResponse response = await Web3AuthFlutter.login(
// highlight-start
loginProvider: Provider.jwt,
extraLoginOptions: ExtraLoginOptions(
id_token: "{YOUR_JWT_TOKEN}"
id_token: "YOUR_JWT_TOKEN"
)
// highlight-end
)
Expand Down Expand Up @@ -444,7 +471,16 @@ Future<void> initPlatformState() async {
network: Network.testnet,
redirectUrl: redirectUrl,
whiteLabel: WhiteLabelData(
dark: true, name: "Web3Auth Flutter App", theme: themeMap),
appName: "Web3Auth Flutter App",
logoLight:
"https://www.vectorlogo.zone/logos/flutterio/flutterio-icon.svg",
logoDark:
"https://cdn.icon-icons.com/icons2/2389/PNG/512/flutter_logo_icon_145273.png",
defaultLanguage: Language.en,
mode: ThemeModes.auto,
appUrl: "https://web3auth.io",
useLogoLoader: true,
theme: themeMap),
// highlight-next-line
loginConfig: loginConfig
));
Expand All @@ -456,7 +492,7 @@ final Web3AuthResponse response = await Web3AuthFlutter.login(
// highlight-start
loginProvider: Provider.jwt,
extraLoginOptions: ExtraLoginOptions(
domain: "https://username.us.auth0.com", // domain of your auth0 app
domain: "https://tenant-name.us.auth0.com", // domain of your auth0 app
verifierIdField: "sub", // The field in jwt token which maps to verifier id.
)
// highlight-end
Expand Down Expand Up @@ -498,7 +534,16 @@ Future<void> initPlatformState() async {
network: Network.testnet,
redirectUrl: redirectUrl,
whiteLabel: WhiteLabelData(
dark: true, name: "Web3Auth Flutter App", theme: themeMap),
appName: "Web3Auth Flutter App",
logoLight:
"https://www.vectorlogo.zone/logos/flutterio/flutterio-icon.svg",
logoDark:
"https://cdn.icon-icons.com/icons2/2389/PNG/512/flutter_logo_icon_145273.png",
defaultLanguage: Language.en,
mode: ThemeModes.auto,
appUrl: "https://web3auth.io",
useLogoLoader: true,
theme: themeMap),
// highlight-next-line
loginConfig: loginConfig
));
Expand All @@ -519,13 +564,17 @@ final Web3AuthResponse response = await Web3AuthFlutter.login(

### Email Passwordless

To use the `EMAIL_PASSWORDLESS` login, you need to put the email into the `login_hint` field of the `extraLoginOptions`.
To use the `EMAIL_PASSWORDLESS` login, you need to put the email into the `login_hint` field of the `extraLoginOptions`. By default, the login flow
will be `code` flow, if you want to use the `link` flow, you need to put `flow_type` into the `additionalParams` field of the `extraLoginOptions`.

```kotlin
Future<void> initPlatformState() async {
final themeMap = HashMap<String, String>();
themeMap['primary'] = "#229954";

final additionalParams = HashMap<String, String>();
additionalParams['flow_type'] = "link"; // default is 'code'

Uri redirectUrl;
if (Platform.isAndroid) {
redirectUrl = Uri.parse('{SCHEME}://{HOST}/auth');
Expand All @@ -542,13 +591,22 @@ Future<void> initPlatformState() async {
network: Network.testnet,
redirectUrl: redirectUrl,
whiteLabel: WhiteLabelData(
dark: true, name: "Web3Auth Flutter App", theme: themeMap),
appName: "Web3Auth Flutter App",
logoLight:
"https://www.vectorlogo.zone/logos/flutterio/flutterio-icon.svg",
logoDark:
"https://cdn.icon-icons.com/icons2/2389/PNG/512/flutter_logo_icon_145273.png",
defaultLanguage: Language.en,
mode: ThemeModes.auto,
appUrl: "https://web3auth.io",
useLogoLoader: true,
theme: themeMap),
));
}

// Login
final Web3AuthResponse response = await Web3AuthFlutter.login(
LoginParams(loginProvider: Provider.email_passwordless,
// highlight-next-line
extraLoginOptions: ExtraLoginOptions(login_hint: "[email protected]")));
extraLoginOptions: ExtraLoginOptions(login_hint: "[email protected]", additionalParams: additionalParams)));
```
Loading

0 comments on commit 97be832

Please sign in to comment.