Skip to content

Commit 03ada7b

Browse files
committed
Updates
1 parent 10f3bc4 commit 03ada7b

13 files changed

Lines changed: 374 additions & 533 deletions

File tree

embedded-wallets/authentication/custom-connections/auth0.mdx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,20 @@ In your activity, create a `Web3Auth` instance with your Web3Auth project's conf
123123
```kotlin
124124
web3Auth = Web3Auth(
125125
Web3AuthOptions(
126-
context = this,
127126
clientId = getString(R.string.web3auth_project_id), // pass over your Web3Auth Client ID from Embedded Wallets dashboard
128-
network = Network.SAPPHIRE_MAINNET
129-
redirectUrl = Uri.parse("{YOUR_APP_PACKAGE_NAME}://auth"), // your app's redirect URL
127+
web3AuthNetwork = Web3AuthNetwork.SAPPHIRE_MAINNET,
128+
redirectUrl = "{YOUR_APP_PACKAGE_NAME}://auth", // your app's redirect URL
130129
// focus-start
131-
loginConfig = hashMapOf("jwt" to LoginConfigItem(
132-
verifier = "web3auth-auth0-demo",
133-
typeOfLogin = TypeOfLogin.JWT,
134-
name = "Auth0 Login",
130+
authConnectionConfig = listOf(
131+
AuthConnectionConfig(
132+
authConnection = AuthConnection.CUSTOM,
133+
authConnectionId = "web3auth-auth0-demo",
135134
clientId = getString(R.string.web3auth_auth0_client_id)
136-
)
135+
)
137136
)
138137
// focus-end
139-
)
138+
),
139+
this
140140
)
141141

142142
// Handle user signing in when app is not alive
@@ -145,18 +145,17 @@ web3Auth.setResultUrl(intent?.data)
145145

146146
##### Logging in
147147

148-
Once initialized, you can use the `web3Auth.connectTo(LoginParams("{selectedLoginProvider}"))` function to authenticate the user when they click the login button.
148+
Once initialized, you can use the `web3Auth.connectTo(LoginParams(...))` function to authenticate the user when they click the login button.
149149

150150
```kotlin
151151
private fun signIn() {
152-
val selectedLoginProvider = Provider.JWT // For Auth0, we use JWT
153152
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.connectTo(
154153
// focus-start
155154
LoginParams(
156-
selectedLoginProvider,
155+
authConnection = AuthConnection.CUSTOM,
156+
authConnectionId = "web3auth-auth0-demo",
157157
extraLoginOptions = ExtraLoginOptions(
158-
domain = "https://YOUR_AUTH0_DOMAIN",
159-
verifierIdField = "sub"
158+
domain = "https://YOUR_AUTH0_DOMAIN"
160159
)
161160
)
162161
// focus-end

embedded-wallets/authentication/custom-connections/firebase.mdx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,20 @@ In your activity, create a `Web3Auth` instance with your Web3Auth project's conf
116116
```kotlin
117117
web3Auth = Web3Auth(
118118
Web3AuthOptions(
119-
context = this,
120119
clientId = getString(R.string.web3auth_project_id), // pass over your Web3Auth Client ID from Embedded Wallets dashboard
121-
network = Network.SAPPHIRE_MAINNET
122-
redirectUrl = Uri.parse("{YOUR_APP_PACKAGE_NAME}://auth"), // your app's redirect URL
120+
web3AuthNetwork = Web3AuthNetwork.SAPPHIRE_MAINNET,
121+
redirectUrl = "{YOUR_APP_PACKAGE_NAME}://auth", // your app's redirect URL
123122
// focus-start
124-
loginConfig = hashMapOf("jwt" to LoginConfigItem(
125-
verifier = "web3auth-firebase-examples",
126-
typeOfLogin = TypeOfLogin.JWT,
127-
name = "Firebase Login",
123+
authConnectionConfig = listOf(
124+
AuthConnectionConfig(
125+
authConnection = AuthConnection.CUSTOM,
126+
authConnectionId = "web3auth-firebase-examples",
128127
clientId = getString(R.string.web3auth_project_id)
129-
)
128+
)
130129
)
131130
// focus-end
132-
)
131+
),
132+
this
133133
)
134134

135135
// Handle user signing in when app is not alive
@@ -138,7 +138,7 @@ web3Auth.setResultUrl(intent?.data)
138138

139139
##### Logging in
140140

141-
Once initialized, you can use the `web3Auth.connectTo(LoginParams("{selectedLoginProvider}"))` function to authenticate the user when they click the login button.
141+
Once initialized, you can use the `web3Auth.connectTo(LoginParams(...))` function to authenticate the user when they click the login button.
142142

143143
```kotlin
144144
private fun signIn() {
@@ -155,17 +155,15 @@ private fun signIn() {
155155
val idToken = result.token
156156

157157
Log.d(TAG, "GetTokenResult result = $idToken")
158-
val selectedLoginProvider = Provider.JWT
159158
// focus-start
160159
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.connectTo(
161160
LoginParams(
162-
selectedLoginProvider,
163-
extraLoginOptions = ExtraLoginOptions(
164-
domain = "firebase", id_token = idToken
165-
)
166-
)
161+
authConnection = AuthConnection.CUSTOM,
162+
authConnectionId = "web3auth-firebase-examples",
163+
idToken = idToken
167164
)
168-
// focus-end
165+
)
166+
// focus-end
169167

170168
loginCompletableFuture.whenComplete { loginResponse, error ->
171169
if (error == null) {

embedded-wallets/connect-blockchain/_android-connect-blockchain/_evm-get-account.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Once user has successfully logged in, you can retrieve the user's private key using the `getPrivKey` method from the Embedded Wallets Android SDK. We'll use this private key to generate the Credentials for the user.
1+
Once user has successfully logged in, you can retrieve the user's private key using the `getPrivateKey` method from the Embedded Wallets Android SDK. We'll use this private key to generate the Credentials for the user.
22

33
This Credentials object has the user's keypair of private key and public key, and can be used to sign the transactions. Please note, that this assumes that the user has already logged in and the private key is available.
44

55
```kotlin
66
import org.web3j.crypto.Credentials
77

88
// Use your Embedded Wallets SDK instance to get the private key
9-
val privateKey = web3Auth.getPrivKey()
9+
val privateKey = web3Auth.getPrivateKey()
1010

1111
// Generate the Credentials
1212
val credentials = Credentials.create(privateKey)

embedded-wallets/connect-blockchain/solana/android.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,33 +131,33 @@ The session can be persisted for up to 30 days max.
131131

132132
```kotlin
133133
import com.web3auth.core.Web3Auth
134-
import com.web3auth.core.types.Network
135134
import com.web3auth.core.types.Web3AuthOptions
135+
import org.torusresearch.fetchnodedetails.types.Web3AuthNetwork
136136

137137
// Initialize Web3Auth SDK
138138
// focus-start
139139
val web3Auth: Web3Auth = Web3Auth(
140140
Web3AuthOptions(
141141
clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
142-
context = context,
143-
network = Network.SAPPHIRE_MAINNET,
144-
redirectUrl = Uri.parse( "com.example.androidsolanaexample://auth")
145-
)
142+
web3AuthNetwork = Web3AuthNetwork.SAPPHIRE_MAINNET,
143+
redirectUrl = "com.example.androidsolanaexample://auth"
144+
),
145+
context
146146
)
147147
// focus-end
148148

149149
// Check whether private key is empty or not for user authentication status.
150-
val isUserAuthenticated = web3Auth.getPrivkey().isNotEmpty()
150+
val isUserAuthenticated = web3Auth.getEd25519PrivateKey().isNotEmpty()
151151

152152
// Customize your logic to perform operations or navigation
153153
```
154154

155155
## Get account
156156

157-
We can use `getEd25519PrivKey` method in Web3Auth to retrieve the private key for the Solana ecosystem. In the following code block, we'll use the Ed25519 private key to retrieve user's public address by creating `Keypair`. The `Keypair` instance from `sol4k` SDK once created can be used to sign the Solana transactions.
157+
We can use `getEd25519PrivateKey` method in Web3Auth to retrieve the private key for the Solana ecosystem. In the following code block, we'll use the Ed25519 private key to retrieve user's public address by creating `Keypair`. The `Keypair` instance from `sol4k` SDK once created can be used to sign the Solana transactions.
158158

159159
```kotlin
160-
val ed25519PrivateKey = web3Auth.getEd25519PrivKey()
160+
val ed25519PrivateKey = web3Auth.getEd25519PrivateKey()
161161
val solanaKeyPair = Keypair.fromSecretKey(ed25519PrivateKey.hexToByteArray())
162162

163163
// focus-next-line

embedded-wallets/migration-guides/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ current SDK in one pass.
3030
| Platform | Upgrade to | Covers upgrades from |
3131
| ---------------------------------------------------------------------- | ---------- | -------------------- |
3232
| [Web (JavaScript, React, Vue)](/embedded-wallets/migration-guides/web) | v11 | v9 through v10 |
33-
| [Android](/embedded-wallets/migration-guides/android) | v9 | v4 through v8 |
33+
| [Android](/embedded-wallets/migration-guides/android) | v10 | v4 through v9 |
3434
| [iOS](/embedded-wallets/migration-guides/ios) | v10 | v6 through v9 |
3535
| [React Native](/embedded-wallets/migration-guides/react-native) | v9 | v3 through v8 |
3636
| [Flutter](/embedded-wallets/migration-guides/flutter) | v6 | v3 through v5 |

0 commit comments

Comments
 (0)