Skip to content

Update Flutter examples #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ PODS:
- SimpleKeychain (1.2.0)
- single_factor_auth_flutter (0.0.1):
- Flutter
- SingleFactorAuth (= 9.0.4)
- SingleFactorAuth (9.0.4):
- SingleFactorAuth (= 9.1.0)
- SingleFactorAuth (9.1.0):
- JWTDecode (~> 3.2)
- Torus-utils (~> 10.0.0)
- TorusSessionManager (~> 6.0.2)
- Torus-utils (~> 10.0.1)
- TorusSessionManager (~> 6.1.0)
- Torus-fetchNodeDetails (8.0.1):
- BigInt (~> 5.2.0)
- Torus-utils (10.0.1):
- curvelib.swift (~> 2.0.0)
- Torus-fetchNodeDetails (~> 8.0.1)
- TorusSessionManager (6.0.2):
- TorusSessionManager (6.1.0):
- curvelib.swift (~> 2.0.0)
- KeychainSwift (~> 20.0.0)

Expand Down Expand Up @@ -62,11 +62,11 @@ SPEC CHECKSUMS:
JWTDecode: 7dae24cb9bf9b608eae61e5081029ec169bb5527
KeychainSwift: 0ce6a4d13f7228054d1a71bb1b500448fb2ab837
SimpleKeychain: 768cf43ae778b1c21816e94dddf01bb8ee96a075
single_factor_auth_flutter: aab0e8cb32b6e76fe5cb8a2036489367bc549338
SingleFactorAuth: 6a2639e2d25d4cec901753193b97f8503734734d
single_factor_auth_flutter: a88b865146d24d217ff13d567060631350208511
SingleFactorAuth: ddb65765484f6e98813797b007e094996c2bc4b9
Torus-fetchNodeDetails: 0ae97719263ee98f5bf5549a86464eea38a828f3
Torus-utils: 7c53a9c71663c2f458bfdcf1a380d7a5b88f9632
TorusSessionManager: 3c47c2a4c4d6173a10006eb0af4b86317ee45ff8
TorusSessionManager: cd2de693425cefb976c7bca42a45964297d8c2cc

PODFILE CHECKSUM: 56264e0dd12a31d6c8ce70118e2f08719327d55d

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ packages:
dependency: "direct main"
description:
name: single_factor_auth_flutter
sha256: bc7702d92711ce4f11977ae074370a75de2bdcde45645a33af282f0a6a7e7369
sha256: "0fa78d329b61dbf39aebe0f21b690c6ae131f6276c6d5bca13d71b171ef88ae9"
url: "https://pub.dev"
source: hosted
version: "6.0.1"
version: "7.0.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
get_it: ^8.0.0
http: ^1.2.2
provider: ^6.1.2
single_factor_auth_flutter: ^6.0.1
single_factor_auth_flutter: ^7.0.0
web3dart: ^2.7.3

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Keep the plugin class and its methods
-keep class com.web3auth.singlefactorauth.** { *; }
-keep class com.web3auth.singlefactorauth.types.** { *; }

# Keep Gson serialized classes (prevents issues with reflection-based deserialization)
-keep class com.google.gson.** { *; }
-keepattributes *Annotation*

-keep class org.torusresearch.fetchnodedetails.types.** { *; }
-keepclassmembers enum * { *; }
-printmapping mapping.txt
20 changes: 10 additions & 10 deletions single-factor-auth-flutter/sfa_flutter_quick_start/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GTMSessionFetcher/Core (3.5.0)
- JWTDecode (3.2.0)
- JWTDecode (3.3.0)
- KeychainSwift (20.0.0)
- PromisesObjC (2.4.0)
- RecaptchaInterop (100.0.0)
- single_factor_auth_flutter (0.0.1):
- Flutter
- SingleFactorAuth (= 9.0.4)
- SingleFactorAuth (9.0.4):
- SingleFactorAuth (= 9.1.0)
- SingleFactorAuth (9.1.0):
- JWTDecode (~> 3.2)
- Torus-utils (~> 10.0.0)
- TorusSessionManager (~> 6.0.2)
- Torus-utils (~> 10.0.1)
- TorusSessionManager (~> 6.1.0)
- Torus-fetchNodeDetails (8.0.1):
- BigInt (~> 5.2.0)
- Torus-utils (10.0.1):
- curvelib.swift (~> 2.0.0)
- Torus-fetchNodeDetails (~> 8.0.1)
- TorusSessionManager (6.0.2):
- TorusSessionManager (6.1.0):
- curvelib.swift (~> 2.0.0)
- KeychainSwift (~> 20.0.0)

