-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update sfa android deps and code changes related to session man…
…ager and sfa Signed-off-by: Gaurav Goel <[email protected]>
- Loading branch information
Showing
10 changed files
with
118 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
android/src/main/kotlin/com/web3auth/single_factor_auth_flutter/SFAOptions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.web3auth.single_factor_auth_flutter | ||
|
||
data class SFAOptions(val network: String, var clientid: String) |
3 changes: 0 additions & 3 deletions
3
android/src/main/kotlin/com/web3auth/single_factor_auth_flutter/SFAParams.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ class _MyAppState extends State<MyApp> { | |
final _singleFactorAuthFlutterPlugin = SingleFactAuthFlutter(); | ||
String _result = ''; | ||
bool logoutVisible = false; | ||
Web3AuthNetwork torusNetwork = Web3AuthNetwork.aqua; | ||
Web3AuthNetwork torusNetwork = Web3AuthNetwork.mainnet; | ||
|
||
@override | ||
void initState() { | ||
|
@@ -35,10 +35,14 @@ class _MyAppState extends State<MyApp> { | |
Future<void> initSdk() async { | ||
if (Platform.isAndroid) { | ||
await init(); | ||
initialize(); | ||
if (await _singleFactorAuthFlutterPlugin.isSessionIdExists()) { | ||
initialize(); | ||
} | ||
} else if (Platform.isIOS) { | ||
await init(); | ||
initialize(); | ||
if (await _singleFactorAuthFlutterPlugin.isSessionIdExists()) { | ||
initialize(); | ||
} | ||
} else {} | ||
} | ||
|
||
|
@@ -49,12 +53,11 @@ class _MyAppState extends State<MyApp> { | |
|
||
Future<void> initialize() async { | ||
log("initialize() called"); | ||
final TorusKey? torusKey = | ||
await _singleFactorAuthFlutterPlugin.initialize(); | ||
if (torusKey != null) { | ||
final SFAKey? sfaKey = await _singleFactorAuthFlutterPlugin.initialize(); | ||
if (sfaKey != null) { | ||
setState(() { | ||
_result = | ||
"Public Add : ${torusKey.publicAddress} , Private Key : ${torusKey.privateKey}"; | ||
"Public Add : ${sfaKey.publicAddress} , Private Key : ${sfaKey.privateKey}"; | ||
}); | ||
} | ||
} | ||
|
@@ -134,10 +137,10 @@ class _MyAppState extends State<MyApp> { | |
); | ||
} | ||
|
||
VoidCallback _getKey(Future<TorusKey> Function() method) { | ||
VoidCallback _getKey(Future<SFAKey> Function() method) { | ||
return () async { | ||
try { | ||
final TorusKey response = await method(); | ||
final SFAKey response = await method(); | ||
setState(() { | ||
_result = | ||
"Public Add : ${response.publicAddress} , Private Key : ${response.privateKey}"; | ||
|
@@ -155,7 +158,7 @@ class _MyAppState extends State<MyApp> { | |
|
||
Future<void> _initialize() async { | ||
try { | ||
final TorusKey? response = | ||
final SFAKey? response = | ||
await _singleFactorAuthFlutterPlugin.initialize(); | ||
setState(() { | ||
_result = "Private Key : ${response?.privateKey}"; | ||
|
@@ -168,24 +171,11 @@ class _MyAppState extends State<MyApp> { | |
} | ||
} | ||
|
||
Future<TorusKey> getKey() { | ||
return _singleFactorAuthFlutterPlugin.getKey( | ||
LoginParams( | ||
Future<SFAKey> getKey() { | ||
return _singleFactorAuthFlutterPlugin.connect(LoginParams( | ||
verifier: 'torus-test-health', | ||
verifierId: '[email protected]', | ||
idToken: Utils().es256Token("[email protected]"), | ||
), | ||
); | ||
} | ||
|
||
Future<TorusKey> getAggregrateKey() { | ||
return _singleFactorAuthFlutterPlugin.getAggregateKey( | ||
LoginParams( | ||
verifier: 'torus-test-health', | ||
verifierId: '[email protected]', | ||
idToken: Utils().es256Token("[email protected]"), | ||
aggregateVerifier: 'torus-test-health-aggregate', | ||
), | ||
); | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.