From 384c6bd7ec75c73c7caf5041f674f2cf1386dd59 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Thu, 10 Apr 2025 15:27:33 +0530 Subject: [PATCH 01/33] feat: auth services v10 changes. Signed-off-by: Gaurav Goel --- example/lib/main.dart | 35 +++++++++------- lib/enums.dart | 4 +- lib/input.dart | 24 +++++------ lib/output.dart | 85 ++++++++++++++++++++------------------- lib/web3auth_flutter.dart | 6 +-- 5 files changed, 81 insertions(+), 73 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index deeebed..14b87eb 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -55,7 +55,8 @@ class _MyAppState extends State with WidgetsBindingObserver { Uri redirectUrl; if (Platform.isAndroid) { - redirectUrl = Uri.parse('torusapp://org.torusresearch.flutter.web3authexample'); + redirectUrl = + Uri.parse('torusapp://org.torusresearch.flutter.web3authexample'); } else if (Platform.isIOS) { redirectUrl = Uri.parse('com.web3auth.flutter.web3authflutterexample://auth'); @@ -63,12 +64,13 @@ class _MyAppState extends State with WidgetsBindingObserver { throw UnKnownException('Unknown platform'); } - final loginConfig = HashMap(); - loginConfig['jwt'] = LoginConfigItem( - verifier: "w3a-auth0-demo", // get it from web3auth dashboard - typeOfLogin: TypeOfLogin.jwt, - clientId: "hUVVf4SEsZT7syOiL0gLU9hFEtm2gQ6O" // auth0 client id - ); + final List authConnectionConfig = [ + AuthConnectionConfig( + authConnectionId: "web3auth-auth0-email-passwordless-sapphire-devnet", + authConnection: AuthConnection.jwt, + clientId: "d84f6xvbdV75VTGmHiMWfZLeSPk8M07C", + ) + ]; await Web3AuthFlutter.init( Web3AuthOptions( @@ -85,7 +87,7 @@ class _MyAppState extends State with WidgetsBindingObserver { appName: "Web3Auth Flutter App", theme: themeMap, ), - loginConfig: loginConfig, + authConnectionConfig: authConnectionConfig, ), ); @@ -290,10 +292,10 @@ class _MyAppState extends State with WidgetsBindingObserver { }; } - VoidCallback _userInfo(Future Function() method) { + VoidCallback _userInfo(Future Function() method) { return () async { try { - final TorusUserInfo response = await Web3AuthFlutter.getUserInfo(); + final UserInfo response = await Web3AuthFlutter.getUserInfo(); setState(() { _result = response.toString(); logoutVisible = true; @@ -308,18 +310,20 @@ class _MyAppState extends State with WidgetsBindingObserver { Future _withGoogle() { return Web3AuthFlutter.login( - LoginParams(loginProvider: Provider.google, mfaLevel: MFALevel.NONE), + LoginParams( + loginProvider: AUTH_CONNECTION.google, mfaLevel: MFALevel.NONE), ); } Future _withFacebook() { - return Web3AuthFlutter.login(LoginParams(loginProvider: Provider.facebook)); + return Web3AuthFlutter.login( + LoginParams(loginProvider: AUTH_CONNECTION.facebook)); } Future _withEmailPasswordless() { return Web3AuthFlutter.login( LoginParams( - loginProvider: Provider.email_passwordless, + loginProvider: AUTH_CONNECTION.email_passwordless, extraLoginOptions: ExtraLoginOptions( login_hint: textEditingController.text, ), @@ -328,14 +332,15 @@ class _MyAppState extends State with WidgetsBindingObserver { } Future _withDiscord() { - return Web3AuthFlutter.login(LoginParams(loginProvider: Provider.discord)); + return Web3AuthFlutter.login( + LoginParams(loginProvider: AUTH_CONNECTION.discord)); } Future _getPrivKey() { return Web3AuthFlutter.getPrivKey(); } - Future _getUserInfo() { + Future _getUserInfo() { return Web3AuthFlutter.getUserInfo(); } diff --git a/lib/enums.dart b/lib/enums.dart index aa7086c..cd87d83 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -8,7 +8,7 @@ enum Language { en, de, ja, ko, zh, es, fr, pt, nl , tr} enum ThemeModes { light, dark, auto } -enum Provider { +enum AUTH_CONNECTION { google, facebook, reddit, @@ -26,7 +26,7 @@ enum Provider { farcaster, } -enum TypeOfLogin { +enum AuthConnection { google, facebook, reddit, diff --git a/lib/input.dart b/lib/input.dart index 80016c5..f8e0c9a 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -6,7 +6,7 @@ import 'package:web3auth_flutter/web3auth_flutter.dart'; class LoginParams { /// [loginProvider] sets the oAuth login method to be used. You can use any of the /// valid [Provider] from the supported list. - final Provider loginProvider; + final AUTH_CONNECTION loginProvider; /// Custom verifier logins can get a dapp share returned to them post successful login. /// This is useful if the dapps want to use this share to allow users to login seamlessly. @@ -58,12 +58,12 @@ class LoginParams { }; } -class LoginConfigItem { +class AuthConnectionConfig { /// Custom verifier name given in the developer dashboard. - final String verifier; + final String authConnectionId; /// The type of login for custom verifier. - final TypeOfLogin typeOfLogin; + final AuthConnection authConnection; /// Client id provided by your login provider used for custom verifier. final String clientId; @@ -99,9 +99,9 @@ class LoginConfigItem { /// Whether to show the login button on Mobile. final bool? showOnMobile; - LoginConfigItem({ - required this.verifier, - required this.typeOfLogin, + AuthConnectionConfig({ + required this.authConnectionId, + required this.authConnection, required this.clientId, this.name, this.description, @@ -117,8 +117,8 @@ class LoginConfigItem { Map toJson() { return { - 'verifier': verifier, - 'typeOfLogin': typeOfLogin.name, + 'authConnectionId': authConnectionId, + 'authConnection': authConnection.name, 'clientId': clientId, 'name': name, 'description': description, @@ -436,7 +436,7 @@ class Web3AuthOptions { final WhiteLabelData? whiteLabel; /// Login config for the custom verifiers. - final HashMap? loginConfig; + final List? authConnectionConfig; /// Use [useCoreKitKey] to get the core kit key. final bool? useCoreKitKey; @@ -467,7 +467,7 @@ class Web3AuthOptions { String? walletSdkUrl, this.redirectUrl, this.whiteLabel, - this.loginConfig, + this.authConnectionConfig, this.useCoreKitKey, this.chainNamespace = ChainNamespace.eip155, this.sessionTime = 30 * 86400, @@ -490,7 +490,7 @@ class Web3AuthOptions { 'buildEnv': buildEnv?.name, 'redirectUrl': redirectUrl.toString(), 'whiteLabel': whiteLabel?.toJson(), - 'loginConfig': loginConfig, + 'authConnectionConfig': authConnectionConfig, 'useCoreKitKey': useCoreKitKey, 'chainNamespace': chainNamespace?.name, 'mfaSettings': mfaSettings, diff --git a/lib/output.dart b/lib/output.dart index c7b02a9..d7cba91 100644 --- a/lib/output.dart +++ b/lib/output.dart @@ -11,7 +11,7 @@ class Web3AuthResponse { final String? sessionId; /// User's information based on the current session. - final TorusUserInfo? userInfo; + final UserInfo? userInfo; final String? error; @@ -25,32 +25,33 @@ class Web3AuthResponse { final int? tssShareIndex; final String? tssPubKey; final String? tssShare; + final String? tssTag; final int? tssNonce; final List? nodeIndexes; final String? keyMode; - Web3AuthResponse({ - this.privKey, - this.userInfo, - this.error, - this.ed25519PrivKey, - this.sessionId, - this.coreKitKey, - this.coreKitEd25519PrivKey, - this.factorKey, - this.signatures, - this.tssShareIndex, - this.tssPubKey, - this.tssShare, - this.tssNonce, - this.nodeIndexes, - this.keyMode - }); + Web3AuthResponse( + {this.privKey, + this.userInfo, + this.error, + this.ed25519PrivKey, + this.sessionId, + this.coreKitKey, + this.coreKitEd25519PrivKey, + this.factorKey, + this.signatures, + this.tssShareIndex, + this.tssPubKey, + this.tssShare, + this.tssTag, + this.tssNonce, + this.nodeIndexes, + this.keyMode}); @override String toString() { return "{privKey=$privKey, userInfo = ${userInfo.toString()}, ed25519PrivKey=$ed25519PrivKey, coreKitKey=$coreKitKey, coreKitEd25519PrivKey=$coreKitEd25519PrivKey, sessionId=$sessionId, error=$error," - "factorKey=$factorKey, signatures=$signatures, tssShareIndex=$tssShareIndex, tssPubKey=$tssPubKey, tssShare=$tssShare, tssNonce=$tssNonce, nodeIndexes=$nodeIndexes, keyMode=$keyMode}"; + "factorKey=$factorKey, signatures=$signatures, tssShareIndex=$tssShareIndex, tssPubKey=$tssPubKey, tssShare=$tssShare, tssTag:$tssTag, tssNonce=$tssNonce, nodeIndexes=$nodeIndexes, keyMode=$keyMode}"; } Map toJson() { @@ -67,6 +68,7 @@ class Web3AuthResponse { 'tssShareIndex': tssShareIndex, 'tssPubKey': tssPubKey, 'tssShare': tssShare, + 'tssTag': tssTag, 'tssNonce': tssNonce, 'nodeIndexes': nodeIndexes, 'keyMode': keyMode @@ -76,7 +78,7 @@ class Web3AuthResponse { Web3AuthResponse.fromJson(Map json) : privKey = json['privKey'], userInfo = json['userInfo'] != null - ? TorusUserInfo.fromJson(json['userInfo']) + ? UserInfo.fromJson(json['userInfo']) : null, ed25519PrivKey = json['ed25519PrivKey'], sessionId = json['sessionId'], @@ -90,6 +92,7 @@ class Web3AuthResponse { tssShareIndex = json['tssShareIndex'], tssPubKey = json['tssPubKey'], tssShare = json['tssShare'], + tssTag = json['tssTag'], tssNonce = json['tssNonce'], nodeIndexes = json['nodeIndexes'] != null ? List.from(json['nodeIndexes']) @@ -97,7 +100,7 @@ class Web3AuthResponse { keyMode = json['keyMode']; } -class TorusUserInfo { +class UserInfo { /// Email of the connected user. final String? email; @@ -108,16 +111,16 @@ class TorusUserInfo { final String? profileImage; /// Details of the verifier type. - final String? verifier; + final String? authConnectionId; /// Verified id for the custom verifiers. - final String? verifierId; + final String? userId; /// Type of login choosen by user, like google, facebook, etc. - final String? typeOfLogin; + final String? authConnection; /// Details of the aggregate verifier, if present. - final String? aggregateVerifier; + final String? groupedAuthConnectionId; /// If you are using a Custom Verifier, you can get a dapp share after successful login. /// This share can act as a replacement to your user's device share. @@ -137,14 +140,14 @@ class TorusUserInfo { /// Defines whether MFA is enabled or not. final bool? isMfaEnabled; - const TorusUserInfo({ + const UserInfo({ this.email, this.name, this.profileImage, - this.verifier, - this.verifierId, - this.typeOfLogin, - this.aggregateVerifier, + this.authConnectionId, + this.userId, + this.authConnection, + this.groupedAuthConnectionId, this.dappShare, this.idToken, this.oAuthIdToken, @@ -154,8 +157,8 @@ class TorusUserInfo { @override String toString() { - return "{email=$email, name=$name, profileImage=$profileImage, verifier=$verifier," - "verifierId=$verifierId, typeOfLogin=$typeOfLogin, dappShare=$dappShare, idToken=$idToken, oAuthIdToken=$oAuthIdToken, oAuthAccessToken=$oAuthAccessToken, isMfaEnabled=$isMfaEnabled}"; + return "{email=$email, name=$name, profileImage=$profileImage, authConnectionId=$authConnectionId," + "userId=$userId, authConnection=$authConnection, dappShare=$dappShare, idToken=$idToken, oAuthIdToken=$oAuthIdToken, oAuthAccessToken=$oAuthAccessToken, isMfaEnabled=$isMfaEnabled}"; } Map toJson() { @@ -163,10 +166,10 @@ class TorusUserInfo { 'email': email, 'name': name, 'profileImage': profileImage, - 'verifier': verifier, - 'verifierId': verifierId, - 'typeOfLogin': typeOfLogin, - 'aggregateVerifier': aggregateVerifier, + 'verifier': authConnectionId, + 'verifierId': userId, + 'authConnection': authConnection, + 'groupedAuthConnectionId': groupedAuthConnectionId, 'dappShare': dappShare, 'idToken': idToken, 'oAuthIdToken': oAuthIdToken, @@ -175,14 +178,14 @@ class TorusUserInfo { }; } - TorusUserInfo.fromJson(Map json) + UserInfo.fromJson(Map json) : email = json['email'], name = json['name'], profileImage = json['profileImage'], - verifier = json['verifier'], - verifierId = json['verifierId'], - typeOfLogin = json['typeOfLogin'], - aggregateVerifier = json['aggregateVerifier'], + authConnectionId = json['authConnectionId'], + userId = json['userId'], + authConnection = json['authConnection'], + groupedAuthConnectionId = json['groupedAuthConnectionId'], dappShare = json['dappShare'], idToken = json['idToken'], oAuthIdToken = json['oAuthIdToken'], diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index a87dcc2..b6050b5 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -94,16 +94,16 @@ class Web3AuthFlutter { /// Returns the user information such as email address, name, session id, and etc. /// /// If user is not authenticated, it'll throw an error. - static Future getUserInfo() async { + static Future getUserInfo() async { try { final String torusUserInfo = await _channel.invokeMethod('getUserInfo', jsonEncode({})); - return TorusUserInfo.fromJson(jsonDecode(torusUserInfo)); + return UserInfo.fromJson(jsonDecode(torusUserInfo)); } on PlatformException catch (e) { throw _handlePlatformException(e); } } - + /// [setCustomTabsClosed] helps to trigger the [UserCancelledException] exception /// on Android. /// From a417645ebc8ee13603ef626134105a26e5357369 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 14 Apr 2025 13:48:56 +0530 Subject: [PATCH 02/33] feat: update UserInfo Signed-off-by: Gaurav Goel --- lib/output.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/output.dart b/lib/output.dart index d7cba91..a55b33c 100644 --- a/lib/output.dart +++ b/lib/output.dart @@ -166,8 +166,8 @@ class UserInfo { 'email': email, 'name': name, 'profileImage': profileImage, - 'verifier': authConnectionId, - 'verifierId': userId, + 'authConnectionId': authConnectionId, + 'userId': userId, 'authConnection': authConnection, 'groupedAuthConnectionId': groupedAuthConnectionId, 'dappShare': dappShare, From 2a8b25962a6b41a050b4c897106dad0e9a7e292c Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Tue, 15 Apr 2025 10:36:20 +0530 Subject: [PATCH 03/33] feat: wallet-services changes added and update example. Signed-off-by: Gaurav Goel --- .../web3auth_flutter/Web3AuthFlutterPlugin.kt | 8 ++++++-- example/lib/main.dart | 15 +++++++++------ ios/Classes/SwiftWeb3AuthFlutterPlugin.swift | 11 +++++++---- lib/web3auth_flutter.dart | 12 ++++++++---- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index 4efb1a0..a88dfcd 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -197,6 +197,7 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, Log.d(wsParams.toString(), "#wsParams") val launchWalletCF = web3auth.launchWalletServices( wsParams.chainConfig, + wsParams.chainId, wsParams.path ) launchWalletCF.get() @@ -247,6 +248,7 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, Log.d(reqParams.toString(), "#reqParams") val requestCF = web3auth.request( reqParams.chainConfig, + reqParams.chainId, reqParams.method, convertListToJsonArray(reqParams.requestParams) , reqParams.path, @@ -301,13 +303,15 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, } @Keep data class WalletServicesJson( - @Keep val chainConfig: ChainConfig, + @Keep val chainConfig: List, + @Keep val chainId: String, @Keep val path: String? = "wallet" ) @Keep data class RequestJson( - @Keep val chainConfig: ChainConfig, + @Keep val chainConfig: List, + @Keep val chainId: String, @Keep val method: String, @Keep val requestParams: List, @Keep val path: String? = "wallet/request", diff --git a/example/lib/main.dart b/example/lib/main.dart index 14b87eb..a7e71c4 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -348,11 +348,13 @@ class _MyAppState extends State with WidgetsBindingObserver { return () async { try { await Web3AuthFlutter.launchWalletServices( - ChainConfig( - chainId: "0x89", - rpcTarget: - "https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0", - ), + [ + ChainConfig( + chainId: "0x89", + rpcTarget: "https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0", + ), + ], + "0x89" ); } on UserCancelledException { log("User cancelled."); @@ -402,7 +404,8 @@ class _MyAppState extends State with WidgetsBindingObserver { params.add(address.hexEip55); params.add("Web3Auth"); final signResponse = await Web3AuthFlutter.request( - ChainConfig(chainId: "0x89", rpcTarget: "https://polygon-rpc.com/"), + [ChainConfig(chainId: "0x89", rpcTarget: "https://polygon-rpc.com/")], + "0x89", "personal_sign", params, appState: "web3auth", diff --git a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift index 74da053..ec2a0eb 100644 --- a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift +++ b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift @@ -135,7 +135,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } do { - try await web3auth?.launchWalletServices(chainConfig: wsParams.chainConfig, path: wsParams.path) + try await web3auth?.launchWalletServices(chains: wsParams.chains, chainId: wsParams.chainId, path: wsParams.path) result(nil) return } catch { @@ -197,7 +197,8 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { do { let signResponse = try await web3auth?.request( - chainConfig: reqParams.chainConfig, + chains: reqParams.chains, + chainId: wsParams.chainId, method: reqParams.method, requestParams: reqParams.requestParams, path: reqParams.path, @@ -256,12 +257,14 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } struct WalletServicesParams: Codable { - let chainConfig: ChainConfig + let chainConfig: [ChainConfig] + let chainId: String let path: String? } struct RequestJson: Codable { - let chainConfig: ChainConfig + let chains: [ChainConfig] + let chainId: String let method: String let requestParams: [String] let path: String? diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index b6050b5..961ed9c 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -137,7 +137,8 @@ class Web3AuthFlutter { } static Future launchWalletServices( - ChainConfig chainConfig, { + List chains, + String chainId, { String path = "wallet", }) async { try { @@ -145,7 +146,8 @@ class Web3AuthFlutter { chainConfigJson.removeWhere((key, value) => value == null); Map walletServicesJson = {}; - walletServicesJson["chainConfig"] = chainConfigJson; + walletServicesJson["chains"] = chains; + walletServicesJson["chainId"] = chainId; walletServicesJson["path"] = path; await _channel.invokeMethod( @@ -202,7 +204,8 @@ class Web3AuthFlutter { } static Future request( - ChainConfig chainConfig, + List chains, + String chainId String method, List requestParams, { String path = "wallet/request", @@ -216,7 +219,8 @@ class Web3AuthFlutter { requestParams.map((param) => jsonEncode(param)).toList(); Map requestJson = {}; - requestJson["chainConfig"] = chainConfigJson; + requestJson["chains"] = chains; + requestJson["chainId"] = chainId; requestJson["method"] = method; requestJson["requestParams"] = modifiedRequestParams; requestJson["path"] = path; From 1ceec389afc461094a82cd9eb3d6bb96e12791ff Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 21 Apr 2025 11:04:10 +0530 Subject: [PATCH 04/33] feat: update example and bump auth-services version Signed-off-by: Gaurav Goel --- example/lib/main.dart | 16 ++++++------- lib/input.dart | 14 +++++------ lib/web3auth_flutter.dart | 50 +++++++++++++++++++++++++-------------- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index a7e71c4..b93f846 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -79,7 +79,7 @@ class _MyAppState extends State with WidgetsBindingObserver { //sdkUrl: 'https://auth.mocaverse.xyz', //walletSdkUrl: 'https://lrc-mocaverse.web3auth.io', network: Network.sapphire_devnet, - buildEnv: BuildEnv.production, + buildEnv: BuildEnv.testing, redirectUrl: redirectUrl, whiteLabel: WhiteLabelData( mode: ThemeModes.dark, @@ -215,8 +215,8 @@ class _MyAppState extends State with WidgetsBindingObserver { child: const Text('Launch Wallet Services'), ), ElevatedButton( - onPressed: _setupMFA(), - child: const Text('Setup MFA'), + onPressed: _enableMFA(), + child: const Text('Enable MFA'), ), ElevatedButton( onPressed: _manageMFA(), @@ -311,19 +311,19 @@ class _MyAppState extends State with WidgetsBindingObserver { Future _withGoogle() { return Web3AuthFlutter.login( LoginParams( - loginProvider: AUTH_CONNECTION.google, mfaLevel: MFALevel.NONE), + authConnection: AUTH_CONNECTION.google, mfaLevel: MFALevel.NONE), ); } Future _withFacebook() { return Web3AuthFlutter.login( - LoginParams(loginProvider: AUTH_CONNECTION.facebook)); + LoginParams(authConnection: AUTH_CONNECTION.facebook)); } Future _withEmailPasswordless() { return Web3AuthFlutter.login( LoginParams( - loginProvider: AUTH_CONNECTION.email_passwordless, + authConnection: AUTH_CONNECTION.email_passwordless, extraLoginOptions: ExtraLoginOptions( login_hint: textEditingController.text, ), @@ -333,7 +333,7 @@ class _MyAppState extends State with WidgetsBindingObserver { Future _withDiscord() { return Web3AuthFlutter.login( - LoginParams(loginProvider: AUTH_CONNECTION.discord)); + LoginParams(authConnection: AUTH_CONNECTION.discord)); } Future _getPrivKey() { @@ -364,7 +364,7 @@ class _MyAppState extends State with WidgetsBindingObserver { }; } - VoidCallback _setupMFA() { + VoidCallback _enableMFA() { return () async { try { await Web3AuthFlutter.enableMFA(); diff --git a/lib/input.dart b/lib/input.dart index f8e0c9a..e5582af 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -4,9 +4,9 @@ import 'package:web3auth_flutter/enums.dart'; import 'package:web3auth_flutter/web3auth_flutter.dart'; class LoginParams { - /// [loginProvider] sets the oAuth login method to be used. You can use any of the - /// valid [Provider] from the supported list. - final AUTH_CONNECTION loginProvider; + /// [authConnection] sets the oAuth login method to be used. You can use any of the + /// valid [AUTH_CONNECTION] from the supported list. + final AUTH_CONNECTION authConnection; /// Custom verifier logins can get a dapp share returned to them post successful login. /// This is useful if the dapps want to use this share to allow users to login seamlessly. @@ -22,7 +22,7 @@ class LoginParams { /// The default value is [Curve.secp256k1]. final Curve? curve; - /// [extraLoginOptions] can be used to set the OAuth login options for corresponding [loginProvider]. + /// [extraLoginOptions] can be used to set the OAuth login options for corresponding [AUTH_CONNECTION]. /// /// For instance, you'll need to pass user's email address as `login_hint` for [Provider.email_passwordless]. final ExtraLoginOptions? extraLoginOptions; @@ -37,7 +37,7 @@ class LoginParams { final String? dappUrl; LoginParams( - {required this.loginProvider, + {required this.authConnection, this.dappShare, this.curve = Curve.secp256k1, this.extraLoginOptions, @@ -47,7 +47,7 @@ class LoginParams { this.dappUrl}); Map toJson() => { - "loginProvider": loginProvider.name, + "authConnection": authConnection.name, "dappShare": dappShare, "curve": curve?.name, "extraLoginOptions": extraLoginOptions?.toJson(), @@ -511,7 +511,7 @@ class UnKnownException implements Exception { } String getSdkUrl(BuildEnv? buildEnv) { - const String version = "v9"; + const String version = "v10"; switch (buildEnv) { case BuildEnv.staging: return "https://staging-auth.web3auth.io/$version"; diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index 961ed9c..3bbbdba 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -137,18 +137,23 @@ class Web3AuthFlutter { } static Future launchWalletServices( - List chains, + List chainConfig, String chainId, { String path = "wallet", }) async { try { - Map chainConfigJson = chainConfig.toJson(); - chainConfigJson.removeWhere((key, value) => value == null); + List> chainConfigJson = chainConfig + .map((config) { + final json = config.toJson(); + json.removeWhere((key, value) => value == null); + return json; + }).toList(); - Map walletServicesJson = {}; - walletServicesJson["chains"] = chains; - walletServicesJson["chainId"] = chainId; - walletServicesJson["path"] = path; + Map walletServicesJson = { + "chainConfig": chainConfigJson, + "chainId": chainId, + "path": path, + }; await _channel.invokeMethod( 'launchWalletServices', @@ -204,26 +209,35 @@ class Web3AuthFlutter { } static Future request( - List chains, - String chainId + List chainConfig, + String chainId, String method, List requestParams, { String path = "wallet/request", String? appState, }) async { try { - Map chainConfigJson = chainConfig.toJson(); - chainConfigJson.removeWhere((key, value) => value == null); + List> chainConfigJson = chainConfig + .map((config) { + final json = config.toJson(); + json.removeWhere((key, value) => value == null); + return json; + }) + .toList(); + // Encode each request param as a string List modifiedRequestParams = - requestParams.map((param) => jsonEncode(param)).toList(); + requestParams.map((param) => jsonEncode(param)).toList(); + + // Build the request JSON + Map requestJson = { + "chainConfig": chainConfigJson, + "chainId": chainId, + "method": method, + "requestParams": modifiedRequestParams, + "path": path, + }; - Map requestJson = {}; - requestJson["chains"] = chains; - requestJson["chainId"] = chainId; - requestJson["method"] = method; - requestJson["requestParams"] = modifiedRequestParams; - requestJson["path"] = path; if (appState != null) { requestJson["appState"] = appState; } From 954f652c04ded8d08857fc6a5f593b810a918423 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Wed, 23 Apr 2025 09:23:25 +0530 Subject: [PATCH 05/33] feat: update example and bump auth-services version Signed-off-by: Gaurav Goel --- android/build.gradle | 3 ++- .../web3auth_flutter/Web3AuthFlutterPlugin.kt | 15 +++++++-------- example/lib/main.dart | 17 ++++++++--------- ios/Classes/SwiftWeb3AuthFlutterPlugin.swift | 10 ++++------ 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 7e18622..2d520ff 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -51,6 +51,7 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' - implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' + //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' + implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.6' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index a88dfcd..8547a48 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -12,7 +12,7 @@ import com.google.gson.JsonArray import com.google.gson.JsonElement import com.google.gson.JsonPrimitive import com.web3auth.core.Web3Auth -import com.web3auth.core.types.ChainConfig +import com.web3auth.core.types.ChainsConfig import com.web3auth.core.types.ErrorCode import com.web3auth.core.types.LoginParams import com.web3auth.core.types.Web3AuthError @@ -189,13 +189,13 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, } } - "launchWalletServices" -> { + "showWalletUI" -> { try { - Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#launchWalletServices") + Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#showWalletUI") val wsArgs = call.arguments() ?: return null val wsParams = gson.fromJson(wsArgs, WalletServicesJson::class.java) Log.d(wsParams.toString(), "#wsParams") - val launchWalletCF = web3auth.launchWalletServices( + val launchWalletCF = web3auth.showWalletUI( wsParams.chainConfig, wsParams.chainId, wsParams.path @@ -242,13 +242,12 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, "request" -> { try { - Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#signMessage") + Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#request") val requestArgs = call.arguments() ?: return null val reqParams = gson.fromJson(requestArgs, RequestJson::class.java) Log.d(reqParams.toString(), "#reqParams") val requestCF = web3auth.request( reqParams.chainConfig, - reqParams.chainId, reqParams.method, convertListToJsonArray(reqParams.requestParams) , reqParams.path, @@ -303,14 +302,14 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, } @Keep data class WalletServicesJson( - @Keep val chainConfig: List, + @Keep val chainConfig: List, @Keep val chainId: String, @Keep val path: String? = "wallet" ) @Keep data class RequestJson( - @Keep val chainConfig: List, + @Keep val chainConfig: ChainsConfig, @Keep val chainId: String, @Keep val method: String, @Keep val requestParams: List, diff --git a/example/lib/main.dart b/example/lib/main.dart index b93f846..bb4d558 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -79,7 +79,7 @@ class _MyAppState extends State with WidgetsBindingObserver { //sdkUrl: 'https://auth.mocaverse.xyz', //walletSdkUrl: 'https://lrc-mocaverse.web3auth.io', network: Network.sapphire_devnet, - buildEnv: BuildEnv.testing, + authBuildEnv: BuildEnv.testing, redirectUrl: redirectUrl, whiteLabel: WhiteLabelData( mode: ThemeModes.dark, @@ -311,19 +311,19 @@ class _MyAppState extends State with WidgetsBindingObserver { Future _withGoogle() { return Web3AuthFlutter.login( LoginParams( - authConnection: AUTH_CONNECTION.google, mfaLevel: MFALevel.NONE), + authConnection: AuthConnection.google, mfaLevel: MFALevel.NONE), ); } Future _withFacebook() { return Web3AuthFlutter.login( - LoginParams(authConnection: AUTH_CONNECTION.facebook)); + LoginParams(authConnection: AuthConnection.facebook)); } Future _withEmailPasswordless() { return Web3AuthFlutter.login( LoginParams( - authConnection: AUTH_CONNECTION.email_passwordless, + authConnection: AuthConnection.email_passwordless, extraLoginOptions: ExtraLoginOptions( login_hint: textEditingController.text, ), @@ -333,7 +333,7 @@ class _MyAppState extends State with WidgetsBindingObserver { Future _withDiscord() { return Web3AuthFlutter.login( - LoginParams(authConnection: AUTH_CONNECTION.discord)); + LoginParams(authConnection: AuthConnection.discord)); } Future _getPrivKey() { @@ -347,9 +347,9 @@ class _MyAppState extends State with WidgetsBindingObserver { VoidCallback _launchWalletServices() { return () async { try { - await Web3AuthFlutter.launchWalletServices( + await Web3AuthFlutter.showWalletUI( [ - ChainConfig( + ChainsConfig( chainId: "0x89", rpcTarget: "https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0", ), @@ -404,8 +404,7 @@ class _MyAppState extends State with WidgetsBindingObserver { params.add(address.hexEip55); params.add("Web3Auth"); final signResponse = await Web3AuthFlutter.request( - [ChainConfig(chainId: "0x89", rpcTarget: "https://polygon-rpc.com/")], - "0x89", + ChainsConfig(chainId: "0x89", rpcTarget: "https://polygon-rpc.com/"), "personal_sign", params, appState: "web3auth", diff --git a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift index ec2a0eb..8d40495 100644 --- a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift +++ b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift @@ -121,7 +121,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { let getEd25519PrivKey = web3auth?.getEd25519PrivKey() result(getEd25519PrivKey) return - case "launchWalletServices": + case "showWalletUI": let wsParams: WalletServicesParams do { wsParams = try decoder.decode(WalletServicesParams.self, from: data) @@ -135,7 +135,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } do { - try await web3auth?.launchWalletServices(chains: wsParams.chains, chainId: wsParams.chainId, path: wsParams.path) + try await web3auth?.showWalletUI(chains: wsParams.chains, chainId: wsParams.chainId, path: wsParams.path) result(nil) return } catch { @@ -197,8 +197,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { do { let signResponse = try await web3auth?.request( - chains: reqParams.chains, - chainId: wsParams.chainId, + chainConfig: reqParams.chainConfig, method: reqParams.method, requestParams: reqParams.requestParams, path: reqParams.path, @@ -263,8 +262,7 @@ struct WalletServicesParams: Codable { } struct RequestJson: Codable { - let chains: [ChainConfig] - let chainId: String + let chainConfig: ChainConfig let method: String let requestParams: [String] let path: String? From 95b37709d7d628b0209565abcd36c0b05906ddc5 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Wed, 23 Apr 2025 09:23:52 +0530 Subject: [PATCH 06/33] feat: update sdk inputs Signed-off-by: Gaurav Goel --- lib/enums.dart | 18 ------------------ lib/input.dart | 26 +++++++++++++------------- lib/web3auth_flutter.dart | 20 +++++--------------- 3 files changed, 18 insertions(+), 46 deletions(-) diff --git a/lib/enums.dart b/lib/enums.dart index cd87d83..04f8c7e 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -8,24 +8,6 @@ enum Language { en, de, ja, ko, zh, es, fr, pt, nl , tr} enum ThemeModes { light, dark, auto } -enum AUTH_CONNECTION { - google, - facebook, - reddit, - discord, - twitch, - github, - apple, - linkedin, - twitter, - line, - kakao, - email_passwordless, - jwt, - sms_passwordless, - farcaster, -} - enum AuthConnection { google, facebook, diff --git a/lib/input.dart b/lib/input.dart index e5582af..c603365 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -5,8 +5,8 @@ import 'package:web3auth_flutter/web3auth_flutter.dart'; class LoginParams { /// [authConnection] sets the oAuth login method to be used. You can use any of the - /// valid [AUTH_CONNECTION] from the supported list. - final AUTH_CONNECTION authConnection; + /// valid [AuthConnection] from the supported list. + final AuthConnection authConnection; /// Custom verifier logins can get a dapp share returned to them post successful login. /// This is useful if the dapps want to use this share to allow users to login seamlessly. @@ -22,7 +22,7 @@ class LoginParams { /// The default value is [Curve.secp256k1]. final Curve? curve; - /// [extraLoginOptions] can be used to set the OAuth login options for corresponding [AUTH_CONNECTION]. + /// [extraLoginOptions] can be used to set the OAuth login options for corresponding [AuthConnection]. /// /// For instance, you'll need to pass user's email address as `login_hint` for [Provider.email_passwordless]. final ExtraLoginOptions? extraLoginOptions; @@ -364,7 +364,7 @@ class MfaSettings { } } -class ChainConfig { +class ChainsConfig { final ChainNamespace chainNamespace; final int? decimals; final String? blockExplorerUrl; @@ -375,7 +375,7 @@ class ChainConfig { final String? ticker; final String? tickerName; - ChainConfig({ + ChainsConfig({ this.chainNamespace = ChainNamespace.eip155, this.decimals = 18, this.blockExplorerUrl, @@ -413,10 +413,10 @@ class Web3AuthOptions { /// User [Network.sapphire_mainnet] for production build. final Network network; - /// [buildEnv] is used for internal testing purposes. This buildEnv + /// [authBuildEnv] is used for internal testing purposes. This buildEnv /// signifies the enviroment for Web3Auth, and doesn't signifies /// the enviorment of the application. - final BuildEnv? buildEnv; + final BuildEnv? authBuildEnv; /// Define the desired Web3Auth service url. final String? sdkUrl; @@ -453,7 +453,7 @@ class Web3AuthOptions { /// Session Time is in seconds, default is 86400 seconds which is 1 day. [sessionTime] can be max 30 days. final int? sessionTime; - final ChainConfig? chainConfig; + final ChainsConfig? chainConfig; final Map? originData; @@ -462,7 +462,7 @@ class Web3AuthOptions { Web3AuthOptions({ required this.clientId, required this.network, - this.buildEnv = BuildEnv.production, + this.authBuildEnv = BuildEnv.production, String? sdkUrl, String? walletSdkUrl, this.redirectUrl, @@ -475,11 +475,11 @@ class Web3AuthOptions { this.originData, String? dashboardUrl, }) : chainConfig = null, - sdkUrl = sdkUrl ?? getSdkUrl(buildEnv ?? BuildEnv.production), + sdkUrl = sdkUrl ?? getSdkUrl(authBuildEnv ?? BuildEnv.production), walletSdkUrl = - walletSdkUrl ?? getWalletSdkUrl(buildEnv ?? BuildEnv.production), + walletSdkUrl ?? getWalletSdkUrl(authBuildEnv ?? BuildEnv.production), dashboardUrl = - dashboardUrl ?? getDashboardUrl(buildEnv ?? BuildEnv.production); + dashboardUrl ?? getDashboardUrl(authBuildEnv ?? BuildEnv.production); Map toJson() { return { @@ -487,7 +487,7 @@ class Web3AuthOptions { 'network': network.name, 'sdkUrl': sdkUrl, 'walletSdkUrl': walletSdkUrl, - 'buildEnv': buildEnv?.name, + 'buildEnv': authBuildEnv?.name, 'redirectUrl': redirectUrl.toString(), 'whiteLabel': whiteLabel?.toJson(), 'authConnectionConfig': authConnectionConfig, diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index 3bbbdba..6865fd8 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -136,8 +136,8 @@ class Web3AuthFlutter { } } - static Future launchWalletServices( - List chainConfig, + static Future showWalletUI( + List chainConfig, String chainId, { String path = "wallet", }) async { @@ -156,7 +156,7 @@ class Web3AuthFlutter { }; await _channel.invokeMethod( - 'launchWalletServices', + 'showWalletUI', jsonEncode(walletServicesJson), ); @@ -209,30 +209,20 @@ class Web3AuthFlutter { } static Future request( - List chainConfig, - String chainId, + ChainsConfig chainConfig, String method, List requestParams, { String path = "wallet/request", String? appState, }) async { try { - List> chainConfigJson = chainConfig - .map((config) { - final json = config.toJson(); - json.removeWhere((key, value) => value == null); - return json; - }) - .toList(); - // Encode each request param as a string List modifiedRequestParams = requestParams.map((param) => jsonEncode(param)).toList(); // Build the request JSON Map requestJson = { - "chainConfig": chainConfigJson, - "chainId": chainId, + "chainConfig": chainConfig.toJson(), "method": method, "requestParams": modifiedRequestParams, "path": path, From 5d11e389e849655766d60ca75c23f72960c6708d Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Fri, 25 Apr 2025 07:55:08 +0530 Subject: [PATCH 07/33] feat: Rename ChainsConfig to ChainConfig Signed-off-by: Gaurav Goel --- .../flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt | 6 +++--- example/lib/main.dart | 4 ++-- lib/input.dart | 6 +++--- lib/web3auth_flutter.dart | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index 8547a48..7a557e6 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -12,7 +12,7 @@ import com.google.gson.JsonArray import com.google.gson.JsonElement import com.google.gson.JsonPrimitive import com.web3auth.core.Web3Auth -import com.web3auth.core.types.ChainsConfig +import com.web3auth.core.types.ChainConfig import com.web3auth.core.types.ErrorCode import com.web3auth.core.types.LoginParams import com.web3auth.core.types.Web3AuthError @@ -302,14 +302,14 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, } @Keep data class WalletServicesJson( - @Keep val chainConfig: List, + @Keep val chainConfig: List, @Keep val chainId: String, @Keep val path: String? = "wallet" ) @Keep data class RequestJson( - @Keep val chainConfig: ChainsConfig, + @Keep val chainConfig: ChainConfig, @Keep val chainId: String, @Keep val method: String, @Keep val requestParams: List, diff --git a/example/lib/main.dart b/example/lib/main.dart index bb4d558..286409f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -349,7 +349,7 @@ class _MyAppState extends State with WidgetsBindingObserver { try { await Web3AuthFlutter.showWalletUI( [ - ChainsConfig( + ChainConfig( chainId: "0x89", rpcTarget: "https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0", ), @@ -404,7 +404,7 @@ class _MyAppState extends State with WidgetsBindingObserver { params.add(address.hexEip55); params.add("Web3Auth"); final signResponse = await Web3AuthFlutter.request( - ChainsConfig(chainId: "0x89", rpcTarget: "https://polygon-rpc.com/"), + ChainConfig(chainId: "0x89", rpcTarget: "https://polygon-rpc.com/"), "personal_sign", params, appState: "web3auth", diff --git a/lib/input.dart b/lib/input.dart index c603365..2a4b19d 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -364,7 +364,7 @@ class MfaSettings { } } -class ChainsConfig { +class ChainConfig { final ChainNamespace chainNamespace; final int? decimals; final String? blockExplorerUrl; @@ -375,7 +375,7 @@ class ChainsConfig { final String? ticker; final String? tickerName; - ChainsConfig({ + ChainConfig({ this.chainNamespace = ChainNamespace.eip155, this.decimals = 18, this.blockExplorerUrl, @@ -453,7 +453,7 @@ class Web3AuthOptions { /// Session Time is in seconds, default is 86400 seconds which is 1 day. [sessionTime] can be max 30 days. final int? sessionTime; - final ChainsConfig? chainConfig; + final ChainConfig? chainConfig; final Map? originData; diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index 6865fd8..fca06fb 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -137,7 +137,7 @@ class Web3AuthFlutter { } static Future showWalletUI( - List chainConfig, + List chainConfig, String chainId, { String path = "wallet", }) async { @@ -209,7 +209,7 @@ class Web3AuthFlutter { } static Future request( - ChainsConfig chainConfig, + ChainConfig chainConfig, String method, List requestParams, { String path = "wallet/request", From 4eb997ce0aac28194c2aa4a08dc6c76bcbf33112 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Fri, 25 Apr 2025 09:57:39 +0530 Subject: [PATCH 08/33] feat: update variables names and android sdk Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- example/lib/main.dart | 2 +- lib/enums.dart | 2 +- lib/input.dart | 11 +++++++---- lib/output.dart | 13 ++++++++----- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 2d520ff..ebdf1c3 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.6' + implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.7' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/example/lib/main.dart b/example/lib/main.dart index 286409f..cbe438b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -78,7 +78,7 @@ class _MyAppState extends State with WidgetsBindingObserver { 'BHgArYmWwSeq21czpcarYh0EVq2WWOzflX-NTK-tY1-1pauPzHKRRLgpABkmYiIV_og9jAvoIxQ8L3Smrwe04Lw', //sdkUrl: 'https://auth.mocaverse.xyz', //walletSdkUrl: 'https://lrc-mocaverse.web3auth.io', - network: Network.sapphire_devnet, + web3AuthNetwork: Web3AuthNetwork.sapphire_devnet, authBuildEnv: BuildEnv.testing, redirectUrl: redirectUrl, whiteLabel: WhiteLabelData( diff --git a/lib/enums.dart b/lib/enums.dart index 04f8c7e..e119e57 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -1,4 +1,4 @@ -enum Network { mainnet, testnet, cyan, aqua, sapphire_devnet, sapphire_mainnet } +enum Web3AuthNetwork { mainnet, testnet, cyan, aqua, sapphire_devnet, sapphire_mainnet } enum BuildEnv { production, staging, testing } diff --git a/lib/input.dart b/lib/input.dart index 2a4b19d..b6302bb 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -1,5 +1,7 @@ import 'dart:collection'; +import 'dart:convert'; +import 'package:json_annotation/json_annotation.dart'; import 'package:web3auth_flutter/enums.dart'; import 'package:web3auth_flutter/web3auth_flutter.dart'; @@ -410,8 +412,9 @@ class Web3AuthOptions { /// Web3Auth Network to use for the session & the issued idToken. /// - /// User [Network.sapphire_mainnet] for production build. - final Network network; + /// User [Web3AuthNetwork.sapphire_mainnet] for production build. + @JsonKey(name: 'network') + final Web3AuthNetwork web3AuthNetwork; /// [authBuildEnv] is used for internal testing purposes. This buildEnv /// signifies the enviroment for Web3Auth, and doesn't signifies @@ -461,7 +464,7 @@ class Web3AuthOptions { Web3AuthOptions({ required this.clientId, - required this.network, + required this.web3AuthNetwork, this.authBuildEnv = BuildEnv.production, String? sdkUrl, String? walletSdkUrl, @@ -484,7 +487,7 @@ class Web3AuthOptions { Map toJson() { return { 'clientId': clientId, - 'network': network.name, + 'network': web3AuthNetwork.name, 'sdkUrl': sdkUrl, 'walletSdkUrl': walletSdkUrl, 'buildEnv': authBuildEnv?.name, diff --git a/lib/output.dart b/lib/output.dart index a55b33c..a09f997 100644 --- a/lib/output.dart +++ b/lib/output.dart @@ -1,8 +1,11 @@ import 'dart:core'; +import 'package:json_annotation/json_annotation.dart'; + class Web3AuthResponse { /// secp256k1 private key compaitible with Ethereum ecosystem. - final String? privKey; + @JsonKey(name: 'privKey') + final String? privateKey; /// ed25519 private key compaitible with Solana ecosystem. final String? ed25519PrivKey; @@ -31,7 +34,7 @@ class Web3AuthResponse { final String? keyMode; Web3AuthResponse( - {this.privKey, + {this.privateKey, this.userInfo, this.error, this.ed25519PrivKey, @@ -50,13 +53,13 @@ class Web3AuthResponse { @override String toString() { - return "{privKey=$privKey, userInfo = ${userInfo.toString()}, ed25519PrivKey=$ed25519PrivKey, coreKitKey=$coreKitKey, coreKitEd25519PrivKey=$coreKitEd25519PrivKey, sessionId=$sessionId, error=$error," + return "{privateKey=$privateKey, userInfo = ${userInfo.toString()}, ed25519PrivKey=$ed25519PrivKey, coreKitKey=$coreKitKey, coreKitEd25519PrivKey=$coreKitEd25519PrivKey, sessionId=$sessionId, error=$error," "factorKey=$factorKey, signatures=$signatures, tssShareIndex=$tssShareIndex, tssPubKey=$tssPubKey, tssShare=$tssShare, tssTag:$tssTag, tssNonce=$tssNonce, nodeIndexes=$nodeIndexes, keyMode=$keyMode}"; } Map toJson() { return { - 'privKey': privKey, + 'privKey': privateKey, 'userInfo': userInfo?.toJson(), 'ed25519PrivKey': ed25519PrivKey, 'sessionId': sessionId, @@ -76,7 +79,7 @@ class Web3AuthResponse { } Web3AuthResponse.fromJson(Map json) - : privKey = json['privKey'], + : privateKey = json['privKey'], userInfo = json['userInfo'] != null ? UserInfo.fromJson(json['userInfo']) : null, From aed178fcfdfb866d4b4eb62d1184ab6b9d9a9de6 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 28 Apr 2025 08:11:23 +0530 Subject: [PATCH 09/33] feat: Update pubspec.yaml Signed-off-by: Gaurav Goel --- pubspec.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pubspec.yaml b/pubspec.yaml index fbfde45..3e132b0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,11 +11,14 @@ environment: dependencies: flutter: sdk: flutter + json_annotation: ^4.8.1 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0 + build_runner: ^2.4.6 + json_serializable: ^6.7.1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From 0f6f226710a260c310921eb0113c9391fff8fecf Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 28 Apr 2025 11:34:21 +0530 Subject: [PATCH 10/33] feat: default value for authConnectionConfig Signed-off-by: Gaurav Goel --- lib/input.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/input.dart b/lib/input.dart index b6302bb..a1a059d 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -1,5 +1,4 @@ import 'dart:collection'; -import 'dart:convert'; import 'package:json_annotation/json_annotation.dart'; import 'package:web3auth_flutter/enums.dart'; @@ -470,7 +469,7 @@ class Web3AuthOptions { String? walletSdkUrl, this.redirectUrl, this.whiteLabel, - this.authConnectionConfig, + List? authConnectionConfig, this.useCoreKitKey, this.chainNamespace = ChainNamespace.eip155, this.sessionTime = 30 * 86400, @@ -482,7 +481,8 @@ class Web3AuthOptions { walletSdkUrl = walletSdkUrl ?? getWalletSdkUrl(authBuildEnv ?? BuildEnv.production), dashboardUrl = - dashboardUrl ?? getDashboardUrl(authBuildEnv ?? BuildEnv.production); + dashboardUrl ?? getDashboardUrl(authBuildEnv ?? BuildEnv.production), + authConnectionConfig = authConnectionConfig ?? const []; Map toJson() { return { From 523d7b7b7939d6af0228be98452f83ff5c879003 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Tue, 29 Apr 2025 15:04:49 +0530 Subject: [PATCH 11/33] feat: changed authConnection jwt to custom Signed-off-by: Gaurav Goel --- example/lib/main.dart | 2 +- lib/enums.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index cbe438b..55c236d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -67,7 +67,7 @@ class _MyAppState extends State with WidgetsBindingObserver { final List authConnectionConfig = [ AuthConnectionConfig( authConnectionId: "web3auth-auth0-email-passwordless-sapphire-devnet", - authConnection: AuthConnection.jwt, + authConnection: AuthConnection.custom, clientId: "d84f6xvbdV75VTGmHiMWfZLeSPk8M07C", ) ]; diff --git a/lib/enums.dart b/lib/enums.dart index e119e57..8505ea7 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -24,7 +24,7 @@ enum AuthConnection { line, email_passwordless, email_password, - jwt, + custom, sms_passwordless, farcaster, } From a1c557b4b589fb87b13fd276e3becd78d17716e9 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Tue, 13 May 2025 09:14:49 +0530 Subject: [PATCH 12/33] feat: variable naming changes Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- .../web3auth_flutter/Web3AuthFlutterPlugin.kt | 12 ++++++------ example/lib/main.dart | 6 +++--- ios/Classes/SwiftWeb3AuthFlutterPlugin.swift | 8 ++++---- lib/input.dart | 4 ++++ lib/web3auth_flutter.dart | 8 ++++---- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index ebdf1c3..e758819 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.7' + implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.0.3' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index 7a557e6..08bd1f5 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -151,15 +151,15 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, } } - "getPrivKey" -> { - val privKey = web3auth.getPrivkey() - Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#getPrivKey") + "getPrivateKey" -> { + val privKey = web3auth.privateKey + Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#getPrivateKey") return privKey } - "getEd25519PrivKey" -> { - val ed25519Key = web3auth.getEd25519PrivKey() - Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#getEd25519PrivKey") + "getEd25519PrivateKey" -> { + val ed25519Key = web3auth.ed25519PrivateKey + Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#getEd25519PrivateKey") return ed25519Key } diff --git a/example/lib/main.dart b/example/lib/main.dart index 55c236d..18e779d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -97,7 +97,7 @@ class _MyAppState extends State with WidgetsBindingObserver { print('Error during Web3Auth initialization: $e'); } - final String res = await Web3AuthFlutter.getPrivKey(); + final String res = await Web3AuthFlutter.getPrivateKey(); log(res); if (res.isNotEmpty) { setState(() { @@ -279,7 +279,7 @@ class _MyAppState extends State with WidgetsBindingObserver { VoidCallback _privKey(Future Function() method) { return () async { try { - final String response = await Web3AuthFlutter.getPrivKey(); + final String response = await Web3AuthFlutter.getPrivateKey(); setState(() { _result = response; logoutVisible = true; @@ -337,7 +337,7 @@ class _MyAppState extends State with WidgetsBindingObserver { } Future _getPrivKey() { - return Web3AuthFlutter.getPrivKey(); + return Web3AuthFlutter.getPrivateKey(); } Future _getUserInfo() { diff --git a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift index 8d40495..6b9b5a0 100644 --- a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift +++ b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift @@ -113,12 +113,12 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { // There is no initialize function in swift result(nil) return - case "getPrivKey": - let privKey = web3auth?.getPrivkey() + case "getPrivateKey": + let privKey = web3auth?.getPrivateKey() result(privKey) return - case "getEd25519PrivKey": - let getEd25519PrivKey = web3auth?.getEd25519PrivKey() + case "getEd25519PrivateKey": + let getEd25519PrivKey = web3auth?.getEd25519PrivateKey() result(getEd25519PrivKey) return case "showWalletUI": diff --git a/lib/input.dart b/lib/input.dart index a1a059d..469052d 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -75,6 +75,8 @@ class AuthConnectionConfig { /// Description for the button. If provided, it renders as a full length button. else, icon button. final String? description; + final String? groupedAuthConnectionId; + /// The field in JWT token which maps to verifier id. Please make sure you selected /// correct JWT verifier id in the developer dashboard. final String? verifierSubIdentifier; @@ -106,6 +108,7 @@ class AuthConnectionConfig { required this.clientId, this.name, this.description, + this.groupedAuthConnectionId, this.verifierSubIdentifier, this.logoHover, this.logoLight, @@ -123,6 +126,7 @@ class AuthConnectionConfig { 'clientId': clientId, 'name': name, 'description': description, + 'groupedAuthConnectionId': groupedAuthConnectionId, 'verifierSubIdentifier': verifierSubIdentifier, 'logoHover': logoHover, 'logoLight': logoLight, diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index fca06fb..25a03fa 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -67,10 +67,10 @@ class Web3AuthFlutter { /// authenticated. /// /// If user is not authenticated, it'll return empty string. - static Future getPrivKey() async { + static Future getPrivateKey() async { try { final String privKey = - await _channel.invokeMethod('getPrivKey', jsonEncode({})); + await _channel.invokeMethod('getPrivateKey', jsonEncode({})); return privKey; } on PlatformException catch (e) { throw _handlePlatformException(e); @@ -81,10 +81,10 @@ class Web3AuthFlutter { /// authenticated. /// /// If user is not authenticated, it'll return empty string. - static Future getEd25519PrivKey() async { + static Future getEd25519PrivateKey() async { try { final String getEd25519PrivKey = - await _channel.invokeMethod('getEd25519PrivKey', jsonEncode({})); + await _channel.invokeMethod('getEd25519PrivateKey', jsonEncode({})); return getEd25519PrivKey; } on PlatformException catch (e) { throw _handlePlatformException(e); From 2c018c4e884fbf74e2e074fc521b57191ef352a9 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Wed, 14 May 2025 11:33:31 +0530 Subject: [PATCH 13/33] feat: update LoginParams Signed-off-by: Gaurav Goel --- lib/input.dart | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/input.dart b/lib/input.dart index 469052d..940e7b0 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -37,6 +37,12 @@ class LoginParams { final MFALevel? mfaLevel; final String? dappUrl; + /// The auth connection id to be used for login. + final String? authConnectionId; + + /// The grouped auth connection id to be used for login. + final String? groupedAuthConnectionId; + LoginParams( {required this.authConnection, this.dappShare, @@ -45,7 +51,9 @@ class LoginParams { this.redirectUrl, this.appState, this.mfaLevel, - this.dappUrl}); + this.dappUrl, + this.authConnectionId, + this.groupedAuthConnectionId}); Map toJson() => { "authConnection": authConnection.name, @@ -55,7 +63,9 @@ class LoginParams { "redirectUrl": redirectUrl?.toString(), "appState": appState, "mfaLevel": mfaLevel?.type, - "dappUrl": dappUrl + "dappUrl": dappUrl, + "authConnectionId": authConnectionId, + "groupedAuthConnectionId": groupedAuthConnectionId, }; } @@ -75,12 +85,10 @@ class AuthConnectionConfig { /// Description for the button. If provided, it renders as a full length button. else, icon button. final String? description; + /// The grouped auth connection id. + /// If provided, authConnectionId will become a sub identifier for the groupedAuthConnectionId. final String? groupedAuthConnectionId; - /// The field in JWT token which maps to verifier id. Please make sure you selected - /// correct JWT verifier id in the developer dashboard. - final String? verifierSubIdentifier; - /// Logo to be shown on mouse hover. final String? logoHover; From c533d2f30483195b265feb82afc9526ba3fd1ae6 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Wed, 14 May 2025 11:41:24 +0530 Subject: [PATCH 14/33] feat: update LoginParams Signed-off-by: Gaurav Goel --- lib/input.dart | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/input.dart b/lib/input.dart index 940e7b0..9e02649 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -9,6 +9,12 @@ class LoginParams { /// valid [AuthConnection] from the supported list. final AuthConnection authConnection; + /// The auth connection id to be used for login. + final String? authConnectionId; + + /// The grouped auth connection id to be used for login. + final String? groupedAuthConnectionId; + /// Custom verifier logins can get a dapp share returned to them post successful login. /// This is useful if the dapps want to use this share to allow users to login seamlessly. final String? dappShare; @@ -37,26 +43,22 @@ class LoginParams { final MFALevel? mfaLevel; final String? dappUrl; - /// The auth connection id to be used for login. - final String? authConnectionId; - - /// The grouped auth connection id to be used for login. - final String? groupedAuthConnectionId; - LoginParams( {required this.authConnection, + this.authConnectionId, + this.groupedAuthConnectionId, this.dappShare, this.curve = Curve.secp256k1, this.extraLoginOptions, this.redirectUrl, this.appState, this.mfaLevel, - this.dappUrl, - this.authConnectionId, - this.groupedAuthConnectionId}); + this.dappUrl}); Map toJson() => { "authConnection": authConnection.name, + "authConnectionId": authConnectionId, + "groupedAuthConnectionId": groupedAuthConnectionId, "dappShare": dappShare, "curve": curve?.name, "extraLoginOptions": extraLoginOptions?.toJson(), @@ -64,8 +66,6 @@ class LoginParams { "appState": appState, "mfaLevel": mfaLevel?.type, "dappUrl": dappUrl, - "authConnectionId": authConnectionId, - "groupedAuthConnectionId": groupedAuthConnectionId, }; } @@ -117,7 +117,6 @@ class AuthConnectionConfig { this.name, this.description, this.groupedAuthConnectionId, - this.verifierSubIdentifier, this.logoHover, this.logoLight, this.logoDark, @@ -135,7 +134,6 @@ class AuthConnectionConfig { 'name': name, 'description': description, 'groupedAuthConnectionId': groupedAuthConnectionId, - 'verifierSubIdentifier': verifierSubIdentifier, 'logoHover': logoHover, 'logoLight': logoLight, 'logoDark': logoDark, From f7bcce86d6225c85631cdfeadc00cd12b8d78250 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Wed, 14 May 2025 19:39:02 +0530 Subject: [PATCH 15/33] feat: update wallet-services to v5 version Signed-off-by: Gaurav Goel --- lib/input.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/input.dart b/lib/input.dart index 9e02649..24cdb35 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -537,7 +537,7 @@ String getSdkUrl(BuildEnv? buildEnv) { } String getWalletSdkUrl(BuildEnv? buildEnv) { - const String walletServicesVersion = "v4"; + const String walletServicesVersion = "v5"; switch (buildEnv) { case BuildEnv.staging: return "https://staging-wallet.web3auth.io/$walletServicesVersion"; From 36daf9678f0c1c7e4d285920dc0c435130e6dc37 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Thu, 15 May 2025 07:54:29 +0530 Subject: [PATCH 16/33] feat: update ExtraLoginOptions Signed-off-by: Gaurav Goel --- lib/enums.dart | 5 +++++ lib/input.dart | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/enums.dart b/lib/enums.dart index 8505ea7..33d7a89 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -29,6 +29,11 @@ enum AuthConnection { farcaster, } +enum EmailFlowType { + link, + code, +} + enum Display { /// Displays the UI with a full page view. page, diff --git a/lib/input.dart b/lib/input.dart index 24cdb35..f875366 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -161,10 +161,12 @@ class ExtraLoginOptions { /// The field in JWT token which maps to verifier id. Please make sure you selected /// correct JWT verifier id in the developer dashboard. - final String? verifierIdField; + final String? userIdField; /// Whether the verifier id field is case sensitive or not. - final bool? isVerifierIdCaseSensitive; + final bool? isUserIdCaseSensitive; + + final String? access_token; /// Allows developers the configure the display of UI. Checkout [Display] for more /// details. @@ -187,6 +189,8 @@ class ExtraLoginOptions { final String? id_token; + final EmailFlowType? flow_type; + /// [login_hint] is used to send the user's email address during [Provider.email_passwordless]. final String? login_hint; @@ -220,8 +224,10 @@ class ExtraLoginOptions { this.domain, this.client_id, this.leeway, - this.verifierIdField, - this.isVerifierIdCaseSensitive, + this.userIdField, + this.isUserIdCaseSensitive, + this.access_token, + this.flow_type, this.display, this.prompt, this.max_age, @@ -244,8 +250,10 @@ class ExtraLoginOptions { "domain": domain, "client_id": client_id, "leeway": leeway, - "verifierIdField": verifierIdField, - "isVerifierIdCaseSensitive": isVerifierIdCaseSensitive, + "userIdField": userIdField, + "isUserIdCaseSensitive": isUserIdCaseSensitive, + "access_token": access_token, + "flow_type": flow_type?.name, "display": display?.name, "prompt": prompt?.name, "max_age": max_age, From ddf64fa4767b81cd23203741168c3b69226112b0 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 19 May 2025 09:22:20 +0530 Subject: [PATCH 17/33] feat: update android code Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- .../flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt | 4 ++-- lib/input.dart | 5 +++++ lib/output.dart | 11 ++++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index e758819..d8b341b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.0.3' + implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.0.9' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index 08bd1f5..4ce75f1 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -152,13 +152,13 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, } "getPrivateKey" -> { - val privKey = web3auth.privateKey + val privKey = web3auth.getPrivateKey() Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#getPrivateKey") return privKey } "getEd25519PrivateKey" -> { - val ed25519Key = web3auth.ed25519PrivateKey + val ed25519Key = web3auth.getEd25519PrivateKey() Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#getEd25519PrivateKey") return ed25519Key } diff --git a/lib/input.dart b/lib/input.dart index f875366..fc4e363 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -479,6 +479,9 @@ class Web3AuthOptions { final String? dashboardUrl; + /// [includeUserDataInToken] allows developers to include user data in the token. + final bool? includeUserDataInToken; + Web3AuthOptions({ required this.clientId, required this.web3AuthNetwork, @@ -493,6 +496,7 @@ class Web3AuthOptions { this.sessionTime = 30 * 86400, this.mfaSettings, this.originData, + this.includeUserDataInToken, String? dashboardUrl, }) : chainConfig = null, sdkUrl = sdkUrl ?? getSdkUrl(authBuildEnv ?? BuildEnv.production), @@ -518,6 +522,7 @@ class Web3AuthOptions { "sessionTime": sessionTime, "chainConfig": chainConfig?.toJson(), "originData": originData, + "includeUserDataInToken": includeUserDataInToken, "dashboardUrl": dashboardUrl, }; } diff --git a/lib/output.dart b/lib/output.dart index a09f997..91d7455 100644 --- a/lib/output.dart +++ b/lib/output.dart @@ -8,7 +8,8 @@ class Web3AuthResponse { final String? privateKey; /// ed25519 private key compaitible with Solana ecosystem. - final String? ed25519PrivKey; + @JsonKey(name: 'ed25519PrivKey') + final String? ed25519PrivateKey; /// Current We3Auth sessionId. final String? sessionId; @@ -37,7 +38,7 @@ class Web3AuthResponse { {this.privateKey, this.userInfo, this.error, - this.ed25519PrivKey, + this.ed25519PrivateKey, this.sessionId, this.coreKitKey, this.coreKitEd25519PrivKey, @@ -53,7 +54,7 @@ class Web3AuthResponse { @override String toString() { - return "{privateKey=$privateKey, userInfo = ${userInfo.toString()}, ed25519PrivKey=$ed25519PrivKey, coreKitKey=$coreKitKey, coreKitEd25519PrivKey=$coreKitEd25519PrivKey, sessionId=$sessionId, error=$error," + return "{privateKey=$privateKey, userInfo = ${userInfo.toString()}, ed25519PrivateKey=$ed25519PrivateKey, coreKitKey=$coreKitKey, coreKitEd25519PrivKey=$coreKitEd25519PrivKey, sessionId=$sessionId, error=$error," "factorKey=$factorKey, signatures=$signatures, tssShareIndex=$tssShareIndex, tssPubKey=$tssPubKey, tssShare=$tssShare, tssTag:$tssTag, tssNonce=$tssNonce, nodeIndexes=$nodeIndexes, keyMode=$keyMode}"; } @@ -61,7 +62,7 @@ class Web3AuthResponse { return { 'privKey': privateKey, 'userInfo': userInfo?.toJson(), - 'ed25519PrivKey': ed25519PrivKey, + 'ed25519PrivKey': ed25519PrivateKey, 'sessionId': sessionId, 'error': error, 'coreKitKey': coreKitKey, @@ -83,7 +84,7 @@ class Web3AuthResponse { userInfo = json['userInfo'] != null ? UserInfo.fromJson(json['userInfo']) : null, - ed25519PrivKey = json['ed25519PrivKey'], + ed25519PrivateKey = json['ed25519PrivKey'], sessionId = json['sessionId'], coreKitKey = json['coreKitKey'], coreKitEd25519PrivKey = json['coreKitEd25519PrivKey'], From e2df0605494de300ffd671a414085c3bb48fbae6 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 19 May 2025 14:56:47 +0530 Subject: [PATCH 18/33] feat: update input.dart Signed-off-by: Gaurav Goel --- lib/input.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/input.dart b/lib/input.dart index fc4e363..1a5257c 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -70,12 +70,13 @@ class LoginParams { } class AuthConnectionConfig { - /// Custom verifier name given in the developer dashboard. - final String authConnectionId; /// The type of login for custom verifier. final AuthConnection authConnection; + /// Custom verifier name given in the developer dashboard. + final String authConnectionId; + /// Client id provided by your login provider used for custom verifier. final String clientId; @@ -111,8 +112,8 @@ class AuthConnectionConfig { final bool? showOnMobile; AuthConnectionConfig({ - required this.authConnectionId, required this.authConnection, + required this.authConnectionId, required this.clientId, this.name, this.description, @@ -128,8 +129,8 @@ class AuthConnectionConfig { Map toJson() { return { - 'authConnectionId': authConnectionId, 'authConnection': authConnection.name, + 'authConnectionId': authConnectionId, 'clientId': clientId, 'name': name, 'description': description, From f164b3a5b5a17321eff57b6bae4e07cf83a804c9 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Thu, 5 Jun 2025 13:52:31 +0530 Subject: [PATCH 19/33] feat: combined sdk android code initial commit Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- .../web3auth_flutter/Web3AuthFlutterPlugin.kt | 16 +- example/lib/main.dart | 30 +-- lib/enums.dart | 7 + lib/input.dart | 232 ++++++++++-------- lib/web3auth_flutter.dart | 15 +- 6 files changed, 152 insertions(+), 150 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d8b341b..529a643 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:0.0.0.9' + implementation 'com.github.grvgoel81:web3auth-android-sdk:2.0.0.4' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index 4ce75f1..188a5a4 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -99,7 +99,7 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val initParams = gson.fromJson(initArgs, Web3AuthOptions::class.java) // handle custom parameters which are gson excluded val obj = JSONObject(initArgs) - if (obj.has("redirectUrl")) initParams.redirectUrl = Uri.parse(obj.get("redirectUrl") as String?) + if (obj.has("redirectUrl")) initParams.redirectUrl = obj.get("redirectUrl").toString() // Log.d(initParams.toString(), "#initParams") web3auth = Web3Auth( initParams, activity!! @@ -116,8 +116,7 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val loginArgs = call.arguments() ?: return null val loginParams = gson.fromJson(loginArgs, LoginParams::class.java) val obj = JSONObject(loginArgs) - if (obj.has("redirectUrl")) loginParams.redirectUrl = Uri.parse(obj.get("redirectUrl") as String?) - val loginCF = web3auth.login(loginParams) + val loginCF = web3auth.connectTo(loginParams) // Log.d(loginParams.toString(), "#loginParams") Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#login") val loginResult: Web3AuthResponse = loginCF.get() @@ -196,8 +195,6 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val wsParams = gson.fromJson(wsArgs, WalletServicesJson::class.java) Log.d(wsParams.toString(), "#wsParams") val launchWalletCF = web3auth.showWalletUI( - wsParams.chainConfig, - wsParams.chainId, wsParams.path ) launchWalletCF.get() @@ -214,8 +211,6 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val loginArgs = call.arguments() ?: return null val loginParams = gson.fromJson(loginArgs, LoginParams::class.java) val obj = JSONObject(loginArgs) - if (obj.has("redirectUrl")) loginParams.redirectUrl = - Uri.parse(obj.get("redirectUrl") as String?) val setupMfaCF = web3auth.enableMFA(loginParams) Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#enableMFA") return setupMfaCF.get() @@ -247,7 +242,6 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val reqParams = gson.fromJson(requestArgs, RequestJson::class.java) Log.d(reqParams.toString(), "#reqParams") val requestCF = web3auth.request( - reqParams.chainConfig, reqParams.method, convertListToJsonArray(reqParams.requestParams) , reqParams.path, @@ -266,8 +260,6 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val loginArgs = call.arguments() ?: return null val loginParams = gson.fromJson(loginArgs, LoginParams::class.java) val obj = JSONObject(loginArgs) - if (obj.has("redirectUrl")) loginParams.redirectUrl = - Uri.parse(obj.get("redirectUrl") as String?) val setupMfaCF = web3auth.manageMFA(loginParams) Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#enableMFA") return setupMfaCF.get() @@ -302,15 +294,11 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, } @Keep data class WalletServicesJson( - @Keep val chainConfig: List, - @Keep val chainId: String, @Keep val path: String? = "wallet" ) @Keep data class RequestJson( - @Keep val chainConfig: ChainConfig, - @Keep val chainId: String, @Keep val method: String, @Keep val requestParams: List, @Keep val path: String? = "wallet/request", diff --git a/example/lib/main.dart b/example/lib/main.dart index 18e779d..82a98f3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -53,13 +53,11 @@ class _MyAppState extends State with WidgetsBindingObserver { HashMap themeMap = HashMap(); themeMap['primary'] = "#229954"; - Uri redirectUrl; + String redirectUrl; if (Platform.isAndroid) { - redirectUrl = - Uri.parse('torusapp://org.torusresearch.flutter.web3authexample'); + redirectUrl = 'torusapp://org.torusresearch.flutter.web3authexample'; } else if (Platform.isIOS) { - redirectUrl = - Uri.parse('com.web3auth.flutter.web3authflutterexample://auth'); + redirectUrl = 'com.web3auth.flutter.web3authflutterexample://auth'; } else { throw UnKnownException('Unknown platform'); } @@ -75,19 +73,14 @@ class _MyAppState extends State with WidgetsBindingObserver { await Web3AuthFlutter.init( Web3AuthOptions( clientId: - 'BHgArYmWwSeq21czpcarYh0EVq2WWOzflX-NTK-tY1-1pauPzHKRRLgpABkmYiIV_og9jAvoIxQ8L3Smrwe04Lw', + 'BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ', //sdkUrl: 'https://auth.mocaverse.xyz', //walletSdkUrl: 'https://lrc-mocaverse.web3auth.io', - web3AuthNetwork: Web3AuthNetwork.sapphire_devnet, + web3AuthNetwork: Web3AuthNetwork.sapphire_mainnet, authBuildEnv: BuildEnv.testing, redirectUrl: redirectUrl, - whiteLabel: WhiteLabelData( - mode: ThemeModes.dark, - defaultLanguage: Language.en, - appName: "Web3Auth Flutter App", - theme: themeMap, - ), authConnectionConfig: authConnectionConfig, + defaultChainId: "0x1", ), ); @@ -347,15 +340,7 @@ class _MyAppState extends State with WidgetsBindingObserver { VoidCallback _launchWalletServices() { return () async { try { - await Web3AuthFlutter.showWalletUI( - [ - ChainConfig( - chainId: "0x89", - rpcTarget: "https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0", - ), - ], - "0x89" - ); + await Web3AuthFlutter.showWalletUI(); } on UserCancelledException { log("User cancelled."); } on UnKnownException { @@ -404,7 +389,6 @@ class _MyAppState extends State with WidgetsBindingObserver { params.add(address.hexEip55); params.add("Web3Auth"); final signResponse = await Web3AuthFlutter.request( - ChainConfig(chainId: "0x89", rpcTarget: "https://polygon-rpc.com/"), "personal_sign", params, appState: "web3auth", diff --git a/lib/enums.dart b/lib/enums.dart index 33d7a89..dc244be 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -91,3 +91,10 @@ enum Prompt { } enum Curve { secp256k1, ed25519 } + +enum ConfirmationStrategy { + popup, + modal, + autoApprove, + defaultStrategy +} diff --git a/lib/input.dart b/lib/input.dart index 1a5257c..128f46a 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -15,6 +15,16 @@ class LoginParams { /// The grouped auth connection id to be used for login. final String? groupedAuthConnectionId; + final String? appState; + + /// Customize the MFA screen shown to the user during OAuth authentication. + final MFALevel? mfaLevel; + + /// [extraLoginOptions] can be used to set the OAuth login options for corresponding [AuthConnection]. + /// + /// For instance, you'll need to pass user's email address as `login_hint` for [Provider.email_passwordless]. + final ExtraLoginOptions? extraLoginOptions; + /// Custom verifier logins can get a dapp share returned to them post successful login. /// This is useful if the dapps want to use this share to allow users to login seamlessly. final String? dappShare; @@ -29,44 +39,40 @@ class LoginParams { /// The default value is [Curve.secp256k1]. final Curve? curve; - /// [extraLoginOptions] can be used to set the OAuth login options for corresponding [AuthConnection]. - /// - /// For instance, you'll need to pass user's email address as `login_hint` for [Provider.email_passwordless]. - final ExtraLoginOptions? extraLoginOptions; - - /// Deeplinking for the application where user will be redirected after login. - final Uri? redirectUrl; - - final String? appState; - - /// Customize the MFA screen shown to the user during OAuth authentication. - final MFALevel? mfaLevel; final String? dappUrl; - LoginParams( - {required this.authConnection, - this.authConnectionId, - this.groupedAuthConnectionId, - this.dappShare, - this.curve = Curve.secp256k1, - this.extraLoginOptions, - this.redirectUrl, - this.appState, - this.mfaLevel, - this.dappUrl}); + String? loginHint; + final String? idToken; - Map toJson() => { - "authConnection": authConnection.name, - "authConnectionId": authConnectionId, - "groupedAuthConnectionId": groupedAuthConnectionId, - "dappShare": dappShare, - "curve": curve?.name, - "extraLoginOptions": extraLoginOptions?.toJson(), - "redirectUrl": redirectUrl?.toString(), - "appState": appState, - "mfaLevel": mfaLevel?.type, - "dappUrl": dappUrl, - }; + LoginParams({ + required this.authConnection, + this.authConnectionId, + this.groupedAuthConnectionId, + this.appState, + this.mfaLevel, + this.extraLoginOptions, + this.dappShare, + this.curve = Curve.secp256k1, + this.dappUrl, + this.loginHint, + this.idToken, + }); + + Map toJson() { + return { + 'authConnection': authConnection.name, + 'authConnectionId': authConnectionId, + 'groupedAuthConnectionId': groupedAuthConnectionId, + 'appState': appState, + 'mfaLevel': mfaLevel?.name, + 'extraLoginOptions': extraLoginOptions?.toJson(), + 'dappShare': dappShare, + 'curve': curve?.name, + 'dappUrl': dappUrl, + 'loginHint': loginHint, + 'idToken': idToken, + }; + } } class AuthConnectionConfig { @@ -111,6 +117,8 @@ class AuthConnectionConfig { /// Whether to show the login button on Mobile. final bool? showOnMobile; + final ExtraLoginOptions? jwtParameters; + AuthConnectionConfig({ required this.authConnection, required this.authConnectionId, @@ -125,6 +133,7 @@ class AuthConnectionConfig { this.showOnModal, this.showOnDesktop, this.showOnMobile, + this.jwtParameters, }); Map toJson() { @@ -141,7 +150,8 @@ class AuthConnectionConfig { 'mainOption': mainOption, 'showOnModal': showOnModal, 'showOnDesktop': showOnDesktop, - 'showOnMobile': showOnMobile + 'showOnMobile': showOnMobile, + 'jwtParameters': jwtParameters?.toJson() }; } } @@ -384,7 +394,7 @@ class MfaSettings { } } -class ChainConfig { +class Chains { final ChainNamespace chainNamespace; final int? decimals; final String? blockExplorerUrl; @@ -395,7 +405,7 @@ class ChainConfig { final String? ticker; final String? tickerName; - ChainConfig({ + Chains({ this.chainNamespace = ChainNamespace.eip155, this.decimals = 18, this.blockExplorerUrl, @@ -428,107 +438,133 @@ class Web3AuthOptions { /// You can obtain your client id from the web3auth [developer dashboard](https://dashboard.web3auth.io/). final String clientId; - /// Web3Auth Network to use for the session & the issued idToken. + /// Deeplinking for the application where user will be redirected after login. + /// Ideally, it should be bundleId and package name for iOS and Android respectively. /// - /// User [Web3AuthNetwork.sapphire_mainnet] for production build. - @JsonKey(name: 'network') - final Web3AuthNetwork web3AuthNetwork; + /// While using redirectUrl, please make sure you have whitelisted it + /// developer dashboard. Checkout [SDK reference](https://web3auth.io/docs/sdk/pnp/flutter/install#configuration-1) more details. + final String redirectUrl; + final Map? originData; /// [authBuildEnv] is used for internal testing purposes. This buildEnv /// signifies the enviroment for Web3Auth, and doesn't signifies /// the enviorment of the application. + @JsonKey(name: 'buildEnv') final BuildEnv? authBuildEnv; /// Define the desired Web3Auth service url. final String? sdkUrl; - final String? walletSdkUrl; - /// Deeplinking for the application where user will be redirected after login. - /// Ideally, it should be bundleId and package name for iOS and Android respectively. - /// - /// While using redirectUrl, please make sure you have whitelisted it - /// developer dashboard. Checkout [SDK reference](https://web3auth.io/docs/sdk/pnp/flutter/install#configuration-1) more details. - final Uri? redirectUrl; - - /// WhiteLabel options for web3auth. It helps you define - /// custom UI, branding, and translations for your brand app. - /// - /// Checkout [WhiteLabelData] for more details. - final WhiteLabelData? whiteLabel; + String? storageServerUrl; + String? sessionSocketUrl; /// Login config for the custom verifiers. - final List? authConnectionConfig; + List? authConnectionConfig; - /// Use [useCoreKitKey] to get the core kit key. - final bool? useCoreKitKey; + final String? dashboardUrl; + String? accountAbstractionConfig; + final String? walletSdkUrl; + String? sessionNamespace; - final ChainNamespace? chainNamespace; + /// [includeUserDataInToken] allows developers to include user data in the token. + bool? includeUserDataInToken; - /// Allows developers to configure the [MfaSettings] for authentication. - /// - /// Checkout [MFA SDK Reference](https://web3auth.io/docs/sdk/pnp/flutter/mfa) for more details. - final MfaSettings? mfaSettings; + Chains? chains; + String defaultChainId = '0x1'; + bool enableLogging; /// [sessionTime] 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. - final int? sessionTime; + final int sessionTime; - final ChainConfig? chainConfig; + /// Web3Auth Network to use for the session & the issued idToken. + /// + /// User [Web3AuthNetwork.sapphire_mainnet] for production build. + @JsonKey(name: 'network') + final Web3AuthNetwork web3AuthNetwork; - final Map? originData; + final bool? useSFAKey; - final String? dashboardUrl; + /// WhiteLabel options for web3auth. It helps you define + /// custom UI, branding, and translations for your brand app. + /// + /// Checkout [WalletServicesConfig] for more details. + final WalletServicesConfig? walletServicesConfig; - /// [includeUserDataInToken] allows developers to include user data in the token. - final bool? includeUserDataInToken; + /// Allows developers to configure the [MfaSettings] for authentication. + /// + /// Checkout [MFA SDK Reference](https://web3auth.io/docs/sdk/pnp/flutter/mfa) for more details. + final MfaSettings? mfaSettings; Web3AuthOptions({ required this.clientId, - required this.web3AuthNetwork, + required this.redirectUrl, + this.originData, this.authBuildEnv = BuildEnv.production, String? sdkUrl, + this.storageServerUrl, + this.sessionSocketUrl, + this.authConnectionConfig = const [], + String? dashboardUrl, + this.accountAbstractionConfig, String? walletSdkUrl, - this.redirectUrl, - this.whiteLabel, - List? authConnectionConfig, - this.useCoreKitKey, - this.chainNamespace = ChainNamespace.eip155, + this.sessionNamespace, + this.includeUserDataInToken = true, + this.chains, + required this.defaultChainId, + this.enableLogging = false, this.sessionTime = 30 * 86400, + required this.web3AuthNetwork, + this.useSFAKey = false, + this.walletServicesConfig, this.mfaSettings, - this.originData, - this.includeUserDataInToken, - String? dashboardUrl, - }) : chainConfig = null, - sdkUrl = sdkUrl ?? getSdkUrl(authBuildEnv ?? BuildEnv.production), - walletSdkUrl = - walletSdkUrl ?? getWalletSdkUrl(authBuildEnv ?? BuildEnv.production), - dashboardUrl = - dashboardUrl ?? getDashboardUrl(authBuildEnv ?? BuildEnv.production), - authConnectionConfig = authConnectionConfig ?? const []; + }) : sdkUrl = sdkUrl ?? getSdkUrl(authBuildEnv), + dashboardUrl = dashboardUrl ?? getDashboardUrl(authBuildEnv), + walletSdkUrl = walletSdkUrl ?? getWalletSdkUrl(authBuildEnv); Map toJson() { return { 'clientId': clientId, - 'network': web3AuthNetwork.name, + 'redirectUrl': redirectUrl, + 'originData': originData, + 'buildEnv': authBuildEnv?.name, 'sdkUrl': sdkUrl, + 'storageServerUrl': storageServerUrl, + 'sessionSocketUrl': sessionSocketUrl, + 'authConnectionConfig': authConnectionConfig?.map((config) => config.toJson()).toList(), + 'dashboardUrl': dashboardUrl, + 'accountAbstractionConfig': accountAbstractionConfig, 'walletSdkUrl': walletSdkUrl, - 'buildEnv': authBuildEnv?.name, - 'redirectUrl': redirectUrl.toString(), - 'whiteLabel': whiteLabel?.toJson(), - 'authConnectionConfig': authConnectionConfig, - 'useCoreKitKey': useCoreKitKey, - 'chainNamespace': chainNamespace?.name, - 'mfaSettings': mfaSettings, - "sessionTime": sessionTime, - "chainConfig": chainConfig?.toJson(), - "originData": originData, - "includeUserDataInToken": includeUserDataInToken, - "dashboardUrl": dashboardUrl, + 'sessionNamespace': sessionNamespace, + 'includeUserDataInToken': includeUserDataInToken, + 'chains': chains?.toJson(), + 'defaultChainId': defaultChainId, + 'enableLogging': enableLogging, + 'sessionTime': sessionTime, + 'network': web3AuthNetwork.name, + 'useSFAKey': useSFAKey, + 'walletServicesConfig': walletServicesConfig?.toJson(), + 'mfaSettings': mfaSettings?.toJson(), }; } } +class WalletServicesConfig { + final ConfirmationStrategy? confirmationStrategy; + final WhiteLabelData? whiteLabel; + + WalletServicesConfig({ + this.confirmationStrategy = ConfirmationStrategy.defaultStrategy, + this.whiteLabel, + }); + + Map toJson() => { + 'confirmationStrategy': confirmationStrategy?.name, + 'whiteLabel': whiteLabel?.toJson(), + }; +} + class UserCancelledException implements Exception {} class UnKnownException implements Exception { diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index 25a03fa..30cfa52 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -136,22 +136,11 @@ class Web3AuthFlutter { } } - static Future showWalletUI( - List chainConfig, - String chainId, { + static Future showWalletUI({ String path = "wallet", }) async { try { - List> chainConfigJson = chainConfig - .map((config) { - final json = config.toJson(); - json.removeWhere((key, value) => value == null); - return json; - }).toList(); - Map walletServicesJson = { - "chainConfig": chainConfigJson, - "chainId": chainId, "path": path, }; @@ -209,7 +198,6 @@ class Web3AuthFlutter { } static Future request( - ChainConfig chainConfig, String method, List requestParams, { String path = "wallet/request", @@ -222,7 +210,6 @@ class Web3AuthFlutter { // Build the request JSON Map requestJson = { - "chainConfig": chainConfig.toJson(), "method": method, "requestParams": modifiedRequestParams, "path": path, From ba50b30de8fbcbc8afdc50a2e2c35c19cd8f7a93 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Tue, 10 Jun 2025 14:56:00 +0530 Subject: [PATCH 20/33] feat: Rename login to connectTo Signed-off-by: Gaurav Goel --- .../flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt | 2 +- example/lib/main.dart | 8 ++++---- lib/web3auth_flutter.dart | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index 188a5a4..b288fa9 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -111,7 +111,7 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, return null } - "login" -> { + "connectTo" -> { try { val loginArgs = call.arguments() ?: return null val loginParams = gson.fromJson(loginArgs, LoginParams::class.java) diff --git a/example/lib/main.dart b/example/lib/main.dart index 82a98f3..80293e1 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -302,19 +302,19 @@ class _MyAppState extends State with WidgetsBindingObserver { } Future _withGoogle() { - return Web3AuthFlutter.login( + return Web3AuthFlutter.connectTo( LoginParams( authConnection: AuthConnection.google, mfaLevel: MFALevel.NONE), ); } Future _withFacebook() { - return Web3AuthFlutter.login( + return Web3AuthFlutter.connectTo( LoginParams(authConnection: AuthConnection.facebook)); } Future _withEmailPasswordless() { - return Web3AuthFlutter.login( + return Web3AuthFlutter.connectTo( LoginParams( authConnection: AuthConnection.email_passwordless, extraLoginOptions: ExtraLoginOptions( @@ -325,7 +325,7 @@ class _MyAppState extends State with WidgetsBindingObserver { } Future _withDiscord() { - return Web3AuthFlutter.login( + return Web3AuthFlutter.connectTo( LoginParams(authConnection: AuthConnection.discord)); } diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index 30cfa52..14e702a 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -19,17 +19,17 @@ class Web3AuthFlutter { await _channel.invokeMethod('init', jsonEncode(initParamsJson)); } - /// [login] method will initiate login flow, opening the browser allowing + /// [connectTo] method will initiate login flow, opening the browser allowing /// users to authenticate themselves with preferred login provider. /// /// Use [loginParams] to change the login provider, curve, and other parameters. /// For more details, look into [LoginParams]. - static Future login(LoginParams loginParams) async { + static Future connectTo(LoginParams loginParams) async { try { Map loginParamsJson = loginParams.toJson(); loginParamsJson.removeWhere((key, value) => value == null); final String loginResponse = await _channel.invokeMethod( - 'login', + 'connectTo', jsonEncode(loginParamsJson), ); From d359522c6f20863b4fd9e09351ad6d0e84edc83c Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Wed, 11 Jun 2025 10:03:56 +0530 Subject: [PATCH 21/33] feat: add whitelabel in Web3AuthOptions Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- lib/input.dart | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 529a643..984f057 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:2.0.0.4' + implementation 'com.github.grvgoel81:web3auth-android-sdk:2.0.0.5' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/lib/input.dart b/lib/input.dart index 128f46a..ed40323 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -461,6 +461,10 @@ class Web3AuthOptions { /// Login config for the custom verifiers. List? authConnectionConfig; + /// WhiteLabel options for web3auth. It helps you define + /// custom UI, branding, and translations for your brand app + final WhiteLabelData? whiteLabel; + final String? dashboardUrl; String? accountAbstractionConfig; final String? walletSdkUrl; @@ -506,6 +510,7 @@ class Web3AuthOptions { this.storageServerUrl, this.sessionSocketUrl, this.authConnectionConfig = const [], + this.whiteLabel, String? dashboardUrl, this.accountAbstractionConfig, String? walletSdkUrl, @@ -533,6 +538,7 @@ class Web3AuthOptions { 'storageServerUrl': storageServerUrl, 'sessionSocketUrl': sessionSocketUrl, 'authConnectionConfig': authConnectionConfig?.map((config) => config.toJson()).toList(), + 'whiteLabel': whiteLabel?.toJson(), 'dashboardUrl': dashboardUrl, 'accountAbstractionConfig': accountAbstractionConfig, 'walletSdkUrl': walletSdkUrl, From 85d55ed8f1b0b7f1d32de59e16f5bcf0146eb01a Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 16 Jun 2025 11:47:00 +0530 Subject: [PATCH 22/33] feat: add SFA example Signed-off-by: Gaurav Goel --- .../web3auth_flutter/Web3AuthFlutterPlugin.kt | 2 +- example/lib/main.dart | 13 ++++++++ example/lib/utils.dart | 32 +++++++++++++++++++ example/pubspec.yaml | 1 + lib/input.dart | 4 +-- lib/output.dart | 6 ++-- lib/web3auth_flutter.dart | 2 +- 7 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 example/lib/utils.dart diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index b288fa9..056f206 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -116,8 +116,8 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val loginArgs = call.arguments() ?: return null val loginParams = gson.fromJson(loginArgs, LoginParams::class.java) val obj = JSONObject(loginArgs) + //Log.d("#loginParams", loginParams.toString()) val loginCF = web3auth.connectTo(loginParams) - // Log.d(loginParams.toString(), "#loginParams") Log.d("${Web3AuthFlutterPlugin::class.qualifiedName}", "#login") val loginResult: Web3AuthResponse = loginCF.get() return gson.toJson(loginResult) diff --git a/example/lib/main.dart b/example/lib/main.dart index 80293e1..3a9f5df 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -8,6 +8,7 @@ import 'package:web3auth_flutter/enums.dart'; import 'package:web3auth_flutter/input.dart'; import 'package:web3auth_flutter/output.dart'; import 'package:web3auth_flutter/web3auth_flutter.dart'; +import 'package:web3auth_flutter_example/utils.dart'; import 'package:web3dart/web3dart.dart'; void main() { @@ -181,6 +182,10 @@ class _MyAppState extends State with WidgetsBindingObserver { onPressed: _login(_withDiscord), child: const Text('Discord'), ), + ElevatedButton( + onPressed: _login(sfaSignIn), + child: const Text('SFA SignIn'), + ), ], ), ), @@ -329,6 +334,14 @@ class _MyAppState extends State with WidgetsBindingObserver { LoginParams(authConnection: AuthConnection.discord)); } + Future sfaSignIn() { + return Web3AuthFlutter.connectTo( + LoginParams(authConnection: AuthConnection.discord, + authConnectionId: "torus-test-health", + idToken: Utils().es256Token("devnettestuser@tor.us"), + groupedAuthConnectionId: "torus-aggregate-sapphire-mainnet")); + } + Future _getPrivKey() { return Web3AuthFlutter.getPrivateKey(); } diff --git a/example/lib/utils.dart b/example/lib/utils.dart new file mode 100644 index 0000000..f97e321 --- /dev/null +++ b/example/lib/utils.dart @@ -0,0 +1,32 @@ +import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart'; + +class Utils { + String es256Token(String email) { + String token; + + /* Sign */ { + // Create a json web token + final jwt = JWT({ + "sub": "email|hello", + "aud": "torus-key-test", + "exp": DateTime.now().millisecond, + "iat": DateTime.now().millisecond, + "iss": "torus-key-test", + "email": email, + "nickname": email.split("@")[0], + "name": email, + "picture": "", + "email_verified": true + }); + + // Sign it + final key = ECPrivateKey("-----BEGIN PRIVATE KEY-----\n" + "MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCCD7oLrcKae+jVZPGx52Cb/lKhdKxpXjl9eGNa1MlY57A==" + "\n-----END PRIVATE KEY-----"); + token = jwt.sign(key, algorithm: JWTAlgorithm.ES256); + + print('Signed token: \n $token\n'); + return token; + } + } +} diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2ac596b..7e36217 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -30,6 +30,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 web3dart: ^2.7.3 + dart_jsonwebtoken: ^2.7.1 dev_dependencies: flutter_test: diff --git a/lib/input.dart b/lib/input.dart index ed40323..5b5012d 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -474,7 +474,7 @@ class Web3AuthOptions { bool? includeUserDataInToken; Chains? chains; - String defaultChainId = '0x1'; + String? defaultChainId = '0x1'; bool enableLogging; /// [sessionTime] allows developers to configure the session management time. @@ -517,7 +517,7 @@ class Web3AuthOptions { this.sessionNamespace, this.includeUserDataInToken = true, this.chains, - required this.defaultChainId, + this.defaultChainId, this.enableLogging = false, this.sessionTime = 30 * 86400, required this.web3AuthNetwork, diff --git a/lib/output.dart b/lib/output.dart index 91d7455..1d06d34 100644 --- a/lib/output.dart +++ b/lib/output.dart @@ -11,14 +11,14 @@ class Web3AuthResponse { @JsonKey(name: 'ed25519PrivKey') final String? ed25519PrivateKey; - /// Current We3Auth sessionId. - final String? sessionId; - /// User's information based on the current session. final UserInfo? userInfo; final String? error; + /// Current We3Auth sessionId. + final String? sessionId; + /// secp256k1 core kit key. final String? coreKitKey; diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index 14e702a..652a600 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -32,9 +32,9 @@ class Web3AuthFlutter { 'connectTo', jsonEncode(loginParamsJson), ); - return Web3AuthResponse.fromJson(jsonDecode(loginResponse)); } on PlatformException catch (e) { + throw _handlePlatformException(e); } } From 6f13df3e21eafb30af6f4c778a195eb8f52536f4 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 23 Jun 2025 15:11:00 +0530 Subject: [PATCH 23/33] feat: update android sdk testing version Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 984f057..ffbe51d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:2.0.0.5' + implementation 'com.github.grvgoel81:web3auth-android-sdk:2.0.0.9' implementation 'com.google.code.gson:gson:2.10.1' } From 17949dfef582f4a4a18f3050a4c7c2d517d97879 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Thu, 10 Jul 2025 14:51:51 +0530 Subject: [PATCH 24/33] feat: EmailFlowType default value added Signed-off-by: Gaurav Goel --- lib/input.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/input.dart b/lib/input.dart index 5b5012d..fba0a28 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -238,7 +238,7 @@ class ExtraLoginOptions { this.userIdField, this.isUserIdCaseSensitive, this.access_token, - this.flow_type, + this.flow_type = EmailFlowType.code, this.display, this.prompt, this.max_age, From f5b738bf9e34a4b540dc055c7aa553d064f576b7 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 14 Jul 2025 09:55:01 +0400 Subject: [PATCH 25/33] feat: update androud sdk Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index ffbe51d..f8ad42d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:2.0.0.9' + implementation 'com.github.grvgoel81:web3auth-android-sdk:4.0.0.4' implementation 'com.google.code.gson:gson:2.10.1' } From 87134a15cc2e9a399fc507e3a9e63376d1ae68f9 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Tue, 15 Jul 2025 14:47:27 +0400 Subject: [PATCH 26/33] feat: update example Signed-off-by: Gaurav Goel --- example/lib/main.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 3a9f5df..78a7e79 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -267,7 +267,7 @@ class _MyAppState extends State with WidgetsBindingObserver { logoutVisible = false; }); } on UserCancelledException { - log("User cancelled."); + log("User cancelled"); } on UnKnownException { log("Unknown exception occurred"); } @@ -336,7 +336,7 @@ class _MyAppState extends State with WidgetsBindingObserver { Future sfaSignIn() { return Web3AuthFlutter.connectTo( - LoginParams(authConnection: AuthConnection.discord, + LoginParams(authConnection: AuthConnection.google, authConnectionId: "torus-test-health", idToken: Utils().es256Token("devnettestuser@tor.us"), groupedAuthConnectionId: "torus-aggregate-sapphire-mainnet")); From 885c61d4050872034ce8b2705da5aba955fa4541 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Fri, 25 Jul 2025 16:41:12 +0400 Subject: [PATCH 27/33] feat: optimize imports Signed-off-by: Gaurav Goel --- android/build.gradle | 2 +- .../web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 984f057..2aa716b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:2.0.0.5' + implementation 'com.github.grvgoel81:web3auth-android-sdk:4.0.0.7' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index 056f206..f19b1cb 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -3,7 +3,6 @@ package com.web3auth.flutter.web3auth_flutter import android.app.Activity import android.content.Context import android.content.Intent -import android.net.Uri import android.util.Log import androidx.annotation.Keep import androidx.annotation.NonNull @@ -12,7 +11,6 @@ import com.google.gson.JsonArray import com.google.gson.JsonElement import com.google.gson.JsonPrimitive import com.web3auth.core.Web3Auth -import com.web3auth.core.types.ChainConfig import com.web3auth.core.types.ErrorCode import com.web3auth.core.types.LoginParams import com.web3auth.core.types.Web3AuthError From 42f2b6b68615b6636b513d091d8840a47cf14c40 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Wed, 30 Jul 2025 09:16:05 +0400 Subject: [PATCH 28/33] feat: bump authDashboardVersion to v10. Signed-off-by: Gaurav Goel --- lib/input.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/input.dart b/lib/input.dart index fba0a28..515f219 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -607,13 +607,14 @@ String getWalletSdkUrl(BuildEnv? buildEnv) { String getDashboardUrl(BuildEnv? buildEnv) { const String walletAccountConstant = "wallet/account"; + const String authDashboardVersion = "v10"; switch (buildEnv) { case BuildEnv.staging: - return "https://staging-account.web3auth.io/$walletAccountConstant"; + return "https://staging-account.web3auth.io/$authDashboardVersion/$walletAccountConstant"; case BuildEnv.testing: return "https://develop-account.web3auth.io/$walletAccountConstant"; case BuildEnv.production: default: - return "https://account.web3auth.io/$walletAccountConstant"; + return "https://account.web3auth.io/$authDashboardVersion/$walletAccountConstant"; } } From 14407a0f16c33aaccff0e9be1506be2839d2c53f Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Thu, 31 Jul 2025 11:13:34 +0400 Subject: [PATCH 29/33] feat: swift method changes Signed-off-by: Gaurav Goel --- ios/Classes/SwiftWeb3AuthFlutterPlugin.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift index 6b9b5a0..7c3325d 100644 --- a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift +++ b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift @@ -60,7 +60,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { details: error.localizedDescription)) return } - case "login": + case "connectTo": guard let web3auth = web3auth else { result(FlutterError( @@ -83,7 +83,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } var resultMap: String = "" do { - let result = try await web3auth.login(loginParams) + let result = try await web3auth.connectTo(loginParams) let resultData = try encoder.encode(result) resultMap = String(decoding: resultData, as: UTF8.self) } catch { @@ -135,7 +135,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } do { - try await web3auth?.showWalletUI(chains: wsParams.chains, chainId: wsParams.chainId, path: wsParams.path) + try await web3auth?.showWalletUI(path: wsParams.path) result(nil) return } catch { @@ -197,7 +197,6 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { do { let signResponse = try await web3auth?.request( - chainConfig: reqParams.chainConfig, method: reqParams.method, requestParams: reqParams.requestParams, path: reqParams.path, @@ -256,13 +255,10 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } struct WalletServicesParams: Codable { - let chainConfig: [ChainConfig] - let chainId: String let path: String? } struct RequestJson: Codable { - let chainConfig: ChainConfig let method: String let requestParams: [String] let path: String? From 77c35f3e98719709ce01604d11a7b4d7b10434b2 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Fri, 8 Aug 2025 11:41:06 +0400 Subject: [PATCH 30/33] feat: flutter android analytics added --- android/build.gradle | 2 +- .../flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 2aa716b..d6cdd26 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,6 +52,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:4.0.0.7' + implementation 'com.github.grvgoel81:web3auth-android-sdk:5.0.0.1' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index f19b1cb..af71076 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -97,7 +97,10 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val initParams = gson.fromJson(initArgs, Web3AuthOptions::class.java) // handle custom parameters which are gson excluded val obj = JSONObject(initArgs) - if (obj.has("redirectUrl")) initParams.redirectUrl = obj.get("redirectUrl").toString() + if (obj.has("redirectUrl")) initParams.redirectUrl = + obj.get("redirectUrl").toString() + // set flutter analytics flag to true + initParams.setFlutterAnalytics(true, "7.0.0") // Log.d(initParams.toString(), "#initParams") web3auth = Web3Auth( initParams, activity!! From 877075952cef6190b5518350816828fee1d56d73 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 10 Nov 2025 18:29:16 +0700 Subject: [PATCH 31/33] feat: update android sdk and revert analytics change Signed-off-by: Gaurav Goel --- android/build.gradle | 3 +-- .../web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d6cdd26..ab87e1d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -51,7 +51,6 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' - //implementation 'com.github.Web3Auth:web3auth-android-sdk:9.1.3' - implementation 'com.github.grvgoel81:web3auth-android-sdk:5.0.0.1' + implementation 'com.github.Web3Auth:web3auth-android-sdk:10.0.0' implementation 'com.google.code.gson:gson:2.10.1' } diff --git a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt index af71076..e0a18b4 100644 --- a/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt +++ b/android/src/main/kotlin/com/web3auth/flutter/web3auth_flutter/Web3AuthFlutterPlugin.kt @@ -99,8 +99,6 @@ class Web3AuthFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, val obj = JSONObject(initArgs) if (obj.has("redirectUrl")) initParams.redirectUrl = obj.get("redirectUrl").toString() - // set flutter analytics flag to true - initParams.setFlutterAnalytics(true, "7.0.0") // Log.d(initParams.toString(), "#initParams") web3auth = Web3Auth( initParams, activity!! From 025c9623607fbd9bd78f7bc3b02dc0819b107807 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Sun, 16 Nov 2025 20:49:16 +0700 Subject: [PATCH 32/33] feat: update flutter swift sdk. Signed-off-by: Gaurav Goel --- example/lib/main.dart | 6 +- ios/Classes/SwiftWeb3AuthFlutterPlugin.swift | 103 ++++++++++++++++--- ios/web3auth_flutter.podspec | 2 +- lib/input.dart | 16 ++- lib/web3auth_flutter.dart | 1 + 5 files changed, 108 insertions(+), 20 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 78a7e79..55f2db0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -82,6 +82,7 @@ class _MyAppState extends State with WidgetsBindingObserver { redirectUrl: redirectUrl, authConnectionConfig: authConnectionConfig, defaultChainId: "0x1", + isFlutterAnalytics: true, ), ); @@ -309,7 +310,10 @@ class _MyAppState extends State with WidgetsBindingObserver { Future _withGoogle() { return Web3AuthFlutter.connectTo( LoginParams( - authConnection: AuthConnection.google, mfaLevel: MFALevel.NONE), + authConnection: AuthConnection.google, + authConnectionId: "w3ads", + groupedAuthConnectionId: "aggregate-mobile", + mfaLevel: MFALevel.NONE), ); } diff --git a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift index 7c3325d..9c10bcd 100644 --- a/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift +++ b/ios/Classes/SwiftWeb3AuthFlutterPlugin.swift @@ -1,6 +1,7 @@ import Flutter import UIKit import Web3Auth +import FetchNodeDetails public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { public static func register(with registrar: FlutterPluginRegistrar) { @@ -9,9 +10,28 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { registrar.addMethodCallDelegate(instance, channel: channel) } + private func getNetwork(_ network: String) -> Web3AuthNetwork { + switch network { + case "mainnet": + return .MAINNET + case "testnet": + return .TESTNET + case "aqua": + return .AQUA + case "cyan": + return .CYAN + case "sapphire_devnet": + return .SAPPHIRE_DEVNET + case "sapphire_mainnet": + return .SAPPHIRE_MAINNET + default: + return .SAPPHIRE_MAINNET + } + } + var web3auth: Web3Auth? - public var state: Web3AuthState? { - return web3auth?.state + public var web3AuthResponse: Web3AuthResponse? { + return web3auth?.web3AuthResponse } var decoder = JSONDecoder() var encoder = JSONEncoder() @@ -36,10 +56,37 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { // print("call data", data) switch call.method { case "init": - let initParams: W3AInitParams + var options: Web3AuthOptions + //print("RAW INIT DATA:", String(data: data, encoding: .utf8) ?? "Invalid UTF8") do { - initParams = try decoder.decode(W3AInitParams.self, from: data) - // print(initParams, "params") + let params = try decoder.decode(InitParams.self, from: data) + let network = getNetwork(params.network) + let buildEnv: BuildEnv = BuildEnv(rawValue: params.authBuildEnv ?? "production") ?? .production + options = Web3AuthOptions( + clientId: params.clientId, + redirectUrl: params.redirectUrl, + originData: params.originData, + authBuildEnv: buildEnv, + sdkUrl: params.sdkUrl, + storageServerUrl: params.storageServerUrl, + sessionSocketUrl: params.sessionSocketUrl, + authConnectionConfig: params.authConnectionConfig, + whiteLabel: params.whiteLabel, + dashboardUrl: params.dashboardUrl, + accountAbstractionConfig: params.accountAbstractionConfig, + walletSdkUrl: params.walletSdkUrl, + includeUserDataInToken: params.includeUserDataInToken ?? true, + chains: params.chains, + defaultChainId: params.defaultChainId ?? "0x1", + enableLogging: params.enableLogging ?? false, + sessionTime: params.sessionTime ?? 30 * 86400, + web3AuthNetwork: network, + useSFAKey: params.useSFAKey ?? false, + walletServicesConfig: params.walletServicesConfig, + mfaSettings: params.mfaSettings + ) + + options.setFlutterAnalytics(params.isFlutterAnalytics ?? true, sdkVersion: params.sdkVersion) } catch { // print(error) result(FlutterError( @@ -49,7 +96,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { return } do { - let web3auth = try await Web3Auth(initParams) + let web3auth = try await Web3Auth(options: options) self.web3auth = web3auth result(nil) return @@ -69,12 +116,12 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { details: nil)) return } - let loginParams: W3ALoginParams + let loginParams: LoginParams do { - loginParams = try decoder.decode(W3ALoginParams.self, from: data) - //print("loginParams: \(loginParams)") + loginParams = try decoder.decode(LoginParams.self, from: data) + print("loginParams: \(loginParams)") } catch { - //print(error) + print(error) result(FlutterError( code: "INVALID_ARGUMENTS", message: "Invalid Login Params", @@ -83,7 +130,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } var resultMap: String = "" do { - let result = try await web3auth.connectTo(loginParams) + let result = try await web3auth.connectTo(loginParams: loginParams) let resultData = try encoder.encode(result) resultMap = String(decoding: resultData, as: UTF8.self) } catch { @@ -118,14 +165,13 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { result(privKey) return case "getEd25519PrivateKey": - let getEd25519PrivKey = web3auth?.getEd25519PrivateKey() + let getEd25519PrivKey = try? web3auth?.getEd25519PrivateKey() result(getEd25519PrivKey) return case "showWalletUI": let wsParams: WalletServicesParams do { wsParams = try decoder.decode(WalletServicesParams.self, from: data) - print("chainConfig: \(wsParams.chainConfig)") } catch { result(FlutterError( code: "INVALID_ARGUMENTS", @@ -147,7 +193,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } case "enableMFA": do { - let loginParams = try? decoder.decode(W3ALoginParams.self, from: data) + let loginParams = try? decoder.decode(LoginParams.self, from: data) if let params = loginParams { let enableMFAResult = try await web3auth?.enableMFA(params) @@ -166,7 +212,7 @@ public class SwiftWeb3AuthFlutterPlugin: NSObject, FlutterPlugin { } case "manageMFA": do { - let loginParams = try? decoder.decode(W3ALoginParams.self, from: data) + let loginParams = try? decoder.decode(LoginParams.self, from: data) if let params = loginParams { let manageMFAResult = try await web3auth?.manageMFA(params) @@ -264,3 +310,30 @@ struct RequestJson: Codable { let path: String? let appState: String? } + +struct InitParams: Codable { + let clientId: String + let redirectUrl: String + let originData: [String: String]? + let authBuildEnv: String? + let sdkUrl: String? + let storageServerUrl: String? + let sessionSocketUrl: String? + let authConnectionConfig: [AuthConnectionConfig]? + let whiteLabel: WhiteLabelData? + let dashboardUrl: String? + let accountAbstractionConfig: String? + let walletSdkUrl: String? + let sessionNamespace: String? + let includeUserDataInToken: Bool? + let chains: [Chains]? + let defaultChainId: String? + let enableLogging: Bool? + let sessionTime: Int? + let network: String + let useSFAKey: Bool? + let walletServicesConfig: WalletServicesConfig? + let mfaSettings: MfaSettings? + let isFlutterAnalytics: Bool? + let sdkVersion: String? +} diff --git a/ios/web3auth_flutter.podspec b/ios/web3auth_flutter.podspec index e83606b..b1f59c8 100644 --- a/ios/web3auth_flutter.podspec +++ b/ios/web3auth_flutter.podspec @@ -15,7 +15,7 @@ Flutter SDK for Torus Web3Auth (OpenLogin) s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Web3Auth', '~> 11.1.0' + s.dependency 'Web3Auth', '~> 12.0.0' s.platform = :ios, '14.0' # Flutter.framework does not contain a i386 slice. diff --git a/lib/input.dart b/lib/input.dart index 515f219..6f2572d 100644 --- a/lib/input.dart +++ b/lib/input.dart @@ -64,7 +64,7 @@ class LoginParams { 'authConnectionId': authConnectionId, 'groupedAuthConnectionId': groupedAuthConnectionId, 'appState': appState, - 'mfaLevel': mfaLevel?.name, + 'mfaLevel': mfaLevel?.type, 'extraLoginOptions': extraLoginOptions?.toJson(), 'dappShare': dappShare, 'curve': curve?.name, @@ -501,6 +501,12 @@ class Web3AuthOptions { /// Checkout [MFA SDK Reference](https://web3auth.io/docs/sdk/pnp/flutter/mfa) for more details. final MfaSettings? mfaSettings; + /// Indicates if this is a Flutter SDK session + bool isFlutterAnalytics; + + /// SDK version (used mainly for Flutter SDK) + String? sdkVersion; + Web3AuthOptions({ required this.clientId, required this.redirectUrl, @@ -524,6 +530,8 @@ class Web3AuthOptions { this.useSFAKey = false, this.walletServicesConfig, this.mfaSettings, + this.isFlutterAnalytics = true, + this.sdkVersion, }) : sdkUrl = sdkUrl ?? getSdkUrl(authBuildEnv), dashboardUrl = dashboardUrl ?? getDashboardUrl(authBuildEnv), walletSdkUrl = walletSdkUrl ?? getWalletSdkUrl(authBuildEnv); @@ -533,7 +541,7 @@ class Web3AuthOptions { 'clientId': clientId, 'redirectUrl': redirectUrl, 'originData': originData, - 'buildEnv': authBuildEnv?.name, + 'buildEnv': authBuildEnv?.name.toLowerCase(), 'sdkUrl': sdkUrl, 'storageServerUrl': storageServerUrl, 'sessionSocketUrl': sessionSocketUrl, @@ -548,10 +556,12 @@ class Web3AuthOptions { 'defaultChainId': defaultChainId, 'enableLogging': enableLogging, 'sessionTime': sessionTime, - 'network': web3AuthNetwork.name, + 'network': web3AuthNetwork.name.toLowerCase(), 'useSFAKey': useSFAKey, 'walletServicesConfig': walletServicesConfig?.toJson(), 'mfaSettings': mfaSettings?.toJson(), + 'isFlutterAnalytics': isFlutterAnalytics, + 'sdkVersion': sdkVersion, }; } } diff --git a/lib/web3auth_flutter.dart b/lib/web3auth_flutter.dart index 652a600..f68ccb8 100644 --- a/lib/web3auth_flutter.dart +++ b/lib/web3auth_flutter.dart @@ -28,6 +28,7 @@ class Web3AuthFlutter { try { Map loginParamsJson = loginParams.toJson(); loginParamsJson.removeWhere((key, value) => value == null); + //print(jsonEncode(loginParamsJson)); final String loginResponse = await _channel.invokeMethod( 'connectTo', jsonEncode(loginParamsJson), From 8516c2e201b7c0dd37d24fc05e8e52e1cc0cd70f Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 12 Jan 2026 14:13:05 +0700 Subject: [PATCH 33/33] feat: update android gradle settings and bump swift sdk to 12.0.1 Signed-off-by: Gaurav Goel --- example/android/app/build.gradle | 1 + .../android/app/src/main/AndroidManifest.xml | 3 +- example/android/build.gradle | 5 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/settings.gradle | 4 +- example/ios/Podfile.lock | 44 +++++++-- example/lib/main.dart | 2 - example/pubspec.lock | 94 +++++++++++++------ ios/web3auth_flutter.podspec | 2 +- 9 files changed, 106 insertions(+), 51 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 8756c18..c313f3e 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -24,6 +24,7 @@ if (flutterVersionName == null) { } android { + namespace "com.web3auth.flutter.web3auth_flutter_example" compileSdkVersion flutter.compileSdkVersion compileOptions { diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index ec00abe..697fc9a 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ + xmlns:tools="http://schemas.android.com/tools"> 5.2.0) + - Torus-utils (10.0.1): + - curvelib.swift (~> 2.0.0) + - Torus-fetchNodeDetails (~> 8.0.1) + - TorusSessionManager (6.1.0): - curvelib.swift (~> 2.0.0) - KeychainSwift (~> 20.0.0) - - Web3Auth (11.0.5): + - Web3Auth (12.0.1): + - AnalyticsSwiftCocoapod (~> 1.8.0) - BigInt (~> 5.2.0) - curvelib.swift (~> 2.0.0) + - JWTDecode (~> 3.3.0) - KeychainSwift (~> 20.0.0) - - TorusSessionManager (~> 6.0.2) + - Torus-utils (~> 10.0.1) + - TorusSessionManager (~> 6.1.0) - web3auth_flutter (2.0.1): - Flutter - - Web3Auth (~> 11.0.5) + - Web3Auth (~> 12.0.1) DEPENDENCIES: - Flutter (from `Flutter`) @@ -21,9 +35,15 @@ DEPENDENCIES: SPEC REPOS: https://github.com/CocoaPods/Specs.git: + - AnalyticsSwiftCocoapod - BigInt - curvelib.swift + - JSONSafeEncoding + - JWTDecode - KeychainSwift + - Sovran + - Torus-fetchNodeDetails + - Torus-utils - TorusSessionManager - Web3Auth @@ -34,14 +54,20 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/web3auth_flutter/ios" SPEC CHECKSUMS: + AnalyticsSwiftCocoapod: cc3e4d4e381a080c89a6f5f56845577c298bc627 BigInt: f668a80089607f521586bbe29513d708491ef2f7 curvelib.swift: b9223e5cac801effed8a5fe8968e952b3fe427a5 - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 + JSONSafeEncoding: 54722ebc4fe1482e3e60a8450e1287481e32dd8b + JWTDecode: 1ca6f765844457d0dd8690436860fecee788f631 KeychainSwift: 0ce6a4d13f7228054d1a71bb1b500448fb2ab837 - TorusSessionManager: 3c47c2a4c4d6173a10006eb0af4b86317ee45ff8 - Web3Auth: cf501e2bccf63d7a9746c0e53eb98cf143841a5c - web3auth_flutter: 79be94bbb719a1837c79e0c07e793abd64e11dd7 + Sovran: f8212bb3855042a24689a73ea0219ca5295235da + Torus-fetchNodeDetails: 0ae97719263ee98f5bf5549a86464eea38a828f3 + Torus-utils: 7c53a9c71663c2f458bfdcf1a380d7a5b88f9632 + TorusSessionManager: cd2de693425cefb976c7bca42a45964297d8c2cc + Web3Auth: 5459b2d5bcdb150c5e84c7229639422cba684814 + web3auth_flutter: 9c145c6b87ac77f1cbd2a016188ac9ec6162b243 PODFILE CHECKSUM: 1d58595b82b880200a7ded05da9181d30ef8c1b7 -COCOAPODS: 1.14.2 +COCOAPODS: 1.16.2 diff --git a/example/lib/main.dart b/example/lib/main.dart index 55f2db0..f8748b6 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -311,8 +311,6 @@ class _MyAppState extends State with WidgetsBindingObserver { return Web3AuthFlutter.connectTo( LoginParams( authConnection: AuthConnection.google, - authConnectionId: "w3ads", - groupedAuthConnectionId: "aggregate-mobile", mfaLevel: MFALevel.NONE), ); } diff --git a/example/pubspec.lock b/example/pubspec.lock index b2a4b54..08a0899 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + adaptive_number: + dependency: transitive + description: + name: adaptive_number + sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77" + url: "https://pub.dev" + source: hosted + version: "1.0.0" async: dependency: transitive description: @@ -21,26 +29,26 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" clock: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.1" convert: dependency: transitive description: @@ -65,6 +73,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" + dart_jsonwebtoken: + dependency: "direct main" + description: + name: dart_jsonwebtoken + sha256: "00a0812d2aeaeb0d30bcbc4dd3cee57971dbc0ab2216adf4f0247f37793f15ef" + url: "https://pub.dev" + source: hosted + version: "2.17.0" + ed25519_edwards: + dependency: transitive + description: + name: ed25519_edwards + sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd" + url: "https://pub.dev" + source: hosted + version: "0.3.1" eip1559: dependency: transitive description: @@ -85,10 +109,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.3" fixnum: dependency: transitive description: @@ -139,6 +163,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" json_rpc_2: dependency: transitive description: @@ -151,26 +183,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -183,10 +215,10 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.17" material_color_utilities: dependency: transitive description: @@ -199,18 +231,18 @@ packages: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.0" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" pointycastle: dependency: transitive description: @@ -231,7 +263,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -252,18 +284,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" stream_transform: dependency: transitive description: @@ -292,10 +324,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.7" typed_data: dependency: transitive description: @@ -316,10 +348,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -350,7 +382,7 @@ packages: path: ".." relative: true source: path - version: "6.1.0" + version: "6.2.0" web3dart: dependency: "direct main" description: @@ -360,5 +392,5 @@ packages: source: hosted version: "2.7.3" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.8.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/ios/web3auth_flutter.podspec b/ios/web3auth_flutter.podspec index b1f59c8..b261a90 100644 --- a/ios/web3auth_flutter.podspec +++ b/ios/web3auth_flutter.podspec @@ -15,7 +15,7 @@ Flutter SDK for Torus Web3Auth (OpenLogin) s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Web3Auth', '~> 12.0.0' + s.dependency 'Web3Auth', '~> 12.0.1' s.platform = :ios, '14.0' # Flutter.framework does not contain a i386 slice.