Expand Down Expand Up @@ -120,15 +120,15 @@ SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
JWTDecode: 7dae24cb9bf9b608eae61e5081029ec169bb5527
JWTDecode: 1ca6f765844457d0dd8690436860fecee788f631
KeychainSwift: 0ce6a4d13f7228054d1a71bb1b500448fb2ab837
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
single_factor_auth_flutter: aab0e8cb32b6e76fe5cb8a2036489367bc549338
SingleFactorAuth: 6a2639e2d25d4cec901753193b97f8503734734d
single_factor_auth_flutter: a88b865146d24d217ff13d567060631350208511
SingleFactorAuth: ddb65765484f6e98813797b007e094996c2bc4b9
Torus-fetchNodeDetails: 0ae97719263ee98f5bf5549a86464eea38a828f3
Torus-utils: 7c53a9c71663c2f458bfdcf1a380d7a5b88f9632
TorusSessionManager: 3c47c2a4c4d6173a10006eb0af4b86317ee45ff8
TorusSessionManager: cd2de693425cefb976c7bca42a45964297d8c2cc

PODFILE CHECKSUM: 8829a2c70d7efdc95f3d8431d36cdb48fed2bec5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Web3AuthSFA {
network: Web3AuthNetwork.mainnet,
clientId:
"BJRZ6qdDTbj6Vd5YXvV994TYCqY42-PxldCetmvGTUdoq6pkCqdpuC1DIehz76zuYdaq1RJkXGHuDraHRhCQHvA",
redirectUrl: 'com.example.sfa_flutter_quick_start',
),
);
// IMP END - Initialize Web3Auth SFA
Expand All @@ -37,6 +38,38 @@ class Web3AuthSFA {
}
}

Future<void> showWalletUI() async {
try {
final chainConfig = ChainConfig(
chainId: '0xaa36a7',
rpcTarget: 'https://1rpc.io/sepolia',
);
await singleFactorAuthFlutter.showWalletUI(chainConfig);
} catch (e) {
log("Error showing wallet UI: $e");
}
}

Future<void> showTransactionUI() async {
try {
final chainConfig = ChainConfig(
chainId: '0xaa36a7',
rpcTarget: 'https://1rpc.io/sepolia',
);

final sessionData = await singleFactorAuthFlutter.getSessionData();
final result =
await singleFactorAuthFlutter.request(chainConfig, "personal_sign", [
"Hello, Web3Auth from Flutter SFA!",
sessionData!.publicAddress,
]);

log("Transaction result: $result");
} catch (e) {
log("Error showing wallet UI: $e");
}
}

