You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
web3AuthNetwork =Web3AuthNetwork.SAPPHIRE_MAINNET, // or Web3AuthNetwork.SAPPHIRE_DEVNET
159
+
redirectUrl ="{YOUR_APP_PACKAGE_NAME}://auth",
159
160
)
160
161
)
161
162
// focus-end
@@ -181,7 +182,7 @@ override fun onNewIntent(intent: Intent?) {
181
182
182
183
After instantiating Web3Auth, the next step is to initialize it using the `initialize` method. This method is essential for setting up the SDK, checking for any active sessions, and fetching the whitelabel configuration from your dashboard.
183
184
184
-
Once the `initialize` method executes successfully, you can use the `getPrivKey` or `getEd25519PrivKey` methods to verify if an active session exists. If there is no active session, these methods will return an empty string; otherwise, they will return the respective private key.
185
+
Once the `initialize` method executes successfully, you can use the `getPrivateKey` or `getEd25519PrivateKey` methods to verify if an active session exists. If there is no active session, these methods will return an empty string; otherwise, they will return the respective private key.
185
186
186
187
:::note
187
188
@@ -194,7 +195,7 @@ val initializeCF: CompletableFuture<Void> = web3Auth.initialize()
194
195
initializeCF.whenComplete { _, error ->
195
196
if (error ==null) {
196
197
// Check for the active session
197
-
if(web3Auth.getPrivKey()isNotEmpty()) {
198
+
if(web3Auth.getPrivateKey().isNotEmpty()) {
198
199
// Active session found
199
200
}
200
201
// No active session is not present
@@ -235,7 +236,7 @@ val web3Auth = Web3Auth(
235
236
Web3AuthOptions(
236
237
context =this,
237
238
clientId ="YOUR_CLIENT_ID",
238
-
network=Network.SAPPHIRE_MAINNET, // or Network.SAPPHIRE_DEVNET
239
+
web3AuthNetwork=Web3AuthNetwork.SAPPHIRE_MAINNET, // or Web3AuthNetwork.SAPPHIRE_DEVNET
239
240
redirectUrl ="YOUR_APP_SCHEME://auth"
240
241
)
241
242
)
@@ -250,11 +251,11 @@ val web3Auth = Web3Auth(
250
251
Web3AuthOptions(
251
252
context =this,
252
253
clientId ="YOUR_CLIENT_ID",
253
-
network=Network.SAPPHIRE_MAINNET, // or Network.SAPPHIRE_DEVNET
254
+
web3AuthNetwork=Web3AuthNetwork.SAPPHIRE_MAINNET, // or Web3AuthNetwork.SAPPHIRE_DEVNET
254
255
redirectUrl ="YOUR_APP_SCHEME://auth"
255
-
loginConfig=hashMapOf("google" to LoginConfigItem(
256
-
verifier="verifier-name", // Get it from Web3Auth dashboard
257
-
typeOfLogin=TypeOfLogin.GOOGLE,
256
+
authConnectionConfig=listOf(AuthConnectionConfig(
257
+
authConnectionId="auth-connection-id", // Get it from Web3Auth dashboard
258
+
authConnection=AuthConnection.GOOGLE,
258
259
clientId = getString(R.string.google_client_id) // Google's client id
259
260
)),
260
261
mfaSettings =MfaSettings(
@@ -273,13 +274,30 @@ val web3Auth = Web3Auth(
273
274
274
275
</Tabs>
275
276
277
+
## Single Factor Auth (SFA) Support
278
+
279
+
Web3Auth Android SDK includes built-in support for Single Factor Auth (SFA), allowing for seamless authentication when you already have a JWT token from your authentication system. When MFA is disabled, users won't even notice Web3Auth's presence - they'll be automatically authenticated using just your JWT token, making the login experience completely frictionless.
280
+
281
+
```kotlin
282
+
// SFA login with custom JWT
283
+
val loginCompletableFuture = web3Auth.connectTo(
284
+
LoginParams(
285
+
AuthConnection.CUSTOM,
286
+
authConnectionId ="your_verifier_id",
287
+
idToken ="your_jwt_token"
288
+
)
289
+
)
290
+
```
291
+
292
+
SFA mode is automatically activated when you provide an `idToken` parameter. This enables direct authentication without additional social login steps, perfect for applications that already have their own authentication system.
293
+
276
294
## Blockchain Integration
277
295
278
296
Web3Auth is blockchain agnostic, enabling integration with any blockchain network. Out of the box, Web3Auth offers robust support for both **Solana** and **Ethereum**.
279
297
280
298
### Ethereum Integration
281
299
282
-
For Ethereum integration, you can get the private key using the `getPrivKey` method and use it with web3j or other Ethereum libraries:
300
+
For Ethereum integration, you can get the private key using the `getPrivateKey` method and use it with web3j or other Ethereum libraries:
// Use your Web3Auth instance to get the private key
291
-
val privateKey = web3Auth.getPrivKey()
309
+
val privateKey = web3Auth.getPrivateKey()
292
310
293
311
// Generate the Credentials
294
312
val credentials =Credentials.create(privateKey)
@@ -308,7 +326,7 @@ val ethBalance = BigDecimal.valueOf(balanceResponse.balance.toDouble()).divide(B
308
326
309
327
### Solana Integration
310
328
311
-
For Solana integration, you can get the Ed25519 private key using the `getEd25519PrivKey` method and use it with sol4k or any other Solana libraries:
329
+
For Solana integration, you can get the Ed25519 private key using the `getEd25519PrivateKey` method and use it with sol4k or any other Solana libraries:
312
330
313
331
```kotlin
314
332
importorg.sol4k.Connection
@@ -317,7 +335,7 @@ import org.sol4k.Keypair
317
335
val connection =Connection(RpcUrl.DEVNET)
318
336
319
337
// Use your Web3Auth instance to get the private key
320
-
val ed25519PrivateKey = web3Auth.getEd25519PrivKey()
338
+
val ed25519PrivateKey = web3Auth.getEd25519PrivateKey()
321
339
322
340
// Generate the Solana KeyPair
323
341
val solanaKeyPair =Keypair.fromSecretKey(ed25519PrivateKey.hexToByteArray())
|`context`| Android context to launch Web-based authentication, usually is the current activity. It's a mandatory field, and accepts `android.content.Context` as a value. |
52
53
|`clientId`| Your Web3Auth Client ID. You can get it from Web3Auth [Dashboard](https://dashboard.web3auth.io/) under project details. It's a mandatory field of type `String`|
53
-
|`network`| Defines the Web3Auth Network. It's a mandatory field of type Network. |
54
-
|`redirectUrl`| URL that Web3Auth will redirect API responses upon successful authentication from browser. It's a mandatory field of type `Uri`. |
54
+
|`web3AuthNetwork`| Defines the Web3Auth Network. It's a mandatory field of type `Web3AuthNetwork`.|
55
+
|`redirectUrl`| URL that Web3Auth will redirect API responses upon successful authentication from browser. It's a mandatory field of type `String`.|
55
56
|`sessionTime?`| It allows developers to configure the session management time. Session Time is in seconds, default is 86400 seconds which is 1 day. `sessionTime` can be max 30 days |
56
-
|`useCoreKitKey?`| Use CoreKit (or SFA) Key to get core kit key given by SFA SDKs. It's an optional field with default value as `false`. Useful for Wallet Pregeneration.|
57
-
|`chainNamespace?`| Chain Namespace [`EIP155` and `SOLANA`]. It takes `ChainNamespace` as a value.|
57
+
|`useSFAKey?`| Use SFA Key to get single factor auth key. It's an optional field with default value as `false`. Useful for Wallet Pregeneration and SFA mode. |
58
+
|`chains?`| Custom chain configuration for blockchain networks. It takes `Chains` as a value. |
|`whiteLabel?`| WhiteLabel options for web3auth. It helps you define custom UI, branding, and translations for your brand app. It takes `WhiteLabelData` as a value. |
66
-
|`loginConfig?`| Login config for the custom verifiers. It takes `HashMap<String, LoginConfigItem>` as a value. |
67
-
|`mfaSettings?`| Allows developers to configure the Mfa settings for authentication. It takes `MfaSettings` as a value. |
|`whiteLabel?`| WhiteLabel options for web3auth. It helps you define custom UI, branding, and translations for your brand app. It takes `WhiteLabelData` as a value. |
67
+
|`authConnectionConfig?`| Auth connection config for the custom auth connections. It takes `List<AuthConnectionConfig>` as a value. |
68
+
|`mfaSettings?`| Allows developers to configure the MFA settings for authentication. It takes `MfaSettings` as a value. |
69
+
|`walletServicesConfig?`| Configuration for wallet services including whitelabel options. It takes `WalletServicesConfig` as a value. |
68
70
69
71
</TabItem>
70
72
@@ -74,16 +76,19 @@ The Web3Auth Constructor takes an object with `Web3AuthOptions` as input.
0 commit comments