Skip to content

Commit fec8e3d

Browse files
Merge pull request #99 from Web3Auth/update-readme
Update README
2 parents 6cbcb73 + 853a3ea commit fec8e3d

File tree

1 file changed

+22
-77
lines changed

1 file changed

+22
-77
lines changed

README.md

Lines changed: 22 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Web3Auth Android SDK
22

3-
[![](https://jitpack.io/v/org.torusresearch/web3auth-android-sdk.svg)](https://jitpack.io/#org.torusresearch/web3auth-android-sdk)
3+
![SDK Version](https://jitpack.io/v/org.torusresearch/web3auth-android-sdk.svg)
44

55
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.
66

@@ -23,11 +23,10 @@ Checkout the official [Web3Auth Documentation](https://web3auth.io/docs) and [SD
2323
## ⏪ Requirements
2424

2525
- Android API version 24 or newer is required.
26+
- `compileSdkVersion` needs to be 34
2627

2728
## ⚡ Installation
2829

29-
### Add Web3Auth to Gradle
30-
3130
In your project-level `settings.gradle` file, add JitPack repository:
3231

3332
```groovy
@@ -46,62 +45,19 @@ Then, in your app-level `build.gradle` dependencies section, add the following:
4645
```groovy
4746
dependencies {
4847
// ...
49-
implementation 'org.torusresearch:web3auth-android-sdk:-SNAPSHOT'
48+
implementation 'com.github.web3auth:web3auth-android-sdk:8.0.3'
5049
}
5150
```
5251

53-
### Permissions
54-
55-
Open your app's `AndroidManifest.xml` file and add the following permission:
56-
57-
```xml
58-
<uses-permission android:name="android.permission.INTERNET" />
59-
```
6052
## 🌟 Configuration
53+
Checkout [SDK Reference](https://web3auth.io/docs/sdk/pnp/android/install#update-permissions) to configure for Android.
6154

62-
### Configure your Web3Auth project
63-
64-
Hop on to the [Web3Auth Dashboard](https://dashboard.web3auth.io/) and create a new project. Use the
65-
Client ID of the project to start your integration.
66-
67-
![Web3Auth Dashboard](https://github-production-user-asset-6210df.s3.amazonaws.com/6962565/272779464-043f6383-e671-4aa5-80fb-ec87c569e5ab.png)
68-
69-
- Add `{YOUR_APP_PACKAGE_NAME}://auth` to **Whitelist URLs**.
70-
71-
- Copy the Project ID for usage later.
72-
73-
### Configure Deep Link
74-
75-
Open your app's `AndroidManifest.xml` file and add the following deep link intent filter to your sign-in activity:
76-
77-
```xml
78-
<intent-filter>
79-
<action android:name="android.intent.action.VIEW" />
80-
81-
<category android:name="android.intent.category.DEFAULT" />
82-
<category android:name="android.intent.category.BROWSABLE" />
83-
84-
<!-- Accept URIs: {YOUR_APP_PACKAGE_NAME}://* -->
85-
<data android:scheme="{YOUR_APP_PACKAGE_NAME}" />
86-
</intent-filter>
87-
```
88-
89-
Make sure your sign-in activity launchMode is set to **singleTop** in your `AndroidManifest.xml`
90-
91-
```xml
92-
<activity
93-
android:launchMode="singleTop"
94-
android:name=".YourActivity">
95-
// ...
96-
</activity>
97-
```
98-
99-
## 💥 Initialization & Usage
100-
101-
In your sign-in activity', create an `Web3Auth` instance with your Web3Auth project's configurations and
102-
configure it like this:
55+
## 💥 Getting Started
10356

10457
```kotlin
58+
import com.web3auth.core.Web3Auth
59+
import com.web3auth.core.types.Web3AuthOptions
60+
10561
class MainActivity : AppCompatActivity() {
10662
// ...
10763
private lateinit var web3Auth: Web3Auth
@@ -111,35 +67,25 @@ class MainActivity : AppCompatActivity() {
11167
setContentView(R.layout.activity_main)
11268

11369
web3Auth = Web3Auth(
114-
Web3AuthOptions(context = this,
115-
clientId = getString(R.string.web3auth_project_id),
116-
network = Web3Auth.Network.MAINNET,
70+
Web3AuthOptions(
71+
context = this,
72+
clientId = "YOUR_WEB3AUTH_CLIENT_ID", // Pass over your Web3Auth Client ID from Developer Dashboard
73+
network = Network.MAINNET,
11774
redirectUrl = Uri.parse("{YOUR_APP_PACKAGE_NAME}://auth"),
118-
whiteLabel = WhiteLabelData( // Optional param
119-
"Web3Auth Sample App", null, null, "en", true,
120-
hashMapOf(
121-
"primary" to "#123456"
122-
)
123-
)
12475
)
12576
)
12677

12778
// Handle user signing in when app is not alive
12879
web3Auth.setResultUrl(intent?.data)
80+
}
12981

130-
// Call initialize function to get private key and user information value without relogging in user if a user has an active session
131-
val sessionResponse: CompletableFuture<Void> = web3Auth.initialize()
132-
sessionResponse.whenComplete { _, error ->
133-
if (error == null) {
134-
println("PrivKey: " + web3Auth.getPrivkey())
135-
println("ed25519PrivKey: " + web3Auth.getEd25519PrivKey())
136-
println("Web3Auth UserInfo" + web3Auth.getUserInfo())
137-
} else {
138-
// render error UI
139-
}
82+
override fun onResume() {
83+
super.onResume()
84+
if (Web3Auth.getCustomTabsClosed()) {
85+
Toast.makeText(this, "User closed the browser.", Toast.LENGTH_SHORT).show()
86+
web3Auth.setResultUrl(null)
87+
Web3Auth.setCustomTabsClosed(false)
14088
}
141-
142-
// ...
14389
}
14490

14591
override fun onNewIntent(intent: Intent?) {
@@ -158,9 +104,6 @@ class MainActivity : AppCompatActivity() {
158104
loginCompletableFuture.whenComplete { _, error ->
159105
if (error == null) {
160106
// render logged in UI
161-
println("PrivKey: " + web3Auth.getPrivkey())
162-
println("ed25519PrivKey: " + web3Auth.getEd25519PrivKey())
163-
println("Web3Auth UserInfo" + web3Auth.getUserInfo())
164107
} else {
165108
// render login error UI
166109
}
@@ -174,12 +117,14 @@ class MainActivity : AppCompatActivity() {
174117

175118
## 🩹 Examples
176119

177-
Checkout the examples for your preferred blockchain and platform in our [examples](https://web3auth.io/docs/examples)
120+
Checkout the examples for your preferred blockchain and platform in our [examples](https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/android)
178121

179122
## 🌐 Demo
180123

181124
Checkout the [Web3Auth Demo](https://demo-app.web3auth.io/) to see how Web3Auth can be used in an application.
182125

126+
Have a look at our [Web3Auth PnP Android Quick Start](https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/android/android-quick-start) to help you quickly integrate a basic instance of Web3Auth Plug and Play in your Android app.
127+
183128
Further checkout the [app folder](https://https://github.com/Web3Auth/web3auth-android-sdk/tree/master/app) within this repository, which contains a sample app.
184129

185130
## 💬 Troubleshooting and Support

0 commit comments

Comments
 (0)