Future<SessionData> getKey(User user) async {
// IMP START - Get Key
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ class _HomePageState extends State<HomePage> {
},
),
const SizedBox(height: 24),
ElevatedButton(
onPressed: () {
web3authSFA.showWalletUI();
},
child: const Text('Show Wallet UI'),
),
ElevatedButton(
onPressed: () {
web3authSFA.showTransactionUI();
},
child: const Text('Show Transaction UI'),
),
ElevatedButton(
onPressed: () {
// Use the AuthService class to handle sign out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ packages:
dependency: "direct main"
description:
name: single_factor_auth_flutter
sha256: bc7702d92711ce4f11977ae074370a75de2bdcde45645a33af282f0a6a7e7369
sha256: "0fa78d329b61dbf39aebe0f21b690c6ae131f6276c6d5bca13d71b171ef88ae9"
url: "https://pub.dev"
source: hosted
version: "6.0.1"
version: "7.0.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
firebase_core: ^2.24.2
provider: ^6.1.1
# // IMP START - Installation
single_factor_auth_flutter: ^6.0.1
single_factor_auth_flutter: 7.0.0
get_it: ^7.6.7
# // IMP END - Installation

Expand Down
32 changes: 16 additions & 16 deletions single-factor-auth-flutter/sfa_flutter_solana/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- AppAuth (1.7.5):
- AppAuth/Core (= 1.7.5)
- AppAuth/ExternalUserAgent (= 1.7.5)
- AppAuth/Core (1.7.5)
- AppAuth/ExternalUserAgent (1.7.5):
- AppAuth (1.7.6):
- AppAuth/Core (= 1.7.6)
- AppAuth/ExternalUserAgent (= 1.7.6)
- AppAuth/Core (1.7.6)
- AppAuth/ExternalUserAgent (1.7.6):
- AppAuth/Core
- BigInt (5.2.0)
- curvelib.swift (2.0.0)
Expand Down Expand Up @@ -68,23 +68,23 @@ PODS:
- AppAuth/Core (~> 1.7)
- GTMSessionFetcher/Core (< 4.0, >= 3.3)
- GTMSessionFetcher/Core (3.5.0)
- JWTDecode (3.2.0)
- JWTDecode (3.3.0)
- KeychainSwift (20.0.0)
- PromisesObjC (2.4.0)
- RecaptchaInterop (100.0.0)
- single_factor_auth_flutter (0.0.1):
- Flutter
- SingleFactorAuth (= 9.0.4)
- SingleFactorAuth (9.0.4):
- SingleFactorAuth (= 9.1.0)
- SingleFactorAuth (9.1.0):
- JWTDecode (~> 3.2)
- Torus-utils (~> 10.0.0)
- TorusSessionManager (~> 6.0.2)
- Torus-utils (~> 10.0.1)
- TorusSessionManager (~> 6.1.0)
- Torus-fetchNodeDetails (8.0.1):
- BigInt (~> 5.2.0)
- Torus-utils (10.0.1):
- curvelib.swift (~> 2.0.0)
- Torus-fetchNodeDetails (~> 8.0.1)
- TorusSessionManager (6.0.2):
- TorusSessionManager (6.1.0):
- curvelib.swift (~> 2.0.0)
- KeychainSwift (~> 20.0.0)

Expand Down Expand Up @@ -131,7 +131,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/single_factor_auth_flutter/ios"

SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73
BigInt: f668a80089607f521586bbe29513d708491ef2f7
curvelib.swift: b9223e5cac801effed8a5fe8968e952b3fe427a5
Firebase: 0312a2352584f782ea56f66d91606891d4607f06
Expand All @@ -147,15 +147,15 @@ SPEC CHECKSUMS:
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
JWTDecode: 7dae24cb9bf9b608eae61e5081029ec169bb5527
JWTDecode: 1ca6f765844457d0dd8690436860fecee788f631
KeychainSwift: 0ce6a4d13f7228054d1a71bb1b500448fb2ab837
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
single_factor_auth_flutter: aab0e8cb32b6e76fe5cb8a2036489367bc549338
SingleFactorAuth: 6a2639e2d25d4cec901753193b97f8503734734d
single_factor_auth_flutter: a88b865146d24d217ff13d567060631350208511
SingleFactorAuth: ddb65765484f6e98813797b007e094996c2bc4b9
Torus-fetchNodeDetails: 0ae97719263ee98f5bf5549a86464eea38a828f3
Torus-utils: 7c53a9c71663c2f458bfdcf1a380d7a5b88f9632
TorusSessionManager: 3c47c2a4c4d6173a10006eb0af4b86317ee45ff8
TorusSessionManager: cd2de693425cefb976c7bca42a45964297d8c2cc

PODFILE CHECKSUM: 1959d098c91d8a792531a723c4a9d7e9f6a01e38

Expand Down
4 changes: 2 additions & 2 deletions single-factor-auth-flutter/sfa_flutter_solana/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,10 @@ packages:
dependency: "direct main"
description:
name: single_factor_auth_flutter
sha256: bc7702d92711ce4f11977ae074370a75de2bdcde45645a33af282f0a6a7e7369
sha256: "0fa78d329b61dbf39aebe0f21b690c6ae131f6276c6d5bca13d71b171ef88ae9"
url: "https://pub.dev"
source: hosted
version: "6.0.1"
version: "7.0.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down
2 changes: 1 addition & 1 deletion single-factor-auth-flutter/sfa_flutter_solana/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
get_it: ^7.6.7
single_factor_auth_flutter: ^6.0.1
single_factor_auth_flutter: ^7.0.0
firebase_auth: ^4.15.3
firebase_core: ^2.24.2
google_sign_in: ^6.2.1
Expand Down