diff --git a/README.md b/README.md index a1da595..71d505c 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,33 @@ -# web3auth-unity-sdk +# Web3Auth Unity SDK [![](https://jitpack.io/v/org.torusresearch/web3auth-unity-sdk.svg)](https://jitpack.io/#org.torusresearch/web3auth-unity-sdk) -Web3Auth SDK for Unity3D game engine which supports Android, iOS, and Windows. `web3auth-unity-sdk` is a client-side library which allows you to authenticate users using -[Web3Auth](https://web3auth.io/) on Unity3D game engine. +Web3Auth is where passwordless auth meets non-custodial key infrastructure for Web3 apps and wallets. By aggregating OAuth (Google, Twitter, Discord) logins, different wallets and innovative Multi Party Computation (MPC) - Web3Auth provides a seamless login experience to every user on your application. -## Requirements +## 📖 Documentation + +Checkout the official [Web3Auth Documentation](https://web3auth.io/docs) and [SDK Reference](https://web3auth.io/docs/sdk/unity/) to get started! + +## 💡 Features +- Plug and Play, OAuth based Web3 Authentication Service +- Fully decentralized, non-custodial key infrastructure +- End to end Whitelabelable solution +- Threshold Cryptography based Key Reconstruction +- Multi Factor Authentication Setup & Recovery (Includes password, backup phrase, device factor editing/deletion etc) +- Support for WebAuthn & Passwordless Login +- Support for connecting to multiple wallets +- DApp Active Session Management + +...and a lot more + +## ⏪ Requirements - Unity Editor 2019.4.9f1 or greater - .Net Framework 4.x -## Installation +## ⚡ Installation -Download [.unitypackage](https://github.com/Web3Auth/web3auth-unity-sdk/releases/tag/Web3Auth-Unity-SDK) and import the package file into your existing Unity3D project. +Download [.unitypackage](https://github.com/Web3Auth/web3auth-unity-sdk/releases/latest) and import the package file into your existing Unity3D project. > You may encounter errors when importing this package into your existing project. > `The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)` @@ -24,7 +39,7 @@ Download [.unitypackage](https://github.com/Web3Auth/web3auth-unity-sdk/releases ![Json Dot Net Error](./Images/JsonDotNet%20Error.png) -## Building in Unity and Get Started +## 🌟 Configuration To get started, open a sample scene `Web3AuthSample` inside `Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.scene` @@ -35,8 +50,6 @@ Before building the application for Android/IOS you need to register the redirec - Enter the redirect_url _(i-e torusapp://com.torus.Web3AuthUnity/auth)_ and click generate. > To use your own client_id , register your app on [https://web3auth.io/](https://web3auth.io/) and replace the client_id inside `Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs` script. -## Integration - ### Configure an Web3Auth project Go to [Developer Dashboard](https://dashboard.web3auth.io/), create or select an Web3Auth project: @@ -45,7 +58,7 @@ Go to [Developer Dashboard](https://dashboard.web3auth.io/), create or select an _i-e torusapp://com.torus.Web3AuthUnity/auth_ - Copy the Project ID for later usage as client_id -## Intialize Web3Auth +## 💥 Initialization & Usage In your sign-in script', create an Web3Auth instance with your Web3Auth project's configurations and configure it like this: @@ -84,31 +97,19 @@ Web3Auth Unity SDK provides a tool to simulate the redirect callback. To open go ![Deep Link Debug](./Images/Deep%20Link%20Debug.png) -## API Reference -```csharp -class Web3Auth { - Web3Auth(Web3AuthOptions web3AuthOptions) {} - // Trigger login flow that shows a modal for user to select one of supported - // providers to login, e.g. Google, Facebook, Twitter, Passwordless, etc - void login() {} - // Trigger login flow using login params. Specific Login Provider can be set - // through Login Params - void login(LoginParams loginParams) {} -} -class Web3AuthOptions { - string clientId; // Your Web3Auth project ID - public Web3Auth.Network network; // Network to run Web3Auth, either MAINNET or TESTNET - public Uri redirectUrl; // URL that Web3Auth will redirect API responses - public WhiteLabelData whiteLabel; // Optional param to configure look - public Dictionary loginConfig; // Optional -} -public class LoginParams { - public Provider loginProvider; - public string dappShare; - public ExtraLoginOptions; - public Uri redirectUrl; - public string appState; - public MFALevel mfaLevel; -} -``` +## 🩹 Examples + +Checkout the examples for your preferred blockchain and platform in our [examples repository](https://github.com/Web3Auth/examples/) + +## 🌐 Demo + +Checkout the [Web3Auth Demo](https://demo-app.web3auth.io/) to see how Web3Auth can be used in an application. + +Further checkout the [samples folder in the Web3Auth SDK](https://github.com/Web3Auth/web3auth-unity-sdk/tree/master/Assets/Plugins/Web3AuthSDK/Samples) within this repository, which contains a sample app. + +## 💬 Troubleshooting and Discussions + +- Have a look at our [GitHub Discussions](https://github.com/Web3Auth/Web3Auth/discussions?discussions_q=sort%3Atop) to see if anyone has any questions or issues you might be having. +- Checkout our [Troubleshooting Documentation Page](https://web3auth.io/docs/troubleshooting) to know the common issues and solutions +- Join our [Discord](https://discord.gg/web3auth) to join our community and get private integration support or help with your integration. diff --git a/Using Auth0 with Web3Auth.md b/Using Auth0 with Web3Auth.md deleted file mode 100644 index edfa1df..0000000 --- a/Using Auth0 with Web3Auth.md +++ /dev/null @@ -1,99 +0,0 @@ -# Using Web3Auth Unity SDK -This guide will cover the basics of how to set up your Web3Auth SDK and Auth0 account for the integration and provide you with the links on how to develop a basic web application on the blockchain of your choice. Before starting, you can try the integration in our example here. - -## Supported Platforms -- Windows -- IOS -- Android - -## Prerequisites -- A basic knowledge of C# and Unity Editor -- Create a Web3Auth account on the Web3Auth Dashboard -- UnityEditor 2019.x or higher With Android/iOS build support. - -## Setup -### Setup your Web3Auth Dashboard -- Create a Project from the Plug and Play Section of the Web3Auth Developer Dashboard -![](https://web3auth.io/docs/assets/images/auth0-w3adashboard-01-74f7f10e5179f77ea0de5c1629c8ee2c.png) -- Enter your desired Project name -- Select the blockchain(s) you'll be building this project on. For interoperability with Torus Wallet, you've an option of allowing the user's private key to be used in other applications using Torus Wallet. We currently have this option across EVM and Solana and Casper blockchains. -- Finally, once you create the project, you've the option to whitelist your URLs for the project. Please whitelist the domains where your project will be hosted. -![](https://web3auth.io/docs/assets/images/auth0-w3adashboard-02-3050b7bbbfacabba44908b32f4ce7fd7.png) -- You will require clientId of the Plug and Play Project. - -### Using the Web3Auth SDK -To use the Web3Auth SDK, you need to add the dependency of the respective platform SDK of Web3Auth to your project. To know more about the available SDKs, please have a look at this [documentation page](https://web3auth.io/docs/developing-with-web3auth/understand-sdk). - -For this guide here, we will be focused on the Web3Auth Unity SDK and using the OpenLogin Provider alongside it. - -#### Installation -Install SDK by downloading the latest .unitypackage file and import into your existing Unity3D project. - -> If you are using Unity Editor version 2019 or less you may encounter an error regarding `The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?`. To resolve this issue, edit manifest.json file located inside /Packages/ and add a dependency `"com.unity.nuget.newtonsoft-json": "2.0.0"` in dependencies object. - -#### Initialization -Once installed, your Web3Auth application needs to be initialized. Initialisation is a multi step process where we add all the config details for Web3Auth and OpenloginAdapter. Please make sure all of this is happening in `Start()` function. This makes sure that Web3Auth is initialised when your application is loaded. - -#### Configure settings for Android - -#### Setting up the Web3Auth SDK -Attach `Web3Auth.cs` script to your object where you are planning to write your web3auth logic, And reference that Web3Auth in your script by following method. -> After attaching `Web3Auth.cs` script make sure you configure it by entering client_id, redirect_url and network. -![](https://i.imgur.com/SYUEiZ8.png) - -```csharp -Web3Auth web3Auth = GetComponent(); -web3Auth.setOptions(new Web3AuthOptions() { - whiteLabel = new WhiteLabelData() { - name = "Web3Auth Sample App", - defaultLanguage = "en" - } -}); -``` - -You can set different options to customize web3auth options using `Web3AuthOptions`; - -#### Configure project for Android/iOS - -Unity SDK works on unity deep linking features to redirect the callback from web3auth. You have to enable/configure your custom redirect url by a tool provided with in SDK. Go to `Menu > Window > Web3Auth > Deep Link Generator`, and enter your redirect url which you have registered in Web3Auth dashboard. - -![](https://i.imgur.com/mRfqh9y.png) - -#### Authentication -##### Logging in -Add add event into Web3Auth object to catch login details. Make sure you add this event before calling login function. -``` -web3auth.onLogin += onLogin; -``` -provide a callback function for login event. `Web3AuthResponse` contains all the information of user profile who successfully logged in. -``` -void onLogin(Web3AuthResponse response) { - // your logic after successfull login -} -``` -Once initialized, you can use the `login()` function to authenticate the user when they click the login button. -``` -web3auth.login() -``` - -##### Logout -Add add logout event into Web3Auth object. Make sure you add this event before calling logout function. -``` -web3auth.onLogout += onLogout; -``` -provide a callback function for login event. `Web3AuthResponse` contains all the information of user profile who successfully logged in. -``` -void onLogout() { - // your logic after logout -} -``` -Once initialized, you can use the `login()` function to authenticate the user when they click the login button. -``` -web3auth.logout() -``` - -## Try Sample scene and Example Code -To quickly explore features and working of SDK open sample scene from /Assets/Plugins/Web3AuthSDK/Sample , You can try different verifier (e.g google, facebook, github etc) for testing purpose. - -![](https://i.imgur.com/bQKglt4.png) -